bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easier to read diff -u output


From: Dan Hipschman
Subject: Re: Easier to read diff -u output
Date: Wed, 15 Nov 2006 20:40:53 -0800
User-agent: Mutt/1.5.9i

On Wed, Nov 15, 2006 at 03:28:00PM -0800, Bruce Korb wrote:
> I've got a similar sized diff that reminds me of another
> useful consideration:
> 
> @@ -47,12 +60,20 @@
>  
>  test_onehost()
>  {
> +    set_func test_onehost
> +    val_onehost_params
>      seed=${RANDOM}
> -    wwg1=$(printf 123456789ABC%04X ${seed} | \
> +    test -z "${seed}" && seed=`date +%M%S|sed 's/^0*//'`
> +    typeset wwg1=$(printf 432187659ABC%04X ${seed} | \
>             sed 's/\(.\{16\}\).*/\1/' )
> -    wwg2=$(printf 123456789ABC%04X $(( ${seed} + 1 )) | \
> +    typeset wwg2=$(printf 432187659ABC%04X $(( ${seed} + 1 )) | \
>             sed 's/\(.\{16\}\).*/\1/' )
> -    cli > ${ST_SAVE_DIR}/setup.stdout 2> ${ST_SAVE_DIR}/setup.stderr
> <<- _EOF_
> +    exec 5> ${ONE_HOST_SAVE_DIR}/config
> +    echo typeset testname=${testname} >&5
> +    printf 'typeset wwg1=%s\ntypeset wwg2=%s\n' ${wwg1} ${wwg2} >&5
> +
> +    cli > ${ONE_HOST_SAVE_DIR}/setup.stdout \
> +       2> ${ONE_HOST_SAVE_DIR}/setup.stderr <<- _EOF_
>      createhost ${testname}-1 ${wwg1}
>      createhost ${testname}-2 ${wwg2}
> 
> Something along the lines of, "if there is just the occasional
> line that matches, then _even_if_ the line is more complex
> than, say, ``^[[:space:]]*{[[:space:]]*$'', the line should be
> considered part of the block of replaced text."

It does now:

$ ./diff --more-readable -u ~/foo/{x,y}
--- /home/dsh/foo/x     2006-11-15 20:21:19.000000000 -0800
+++ /home/dsh/foo/y     2006-11-15 20:21:12.000000000 -0800
@@ -1,11 +1,19 @@

 test_onehost()
 {
+    set_func test_onehost
+    val_onehost_params
     seed=${RANDOM}
-    wwg1=$(printf 123456789ABC%04X ${seed} | \
-           sed 's/\(.\{16\}\).*/\1/' )
-    wwg2=$(printf 123456789ABC%04X $(( ${seed} + 1 )) | \
-           sed 's/\(.\{16\}\).*/\1/' )
-    cli > ${ST_SAVE_DIR}/setup.stdout 2> ${ST_SAVE_DIR}/setup.stderr <<- _EOF_
+    test -z "${seed}" && seed=`date +%M%S|sed 's/^0*//'`
+    typeset wwg1=$(printf 432187659ABC%04X ${seed} | \
+           sed 's/\(.\{16\}\).*/\1/' )
+    typeset wwg2=$(printf 432187659ABC%04X $(( ${seed} + 1 )) | \
+           sed 's/\(.\{16\}\).*/\1/' )
+    exec 5> ${ONE_HOST_SAVE_DIR}/config
+    echo typeset testname=${testname} >&5
+    printf 'typeset wwg1=%s\ntypeset wwg2=%s\n' ${wwg1} ${wwg2} >&5
+
+    cli > ${ONE_HOST_SAVE_DIR}/setup.stdout \
+       2> ${ONE_HOST_SAVE_DIR}/setup.stderr <<- _EOF_
     createhost ${testname}-1 ${wwg1}
     createhost ${testname}-2 ${wwg2}

However, project maintainers that have to carefully examine patches that
people send them probably won't like this because they will have to scan
these complicated lines very carefully to determine whether the line has
changed or not.  If we only absorb very simple lines, it's immediately
obvious.

> Making this new feature the default would be wonderful!  :)
> Thank you for doing it, Dan!

Thanks :-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]