{"thread":{"id":"22988","subject":"[PATCH 2/5] Not all vendor diffs support GNUisms (resend)","startedAt":"2010-03-11T16:30:39Z","lastAt":"2010-06-12T16:24:02Z","messageCount":9,"participants":["Gary V. Vaughan","René Scharfe","Scott Chacon"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"136604","messageId":"20100311163039.GB7877@thor.il.thewrittenword.com","threadId":"22988","inReplyTo":null,"subject":"[PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-03-11T16:30:39Z","receivedAt":"2010-03-11T16:30:39Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"Some of the flags used with the first diff found in PATH cause the\nvendor diff to choke.\n\nThis patch allows us to replace the problematic diff calls in our\nbuild script as follows:\n\n  if [ \"${SB_VAR_DIFFUTILS+set}\" = set ]; then\n    ${SB_PATH_SED} -i -e \"\\\ns|@DIFF@|${SB_VAR_DIFFUTILS}/bin/gnudiff|g;\" \\\n    $(find . -type f -exec ${SB_PATH_EGREP} -l '@DIFF@' {} \\;)\n  else\n    ${SB_PATH_SED} -i -e \"\\\ns|@DIFF@|diff|g;\" \\\n    $(find . -type f -exec ${SB_PATH_EGREP} -l '@DIFF@' {} \\;)\n  fi\n\nThis is fine for us, but upstream it would be better to search\nthe execution path for a diff that has all the required features at\nconfigure time, and to do the substitutions at that time.  This is\nwhat the latest version of quilt does if an example is useful.\n---\n Documentation/install-webdoc.sh |    2 +-\n contrib/examples/git-commit.sh  |    2 +-\n contrib/hooks/setgitperms.perl  |    2 +-\n git-cvsserver.perl              |    4 ++--\n git-merge-one-file.sh           |    4 +++-\n git-svn.perl                    |    2 +-\n t/t0000-basic.sh                |    2 +-\n t/t1002-read-tree-m-u-2way.sh   |    6 +++---\n t/t3200-branch.sh               |    4 ++--\n t/t3210-pack-refs.sh            |    8 ++++----\n t/t3903-stash.sh                |    2 +-\n t/t4002-diff-basic.sh           |    2 +-\n t/t4124-apply-ws-rule.sh        |   10 +++++-----\n t/t4127-apply-same-fn.sh        |    6 +++---\n t/t5300-pack-object.sh          |    6 +++---\n t/t5510-fetch.sh                |    2 +-\n t/t5520-pull.sh                 |    2 +-\n t/t5700-clone-reference.sh      |    8 ++++----\n t/t6000lib.sh                   |    2 +-\n t/t6001-rev-list-graft.sh       |    2 +-\n t/t6022-merge-rename.sh         |    4 ++--\n t/t7002-grep.sh                 |   16 ++++++++--------\n t/t7005-editor.sh               |    6 +++---\n t/t9200-git-cvsexportcommit.sh  |   26 +++++++++++++-------------\n t/t9400-git-cvsserver-server.sh |   24 ++++++++++++------------\n t/test-lib.sh                   |    2 +-\n 26 files changed, 79 insertions(+), 77 deletions(-)\n\ndiff --git a/Documentation/install-webdoc.sh b/Documentation/install-webdoc.sh\nindex 2135a8e..329d052 100755\n--- a/Documentation/install-webdoc.sh\n+++ b/Documentation/install-webdoc.sh\n@@ -12,7 +12,7 @@ do\n \tthen\n \t\t: did not match\n \telif test -f \"$T/$h\" &&\n-\t   diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' \"$T/$h\" \"$h\"\n+\t   @DIFF@ -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' \"$T/$h\" \"$h\"\n \tthen\n \t\t:; # up to date\n \telse\ndiff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh\nindex 5c72f65..726e102 100755\n--- a/contrib/examples/git-commit.sh\n+++ b/contrib/examples/git-commit.sh\n@@ -576,7 +576,7 @@ then\n \t\t# Test whether this is just the unaltered template.\n \t\tif cnt=`sed -e '/^#/d' < \"$templatefile\" |\n \t\t\tgit stripspace |\n-\t\t\tdiff \"$GIT_DIR\"/COMMIT_BAREMSG - |\n+\t\t\t@DIFF@ \"$GIT_DIR\"/COMMIT_BAREMSG - |\n \t\t\twc -l` &&\n \t\t   test 0 -lt $cnt\n \t\tthen\ndiff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl\nindex a577ad0..c45ab0d 100644\n--- a/contrib/hooks/setgitperms.perl\n+++ b/contrib/hooks/setgitperms.perl\n@@ -180,7 +180,7 @@ elsif ($read_mode) {\n \t    rename \"$gitmeta.tmp\", $gitmeta;\n \t}\n \telse {\n-\t    my $diff = `diff -U 0 $gitmeta $gitmeta.tmp`;\n+\t    my $diff = `@DIFF@ -U 0 $gitmeta $gitmeta.tmp`;\n \t    if ($diff ne '') {\n \t\trename \"$gitmeta.tmp\", $gitmeta;\n \t    }\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 13751db..3b78497 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -1716,9 +1716,9 @@ sub req_diff\n \n         if ( exists $state->{opt}{u} )\n         {\n-            system(\"diff -u -L '$filename revision 1.$meta1->{revision}' -L '$filename \" . ( defined($meta2->{revision}) ? \"revision 1.$meta2->{revision}\" : \"working copy\" ) . \"' $file1 $file2 > $filediff\");\n+            system(\"@DIFF@ -u -L '$filename revision 1.$meta1->{revision}' -L '$filename \" . ( defined($meta2->{revision}) ? \"revision 1.$meta2->{revision}\" : \"working copy\" ) . \"' $file1 $file2 > $filediff\");\n         } else {\n-            system(\"diff $file1 $file2 > $filediff\");\n+            system(\"@DIFF@ $file1 $file2 > $filediff\");\n         }\n \n         while ( <$fh> )\ndiff --git a/git-merge-one-file.sh b/git-merge-one-file.sh\nindex d067894..826b979 100755\n--- a/git-merge-one-file.sh\n+++ b/git-merge-one-file.sh\n@@ -28,6 +28,8 @@ then\n \texit 1\n fi\n \n+DIFF=\"@DIFF@\"\n+\n case \"${1:-.}${2:-.}${3:-.}\" in\n #\n # Deleted in both or deleted in one and unchanged in the other\n@@ -107,7 +109,7 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n \t\t# remove lines that are unique to ours.\n \t\torig=`git-unpack-file $2`\n \t\tsz0=`wc -c <\"$orig\"`\n-\t\tdiff -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add\n+\t\t$DIFF -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add\n \t\tsz1=`wc -c <\"$orig\"`\n \n \t\t# If we do not have enough common material, it is not\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 1a26843..037bc15 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1592,7 +1592,7 @@ sub find_file_type_and_diff_status {\n \treturn ('dir', '') if $path eq '';\n \n \tmy $diff_output =\n-\t    command_oneline(qw(diff --cached --name-status --), $path) || \"\";\n+\t    command_oneline(qw(@DIFF@ --cached --name-status --), $path) || \"\";\n \tmy $diff_status = (split(' ', $diff_output))[0] || \"\";\n \n \tmy $ls_tree = command_oneline(qw(ls-tree HEAD), $path) || \"\";\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex f4ca4fc..5444527 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -280,7 +280,7 @@ $expectfilter >expected <<\\EOF\n EOF\n test_expect_success \\\n     'validate git diff-files output for a know cache/work tree state.' \\\n-    'git diff-files >current && diff >/dev/null -b current expected'\n+    'git diff-files >current && @DIFF@ >/dev/null -b current expected'\n \n test_expect_success \\\n     'git update-index --refresh should succeed.' \\\ndiff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh\nindex 0241329..0330f13 100755\n--- a/t/t1002-read-tree-m-u-2way.sh\n+++ b/t/t1002-read-tree-m-u-2way.sh\n@@ -215,7 +215,7 @@ test_expect_success \\\n      if cmp M.sum actual14a.sum; then false; else :; fi &&\n      check_cache_at nitfol clean &&\n      echo nitfol nitfol >nitfol1 &&\n-     diff nitfol nitfol1 &&\n+     @DIFF@ nitfol nitfol1 &&\n      rm -f nitfol1'\n \n test_expect_success \\\n@@ -236,7 +236,7 @@ test_expect_success \\\n      sum bozbar frotz nitfol >actual15a.sum &&\n      if cmp M.sum actual15a.sum; then false; else :; fi &&\n      echo nitfol nitfol nitfol >nitfol1 &&\n-     diff nitfol nitfol1 &&\n+     @DIFF@ nitfol nitfol1 &&\n      rm -f nitfol1'\n \n test_expect_success \\\n@@ -286,7 +286,7 @@ test_expect_success \\\n      sum bozbar frotz nitfol >actual19a.sum &&\n      if cmp M.sum actual19a.sum; then false; else :; fi &&\n      echo gnusto gnusto >bozbar1 &&\n-     diff bozbar bozbar1 &&\n+     @DIFF@ bozbar bozbar1 &&\n      rm -f bozbar1'\n \n test_expect_success \\\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex e0b7605..9abfb42 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -43,7 +43,7 @@ test_expect_success \\\n      git branch -l d/e/f &&\n \t test -f .git/refs/heads/d/e/f &&\n \t test -f .git/logs/refs/heads/d/e/f &&\n-\t diff expect .git/logs/refs/heads/d/e/f'\n+\t @DIFF@ expect .git/logs/refs/heads/d/e/f'\n \n test_expect_success \\\n     'git branch -d d/e/f should delete a branch and a log' \\\n@@ -222,7 +222,7 @@ test_expect_success \\\n      git checkout -b g/h/i -l master &&\n \t test -f .git/refs/heads/g/h/i &&\n \t test -f .git/logs/refs/heads/g/h/i &&\n-\t diff expect .git/logs/refs/heads/g/h/i'\n+\t @DIFF@ expect .git/logs/refs/heads/g/h/i'\n \n test_expect_success 'avoid ambiguous track' '\n \tgit config branch.autosetupmerge true &&\ndiff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh\nindex 413019a..2a559d3 100755\n--- a/t/t3210-pack-refs.sh\n+++ b/t/t3210-pack-refs.sh\n@@ -28,7 +28,7 @@ test_expect_success \\\n      SHA1=`cat .git/refs/heads/a` &&\n      echo \"$SHA1 refs/heads/a\" >expect &&\n      git show-ref a >result &&\n-     diff expect result'\n+     @DIFF@ expect result'\n \n test_expect_success \\\n     'see if a branch still exists when packed' \\\n@@ -37,7 +37,7 @@ test_expect_success \\\n      rm -f .git/refs/heads/b &&\n      echo \"$SHA1 refs/heads/b\" >expect &&\n      git show-ref b >result &&\n-     diff expect result'\n+     @DIFF@ expect result'\n \n test_expect_success 'git branch c/d should barf if branch c exists' '\n      git branch c &&\n@@ -52,7 +52,7 @@ test_expect_success \\\n      git pack-refs --all --prune &&\n      echo \"$SHA1 refs/heads/e\" >expect &&\n      git show-ref e >result &&\n-     diff expect result'\n+     @DIFF@ expect result'\n \n test_expect_success 'see if git pack-refs --prune remove ref files' '\n      git branch f &&\n@@ -109,7 +109,7 @@ test_expect_success 'pack, prune and repack' '\n \tgit show-ref >all-of-them &&\n \tgit pack-refs &&\n \tgit show-ref >again &&\n-\tdiff all-of-them again\n+\t@DIFF@ all-of-them again\n '\n \n test_done\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 476e5ec..2c38807 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -81,7 +81,7 @@ test_expect_success 'drop top stash' '\n \tgit stash &&\n \tgit stash drop &&\n \tgit stash list > stashlist2 &&\n-\tdiff stashlist1 stashlist2 &&\n+\t@DIFF@ stashlist1 stashlist2 &&\n \tgit stash apply &&\n \ttest 3 = $(cat file) &&\n \ttest 1 = $(git show :file) &&\ndiff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh\nindex 18695ce..5c9f07b 100755\n--- a/t/t4002-diff-basic.sh\n+++ b/t/t4002-diff-basic.sh\n@@ -135,7 +135,7 @@ cmp_diff_files_output () {\n     # filesystem.\n     sed <\"$2\" >.test-tmp \\\n \t-e '/^:000000 /d;s/'$x40'\\( [MCRNDU][0-9]*\\)\t/'$z40'\\1\t/' &&\n-    diff \"$1\" .test-tmp\n+    @DIFF@ \"$1\" .test-tmp\n }\n \n test_expect_success \\\ndiff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh\nindex ca26397..844c6fd 100755\n--- a/t/t4124-apply-ws-rule.sh\n+++ b/t/t4124-apply-ws-rule.sh\n@@ -44,7 +44,7 @@ test_fix () {\n \tapply_patch --whitespace=fix || return 1\n \n \t# find touched lines\n-\tdiff file target | sed -n -e \"s/^> //p\" >fixed\n+\t@DIFF@ file target | sed -n -e \"s/^> //p\" >fixed\n \n \t# the changed lines are all expeced to change\n \tfixed_cnt=$(wc -l <fixed)\n@@ -85,14 +85,14 @@ test_expect_success setup '\n test_expect_success 'whitespace=nowarn, default rule' '\n \n \tapply_patch --whitespace=nowarn &&\n-\tdiff file target\n+\t@DIFF@ file target\n \n '\n \n test_expect_success 'whitespace=warn, default rule' '\n \n \tapply_patch --whitespace=warn &&\n-\tdiff file target\n+\t@DIFF@ file target\n \n '\n \n@@ -108,7 +108,7 @@ test_expect_success 'whitespace=error-all, no rule' '\n \n \tgit config core.whitespace -trailing,-space-before,-indent &&\n \tapply_patch --whitespace=error-all &&\n-\tdiff file target\n+\t@DIFF@ file target\n \n '\n \n@@ -117,7 +117,7 @@ test_expect_success 'whitespace=error-all, no rule (attribute)' '\n \tgit config --unset core.whitespace &&\n \techo \"target -whitespace\" >.gitattributes &&\n \tapply_patch --whitespace=error-all &&\n-\tdiff file target\n+\t@DIFF@ file target\n \n '\n \ndiff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh\nindex 3a8202e..a3b8818 100755\n--- a/t/t4127-apply-same-fn.sh\n+++ b/t/t4127-apply-same-fn.sh\n@@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '\n \tcp same_fn same_fn2 &&\n \tgit reset --hard &&\n \tgit apply patch0 &&\n-\tdiff same_fn same_fn2\n+\t@DIFF@ same_fn same_fn2\n '\n \n test_expect_success 'apply same filename with overlapping changes' '\n@@ -40,7 +40,7 @@ test_expect_success 'apply same filename with overlapping changes' '\n \tcp same_fn same_fn2 &&\n \tgit reset --hard &&\n \tgit apply patch0 &&\n-\tdiff same_fn same_fn2\n+\t@DIFF@ same_fn same_fn2\n '\n \n test_expect_success 'apply same new filename after rename' '\n@@ -54,7 +54,7 @@ test_expect_success 'apply same new filename after rename' '\n \tcp new_fn new_fn2 &&\n \tgit reset --hard &&\n \tgit apply --index patch1 &&\n-\tdiff new_fn new_fn2\n+\t@DIFF@ new_fn new_fn2\n '\n \n test_expect_success 'apply same old filename after rename -- should fail.' '\ndiff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\nindex 7649b81..984acbb 100755\n--- a/t/t5300-pack-object.sh\n+++ b/t/t5300-pack-object.sh\n@@ -147,7 +147,7 @@ test_expect_success \\\n \t    git cat-file $t $object || return 1\n \t done <obj-list\n     } >current &&\n-    diff expect current'\n+    @DIFF@ expect current'\n \n test_expect_success \\\n     'use packed deltified (REF_DELTA) objects' \\\n@@ -162,7 +162,7 @@ test_expect_success \\\n \t    git cat-file $t $object || return 1\n \t done <obj-list\n     } >current &&\n-    diff expect current'\n+    @DIFF@ expect current'\n \n test_expect_success \\\n     'use packed deltified (OFS_DELTA) objects' \\\n@@ -177,7 +177,7 @@ test_expect_success \\\n \t    git cat-file $t $object || return 1\n \t done <obj-list\n     } >current &&\n-    diff expect current'\n+    @DIFF@ expect current'\n \n unset GIT_OBJECT_DIRECTORY\n \ndiff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\nindex 721821e..841de41 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -71,7 +71,7 @@ test_expect_success \"fetch test for-merge\" '\n \t\techo \"$one_in_two\t\"\n \t} >expected &&\n \tcut -f -2 .git/FETCH_HEAD >actual &&\n-\tdiff expected actual'\n+\t@DIFF@ expected actual'\n \n test_expect_success 'fetch tags when there is no tags' '\n \ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex dd2ee84..2a042c3 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -26,7 +26,7 @@ cd \"$D\"\n test_expect_success 'checking the results' '\n \ttest -f file &&\n \ttest -f cloned/file &&\n-\tdiff file cloned/file\n+\t@DIFF@ file cloned/file\n '\n \n test_expect_success 'pulling into void using master:master' '\ndiff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh\nindex 1c10916..e396c66 100755\n--- a/t/t5700-clone-reference.sh\n+++ b/t/t5700-clone-reference.sh\n@@ -48,7 +48,7 @@ test_expect_success 'that reference gets used' \\\n 'cd C &&\n echo \"0 objects, 0 kilobytes\" > expected &&\n git count-objects > current &&\n-diff expected current'\n+@DIFF@ expected current'\n \n cd \"$base_dir\"\n \n@@ -75,7 +75,7 @@ cd \"$base_dir\"\n test_expect_success 'that reference gets used' \\\n 'cd D && echo \"0 objects, 0 kilobytes\" > expected &&\n git count-objects > current &&\n-diff expected current'\n+@DIFF@ expected current'\n \n cd \"$base_dir\"\n \n@@ -100,7 +100,7 @@ test_expect_success 'that alternate to origin gets used' \\\n 'cd C &&\n echo \"2 objects\" > expected &&\n git count-objects | cut -d, -f1 > current &&\n-diff expected current'\n+@DIFF@ expected current'\n \n cd \"$base_dir\"\n \n@@ -116,7 +116,7 @@ test_expect_success 'check objects expected to exist locally' \\\n 'cd D &&\n echo \"5 objects\" > expected &&\n git count-objects | cut -d, -f1 > current &&\n-diff expected current'\n+@DIFF@ expected current'\n \n cd \"$base_dir\"\n \ndiff --git a/t/t6000lib.sh b/t/t6000lib.sh\nindex 985d517..9a6e3c1 100644\n--- a/t/t6000lib.sh\n+++ b/t/t6000lib.sh\n@@ -91,7 +91,7 @@ check_output()\n \tshift 1\n \tif eval \"$*\" | entag > $_name.actual\n \tthen\n-\t\tdiff $_name.expected $_name.actual\n+\t\t@DIFF@ $_name.expected $_name.actual\n \telse\n \t\treturn 1;\n \tfi\ndiff --git a/t/t6001-rev-list-graft.sh b/t/t6001-rev-list-graft.sh\nindex b2131cd..b3891cd 100755\n--- a/t/t6001-rev-list-graft.sh\n+++ b/t/t6001-rev-list-graft.sh\n@@ -84,7 +84,7 @@ check () {\n \t\tgit rev-list --parents --pretty=raw $arg |\n \t\tsed -n -e 's/^commit //p' >test.actual\n \tfi\n-\tdiff test.expect test.actual\n+\t@DIFF@ test.expect test.actual\n }\n \n for type in basic parents parents-raw\ndiff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh\nindex e3f7ae8..4015f1b 100755\n--- a/t/t6022-merge-rename.sh\n+++ b/t/t6022-merge-rename.sh\n@@ -280,7 +280,7 @@ test_expect_success 'updated working tree file should prevent the merge' '\n \t\techo \"BAD: should have complained\"\n \t\treturn 1\n \t}\n-\tdiff M M.saved || {\n+\t@DIFF@ M M.saved || {\n \t\techo \"BAD: should have left M intact\"\n \t\treturn 1\n \t}\n@@ -301,7 +301,7 @@ test_expect_success 'updated working tree file should prevent the merge' '\n \t\techo \"BAD: should have complained\"\n \t\treturn 1\n \t}\n-\tdiff M M.saved || {\n+\t@DIFF@ M M.saved || {\n \t\techo \"BAD: should have left M intact\"\n \t\treturn 1\n \t}\ndiff --git a/t/t7002-grep.sh b/t/t7002-grep.sh\nindex e249c3e..bab7b59 100755\n--- a/t/t7002-grep.sh\n+++ b/t/t7002-grep.sh\n@@ -60,7 +60,7 @@ do\n \t\t\techo ${HC}file:5:foo_mmap bar mmap baz\n \t\t} >expected &&\n \t\tgit grep -n -w -e mmap $H >actual &&\n-\t\tdiff expected actual\n+\t\t@DIFF@ expected actual\n \t'\n \n \ttest_expect_success \"grep -w $L (w)\" '\n@@ -74,7 +74,7 @@ do\n \t\t\techo ${HC}x:1:x x xx x\n \t\t} >expected &&\n \t\tgit grep -n -w -e \"x xx* x\" $H >actual &&\n-\t\tdiff expected actual\n+\t\t@DIFF@ expected actual\n \t'\n \n \ttest_expect_success \"grep -w $L (y-1)\" '\n@@ -82,7 +82,7 @@ do\n \t\t\techo ${HC}y:1:y yy\n \t\t} >expected &&\n \t\tgit grep -n -w -e \"^y\" $H >actual &&\n-\t\tdiff expected actual\n+\t\t@DIFF@ expected actual\n \t'\n \n \ttest_expect_success \"grep -w $L (y-2)\" '\n@@ -93,7 +93,7 @@ do\n \t\t\tcat actual\n \t\t\tfalse\n \t\telse\n-\t\t\tdiff expected actual\n+\t\t\t@DIFF@ expected actual\n \t\tfi\n \t'\n \n@@ -105,14 +105,14 @@ do\n \t\t\tcat actual\n \t\t\tfalse\n \t\telse\n-\t\t\tdiff expected actual\n+\t\t\t@DIFF@ expected actual\n \t\tfi\n \t'\n \n \ttest_expect_success \"grep $L (t-1)\" '\n \t\techo \"${HC}t/t:1:test\" >expected &&\n \t\tgit grep -n -e test $H >actual &&\n-\t\tdiff expected actual\n+\t\t@DIFF@ expected actual\n \t'\n \n \ttest_expect_success \"grep $L (t-2)\" '\n@@ -121,7 +121,7 @@ do\n \t\t\tcd t &&\n \t\t\tgit grep -n -e test $H\n \t\t) >actual &&\n-\t\tdiff expected actual\n+\t\t@DIFF@ expected actual\n \t'\n \n \ttest_expect_success \"grep $L (t-3)\" '\n@@ -130,7 +130,7 @@ do\n \t\t\tcd t &&\n \t\t\tgit grep --full-name -n -e test $H\n \t\t) >actual &&\n-\t\tdiff expected actual\n+\t\t@DIFF@ expected actual\n \t'\n \n \ttest_expect_success \"grep -c $L (no /dev/null)\" '\ndiff --git a/t/t7005-editor.sh b/t/t7005-editor.sh\nindex 5257f4d..c5ea314 100755\n--- a/t/t7005-editor.sh\n+++ b/t/t7005-editor.sh\n@@ -38,7 +38,7 @@ test_expect_success setup '\n \ttest_commit \"$msg\" &&\n \techo \"$msg\" >expect &&\n \tgit show -s --format=%s > actual &&\n-\tdiff actual expect\n+\t@DIFF@ actual expect\n \n '\n \n@@ -85,7 +85,7 @@ do\n \t\tgit --exec-path=. commit --amend &&\n \t\tgit show -s --pretty=oneline |\n \t\tsed -e \"s/^[0-9a-f]* //\" >actual &&\n-\t\tdiff actual expect\n+\t\t@DIFF@ actual expect\n \t'\n done\n \n@@ -107,7 +107,7 @@ do\n \t\tgit --exec-path=. commit --amend &&\n \t\tgit show -s --pretty=oneline |\n \t\tsed -e \"s/^[0-9a-f]* //\" >actual &&\n-\t\tdiff actual expect\n+\t\t@DIFF@ actual expect\n \t'\n done\n \ndiff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh\nindex fc3795d..dfe25bc 100755\n--- a/t/t9200-git-cvsexportcommit.sh\n+++ b/t/t9200-git-cvsexportcommit.sh\n@@ -63,10 +63,10 @@ test_expect_success \\\n      check_entries B \"newfile2.txt/1.1/\" &&\n      check_entries C \"newfile3.png/1.1/-kb\" &&\n      check_entries D \"newfile4.png/1.1/-kb\" &&\n-     diff A/newfile1.txt ../A/newfile1.txt &&\n-     diff B/newfile2.txt ../B/newfile2.txt &&\n-     diff C/newfile3.png ../C/newfile3.png &&\n-     diff D/newfile4.png ../D/newfile4.png\n+     @DIFF@ A/newfile1.txt ../A/newfile1.txt &&\n+     @DIFF@ B/newfile2.txt ../B/newfile2.txt &&\n+     @DIFF@ C/newfile3.png ../C/newfile3.png &&\n+     @DIFF@ D/newfile4.png ../D/newfile4.png\n      )'\n \n test_expect_success \\\n@@ -89,10 +89,10 @@ test_expect_success \\\n      check_entries D \"newfile4.png/1.2/-kb\" &&\n      check_entries E \"newfile5.txt/1.1/\" &&\n      check_entries F \"newfile6.png/1.1/-kb\" &&\n-     diff A/newfile1.txt ../A/newfile1.txt &&\n-     diff D/newfile4.png ../D/newfile4.png &&\n-     diff E/newfile5.txt ../E/newfile5.txt &&\n-     diff F/newfile6.png ../F/newfile6.png\n+     @DIFF@ A/newfile1.txt ../A/newfile1.txt &&\n+     @DIFF@ D/newfile4.png ../D/newfile4.png &&\n+     @DIFF@ E/newfile5.txt ../E/newfile5.txt &&\n+     @DIFF@ F/newfile6.png ../F/newfile6.png\n      )'\n \n # Should fail (but only on the git cvsexportcommit stage)\n@@ -137,9 +137,9 @@ test_expect_success \\\n      check_entries D \"\" &&\n      check_entries E \"newfile5.txt/1.1/\" &&\n      check_entries F \"newfile6.png/1.1/-kb\" &&\n-     diff A/newfile1.txt ../A/newfile1.txt &&\n-     diff E/newfile5.txt ../E/newfile5.txt &&\n-     diff F/newfile6.png ../F/newfile6.png\n+     @DIFF@ A/newfile1.txt ../A/newfile1.txt &&\n+     @DIFF@ E/newfile5.txt ../E/newfile5.txt &&\n+     @DIFF@ F/newfile6.png ../F/newfile6.png\n      )'\n \n test_expect_success \\\n@@ -155,8 +155,8 @@ test_expect_success \\\n      check_entries D \"\" &&\n      check_entries E \"newfile5.txt/1.1/\" &&\n      check_entries F \"newfile6.png/1.1/-kb\" &&\n-     diff E/newfile5.txt ../E/newfile5.txt &&\n-     diff F/newfile6.png ../F/newfile6.png\n+     @DIFF@ E/newfile5.txt ../E/newfile5.txt &&\n+     @DIFF@ F/newfile6.png ../F/newfile6.png\n      )'\n \n test_expect_success \\\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex 4327eb8..19e5a90 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -226,7 +226,7 @@ test_expect_success 'gitcvs.ext.enabled = true' \\\n   'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n    GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n    GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n-   diff -q cvswork cvswork2'\n+   @DIFF@ -q cvswork cvswork2'\n \n rm -fr cvswork2\n test_expect_success 'gitcvs.ext.enabled = false' \\\n@@ -247,7 +247,7 @@ test_expect_success 'gitcvs.dbname' \\\n   'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n    GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&\n    GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n-   diff -q cvswork cvswork2 &&\n+   @DIFF@ -q cvswork cvswork2 &&\n    test -f \"$SERVERDIR/gitcvs.ext.master.sqlite\" &&\n    cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs.ext.master.sqlite\"'\n \n@@ -257,7 +257,7 @@ test_expect_success 'gitcvs.ext.dbname' \\\n    GIT_DIR=\"$SERVERDIR\" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&\n    GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&\n    GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n-   diff -q cvswork cvswork2 &&\n+   @DIFF@ -q cvswork cvswork2 &&\n    test -f \"$SERVERDIR/gitcvs1.ext.master.sqlite\" &&\n    test ! -f \"$SERVERDIR/gitcvs2.ext.master.sqlite\" &&\n    cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs1.ext.master.sqlite\"'\n@@ -282,7 +282,7 @@ test_expect_success 'cvs update (create new file)' \\\n    cd cvswork &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n    test \"$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))\" = \"testfile1/1.1/\" &&\n-   diff -q testfile1 ../testfile1'\n+   @DIFF@ -q testfile1 ../testfile1'\n \n cd \"$WORKDIR\"\n test_expect_success 'cvs update (update existing file)' \\\n@@ -293,7 +293,7 @@ test_expect_success 'cvs update (update existing file)' \\\n    cd cvswork &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n    test \"$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))\" = \"testfile1/1.2/\" &&\n-   diff -q testfile1 ../testfile1'\n+   @DIFF@ -q testfile1 ../testfile1'\n \n cd \"$WORKDIR\"\n #TODO: cvsserver doesn't support update w/o -d\n@@ -322,7 +322,7 @@ test_expect_success 'cvs update (subdirectories)' \\\n    (for dir in A A/B A/B/C A/D E; do\n       filename=\"file_in_$(echo $dir|sed -e \"s#/# #g\")\" &&\n       if test \"$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))\" = \"$filename/1.1/\" &&\n-           diff -q \"$dir/$filename\" \"../$dir/$filename\"; then\n+           @DIFF@ -q \"$dir/$filename\" \"../$dir/$filename\"; then\n         :\n       else\n         echo >failure\n@@ -349,7 +349,7 @@ test_expect_success 'cvs update (re-add deleted file)' \\\n    cd cvswork &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n    test \"$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))\" = \"testfile1/1.4/\" &&\n-   diff -q testfile1 ../testfile1'\n+   @DIFF@ -q testfile1 ../testfile1'\n \n cd \"$WORKDIR\"\n test_expect_success 'cvs update (merge)' \\\n@@ -366,7 +366,7 @@ test_expect_success 'cvs update (merge)' \\\n    cd cvswork &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n    test \"$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))\" = \"merge/1.1/\" &&\n-   diff -q merge ../merge &&\n+   @DIFF@ -q merge ../merge &&\n    ( echo Line 0; cat merge ) >merge.tmp &&\n    mv merge.tmp merge &&\n    cd \"$WORKDIR\" &&\n@@ -377,7 +377,7 @@ test_expect_success 'cvs update (merge)' \\\n    cd cvswork &&\n    sleep 1 && touch merge &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n-   diff -q merge ../expected'\n+   @DIFF@ -q merge ../expected'\n \n cd \"$WORKDIR\"\n \n@@ -402,13 +402,13 @@ test_expect_success 'cvs update (conflict merge)' \\\n    git push gitcvs.git >/dev/null &&\n    cd cvswork &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n-   diff -q merge ../expected.C'\n+   @DIFF@ -q merge ../expected.C'\n \n cd \"$WORKDIR\"\n test_expect_success 'cvs update (-C)' \\\n   'cd cvswork &&\n    GIT_CONFIG=\"$git_config\" cvs -Q update -C &&\n-   diff -q merge ../merge'\n+   @DIFF@ -q merge ../merge'\n \n cd \"$WORKDIR\"\n test_expect_success 'cvs update (merge no-op)' \\\n@@ -420,7 +420,7 @@ test_expect_success 'cvs update (merge no-op)' \\\n     cd cvswork &&\n     sleep 1 && touch merge &&\n     GIT_CONFIG=\"$git_config\" cvs -Q update &&\n-    diff -q merge ../merge'\n+    @DIFF@ -q merge ../merge'\n \n cd \"$WORKDIR\"\n test_expect_success 'cvs update (-p)' '\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex a0e396a..cd2c886 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -59,7 +59,7 @@ export GIT_MERGE_VERBOSITY\n export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME\n export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME\n export EDITOR\n-GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\n+GIT_TEST_CMP=${GIT_TEST_CMP:-@DIFF@}\n \n # Protect ourselves from common misconfiguration to export\n # CDPATH into the environment\n-- \n1.7.0.2\n\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"},{"id":"136614","messageId":"4B994324.9060400@lsrfire.ath.cx","threadId":"22988","inReplyTo":"20100311163039.GB7877@thor.il.thewrittenword.com","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-03-11T19:23:16Z","receivedAt":"2010-03-11T19:23:16Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 11.03.2010 17:30, schrieb Gary V. Vaughan:\n> Some of the flags used with the first diff found in PATH cause the\n> vendor diff to choke.\n> \n> This patch allows us to replace the problematic diff calls in our\n> build script as follows:\n> \n>   if [ \"${SB_VAR_DIFFUTILS+set}\" = set ]; then\n>     ${SB_PATH_SED} -i -e \"\\\n> s|@DIFF@|${SB_VAR_DIFFUTILS}/bin/gnudiff|g;\" \\\n>     $(find . -type f -exec ${SB_PATH_EGREP} -l '@DIFF@' {} \\;)\n>   else\n>     ${SB_PATH_SED} -i -e \"\\\n> s|@DIFF@|diff|g;\" \\\n>     $(find . -type f -exec ${SB_PATH_EGREP} -l '@DIFF@' {} \\;)\n>   fi\n> \n> This is fine for us, but upstream it would be better to search\n> the execution path for a diff that has all the required features at\n> configure time, and to do the substitutions at that time.  This is\n> what the latest version of quilt does if an example is useful.\n> ---\n>  Documentation/install-webdoc.sh |    2 +-\n>  contrib/examples/git-commit.sh  |    2 +-\n>  contrib/hooks/setgitperms.perl  |    2 +-\n>  git-cvsserver.perl              |    4 ++--\n>  git-merge-one-file.sh           |    4 +++-\n>  git-svn.perl                    |    2 +-\n>  t/t0000-basic.sh                |    2 +-\n>  t/t1002-read-tree-m-u-2way.sh   |    6 +++---\n>  t/t3200-branch.sh               |    4 ++--\n>  t/t3210-pack-refs.sh            |    8 ++++----\n>  t/t3903-stash.sh                |    2 +-\n>  t/t4002-diff-basic.sh           |    2 +-\n>  t/t4124-apply-ws-rule.sh        |   10 +++++-----\n>  t/t4127-apply-same-fn.sh        |    6 +++---\n>  t/t5300-pack-object.sh          |    6 +++---\n>  t/t5510-fetch.sh                |    2 +-\n>  t/t5520-pull.sh                 |    2 +-\n>  t/t5700-clone-reference.sh      |    8 ++++----\n>  t/t6000lib.sh                   |    2 +-\n>  t/t6001-rev-list-graft.sh       |    2 +-\n>  t/t6022-merge-rename.sh         |    4 ++--\n>  t/t7002-grep.sh                 |   16 ++++++++--------\n>  t/t7005-editor.sh               |    6 +++---\n>  t/t9200-git-cvsexportcommit.sh  |   26 +++++++++++++-------------\n>  t/t9400-git-cvsserver-server.sh |   24 ++++++++++++------------\n>  t/test-lib.sh                   |    2 +-\n>  26 files changed, 79 insertions(+), 77 deletions(-)\n\nThis patch doesn't seem to add this conversion to git's own build script\n(Makefile).  That means the patched scripts now call a command named\n\"@DIFF@\", which probably doesn't exist on most systems.\n\n> diff --git a/Documentation/install-webdoc.sh b/Documentation/install-webdoc.sh\n> index 2135a8e..329d052 100755\n> --- a/Documentation/install-webdoc.sh\n> +++ b/Documentation/install-webdoc.sh\n> @@ -12,7 +12,7 @@ do\n>  \tthen\n>  \t\t: did not match\n>  \telif test -f \"$T/$h\" &&\n> -\t   diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' \"$T/$h\" \"$h\"\n> +\t   @DIFF@ -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' \"$T/$h\" \"$h\"\n>  \tthen\n>  \t\t:; # up to date\n>  \telse\n\nFor build scripts I think it makes sense to do the same for diff as for\ntar, namely to define and export it in Makefile (run \"git grep -w TAR\"\nto see what I mean).\n\n> diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh\n> index 5c72f65..726e102 100755\n> --- a/contrib/examples/git-commit.sh\n> +++ b/contrib/examples/git-commit.sh\n> @@ -576,7 +576,7 @@ then\n>  \t\t# Test whether this is just the unaltered template.\n>  \t\tif cnt=`sed -e '/^#/d' < \"$templatefile\" |\n>  \t\t\tgit stripspace |\n> -\t\t\tdiff \"$GIT_DIR\"/COMMIT_BAREMSG - |\n> +\t\t\t@DIFF@ \"$GIT_DIR\"/COMMIT_BAREMSG - |\n>  \t\t\twc -l` &&\n>  \t\t   test 0 -lt $cnt\n>  \t\tthen\n> diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl\n> index a577ad0..c45ab0d 100644\n> --- a/contrib/hooks/setgitperms.perl\n> +++ b/contrib/hooks/setgitperms.perl\n> @@ -180,7 +180,7 @@ elsif ($read_mode) {\n>  \t    rename \"$gitmeta.tmp\", $gitmeta;\n>  \t}\n>  \telse {\n> -\t    my $diff = `diff -U 0 $gitmeta $gitmeta.tmp`;\n> +\t    my $diff = `@DIFF@ -U 0 $gitmeta $gitmeta.tmp`;\n>  \t    if ($diff ne '') {\n>  \t\trename \"$gitmeta.tmp\", $gitmeta;\n>  \t    }\n\nI'm not sure the files in contrib/ should be changed at all, as they are\nnot touched by Makefile.\n\n> diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n> index 13751db..3b78497 100755\n> --- a/git-cvsserver.perl\n> +++ b/git-cvsserver.perl\n> @@ -1716,9 +1716,9 @@ sub req_diff\n>  \n>          if ( exists $state->{opt}{u} )\n>          {\n> -            system(\"diff -u -L '$filename revision 1.$meta1->{revision}' -L '$filename \" . ( defined($meta2->{revision}) ? \"revision 1.$meta2->{revision}\" : \"working copy\" ) . \"' $file1 $file2 > $filediff\");\n> +            system(\"@DIFF@ -u -L '$filename revision 1.$meta1->{revision}' -L '$filename \" . ( defined($meta2->{revision}) ? \"revision 1.$meta2->{revision}\" : \"working copy\" ) . \"' $file1 $file2 > $filediff\");\n>          } else {\n> -            system(\"diff $file1 $file2 > $filediff\");\n> +            system(\"@DIFF@ $file1 $file2 > $filediff\");\n>          }\n>  \n>          while ( <$fh> )\n> diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh\n> index d067894..826b979 100755\n> --- a/git-merge-one-file.sh\n> +++ b/git-merge-one-file.sh\n> @@ -28,6 +28,8 @@ then\n>  \texit 1\n>  fi\n>  \n> +DIFF=\"@DIFF@\"\n> +\n>  case \"${1:-.}${2:-.}${3:-.}\" in\n>  #\n>  # Deleted in both or deleted in one and unchanged in the other\n> @@ -107,7 +109,7 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n>  \t\t# remove lines that are unique to ours.\n>  \t\torig=`git-unpack-file $2`\n>  \t\tsz0=`wc -c <\"$orig\"`\n> -\t\tdiff -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add\n> +\t\t$DIFF -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add\n>  \t\tsz1=`wc -c <\"$orig\"`\n>  \n>  \t\t# If we do not have enough common material, it is not\n\nWhy does this one use $DIFF unlike the others?\n\n> diff --git a/git-svn.perl b/git-svn.perl\n> index 1a26843..037bc15 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -1592,7 +1592,7 @@ sub find_file_type_and_diff_status {\n>  \treturn ('dir', '') if $path eq '';\n>  \n>  \tmy $diff_output =\n> -\t    command_oneline(qw(diff --cached --name-status --), $path) || \"\";\n> +\t    command_oneline(qw(@DIFF@ --cached --name-status --), $path) || \"\";\n>  \tmy $diff_status = (split(' ', $diff_output))[0] || \"\";\n>  \n>  \tmy $ls_tree = command_oneline(qw(ls-tree HEAD), $path) || \"\";\n\nThe changed line calls git-diff, not diff; you should keep it as it is.\n\n> diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\n> index f4ca4fc..5444527 100755\n> --- a/t/t0000-basic.sh\n> +++ b/t/t0000-basic.sh\n> @@ -280,7 +280,7 @@ $expectfilter >expected <<\\EOF\n>  EOF\n>  test_expect_success \\\n>      'validate git diff-files output for a know cache/work tree state.' \\\n> -    'git diff-files >current && diff >/dev/null -b current expected'\n> +    'git diff-files >current && @DIFF@ >/dev/null -b current expected'\n>  \n>  test_expect_success \\\n>      'git update-index --refresh should succeed.' \\\n\nThe earlier comment about exporting a variable named DIFF from Makefile\n(and passing it through test-lib.sh) like it's already done with TAR\napplies here.\n\n> diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh\n> index 0241329..0330f13 100755\n> --- a/t/t1002-read-tree-m-u-2way.sh\n> +++ b/t/t1002-read-tree-m-u-2way.sh\n> @@ -215,7 +215,7 @@ test_expect_success \\\n>       if cmp M.sum actual14a.sum; then false; else :; fi &&\n>       check_cache_at nitfol clean &&\n>       echo nitfol nitfol >nitfol1 &&\n> -     diff nitfol nitfol1 &&\n> +     @DIFF@ nitfol nitfol1 &&\n>       rm -f nitfol1'\n\nHere and for most of the rest of the test scripts using test_cmp\n(defined in test-lib.sh) instead of diff directly would be better.\n\ntest_cmp calls the command in $GIT_TEST_CMP.  For your OS, you could set\nit to \"cmp\" in Makefile instead of the default \"diff -u\".\n\n(That also means that test_cmp should only be used in places where the\noutput is discarded or displayed, not piped into another command which\nmight expect a certain diff format.)\n\nHowever, if there are no command line switches given to diff but only\ntwo files, do you need to change anything at all?  Every diff\nimplementation should be able to handle that, right?\n\n[Lots of test script changes snipped.]\n\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index a0e396a..cd2c886 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -59,7 +59,7 @@ export GIT_MERGE_VERBOSITY\n>  export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME\n>  export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME\n>  export EDITOR\n> -GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\n> +GIT_TEST_CMP=${GIT_TEST_CMP:-@DIFF@}\n>  \n>  # Protect ourselves from common misconfiguration to export\n>  # CDPATH into the environment\n\nDefine GIT_TEST_CMP in Makefile..\n\n(I'd split the introduction of DIFF/$DIFF, the diff -> test_cmp\nconversions and the change to set GIT_TEST_CMP=cmp for your platform\ninto three separate patches.)\n\nRené\n"},{"id":"140319","messageId":"20100315050943.GA22128@thor.il.thewrittenword.com","threadId":"22988","inReplyTo":"4B994324.9060400@lsrfire.ath.cx","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-04-25T08:35:10Z","receivedAt":"2010-04-25T08:35:10Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"Hi Rene,\n\nThanks for the review.  I'll respond to your comments in this thread,\nbut will repost my whole patch series separately later on.\n\nOn Thu, Mar 11, 2010 at 08:23:16PM +0100, Ren? Scharfe wrote:\n> Am 11.03.2010 17:30, schrieb Gary V. Vaughan:\n> > Some of the flags used with the first diff found in PATH cause the\n> > vendor diff to choke.\n> > \n> > This patch allows us to replace the problematic diff calls in our\n> > build script as follows:\n> > \n> >   if [ \"${SB_VAR_DIFFUTILS+set}\" = set ]; then\n> >     ${SB_PATH_SED} -i -e \"\\\n> > s|@DIFF@|${SB_VAR_DIFFUTILS}/bin/gnudiff|g;\" \\\n> >     $(find . -type f -exec ${SB_PATH_EGREP} -l '@DIFF@' {} \\;)\n> >   else\n> >     ${SB_PATH_SED} -i -e \"\\\n> > s|@DIFF@|diff|g;\" \\\n> >     $(find . -type f -exec ${SB_PATH_EGREP} -l '@DIFF@' {} \\;)\n> >   fi\n> > \n> > This is fine for us, but upstream it would be better to search\n> > the execution path for a diff that has all the required features at\n> > configure time, and to do the substitutions at that time.  This is\n> > what the latest version of quilt does if an example is useful.\n \n> This patch doesn't seem to add this conversion to git's own build script\n> (Makefile).  That means the patched scripts now call a command named\n> \"@DIFF@\", which probably doesn't exist on most systems.\n\nIndeed.  At TWW the substitution is done by our build recipe as quoted\nabove (admittedly, not too useful for everyone else).\n\n> > diff --git a/Documentation/install-webdoc.sh b/Documentation/install-webdoc.sh\n> > index 2135a8e..329d052 100755\n> > --- a/Documentation/install-webdoc.sh\n> > +++ b/Documentation/install-webdoc.sh\n> > @@ -12,7 +12,7 @@ do\n> >  \tthen\n> >  \t\t: did not match\n> >  \telif test -f \"$T/$h\" &&\n> > -\t   diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' \"$T/$h\" \"$h\"\n> > +\t   @DIFF@ -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' \"$T/$h\" \"$h\"\n> >  \tthen\n> >  \t\t:; # up to date\n> >  \telse\n> \n> For build scripts I think it makes sense to do the same for diff as for\n> tar, namely to define and export it in Makefile (run \"git grep -w TAR\"\n> to see what I mean).\n\nAgreed, and thanks for the tip, I hadn't noticed the precedent.\n\n> > diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl\n> > index a577ad0..c45ab0d 100644\n> > --- a/contrib/hooks/setgitperms.perl\n> > +++ b/contrib/hooks/setgitperms.perl\n> > @@ -180,7 +180,7 @@ elsif ($read_mode) {\n> >  \t    rename \"$gitmeta.tmp\", $gitmeta;\n> >  \t}\n> >  \telse {\n> > -\t    my $diff = `diff -U 0 $gitmeta $gitmeta.tmp`;\n> > +\t    my $diff = `@DIFF@ -U 0 $gitmeta $gitmeta.tmp`;\n> >  \t    if ($diff ne '') {\n> >  \t\trename \"$gitmeta.tmp\", $gitmeta;\n> >  \t    }\n> \n> I'm not sure the files in contrib/ should be changed at all, as they are\n> not touched by Makefile.\n\nFair enough.  However, diff -U is not at all portable unless you have\nGNU diff first in your path.\n\n> > --- a/git-merge-one-file.sh\n> > +++ b/git-merge-one-file.sh\n> > @@ -28,6 +28,8 @@ then\n> >  \texit 1\n> >  fi\n> >  \n> > +DIFF=\"@DIFF@\"\n> > +\n> >  case \"${1:-.}${2:-.}${3:-.}\" in\n> >  #\n> >  # Deleted in both or deleted in one and unchanged in the other\n> > @@ -107,7 +109,7 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n> >  \t\t# remove lines that are unique to ours.\n> >  \t\torig=`git-unpack-file $2`\n> >  \t\tsz0=`wc -c <\"$orig\"`\n> > -\t\tdiff -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add\n> > +\t\t$DIFF -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add\n> >  \t\tsz1=`wc -c <\"$orig\"`\n> >  \n> >  \t\t# If we do not have enough common material, it is not\n> \n> Why does this one use $DIFF unlike the others?\n> \n> > diff --git a/git-svn.perl b/git-svn.perl\n> > index 1a26843..037bc15 100755\n> > --- a/git-svn.perl\n> > +++ b/git-svn.perl\n> > @@ -1592,7 +1592,7 @@ sub find_file_type_and_diff_status {\n> >  \treturn ('dir', '') if $path eq '';\n> >  \n> >  \tmy $diff_output =\n> > -\t    command_oneline(qw(diff --cached --name-status --), $path) || \"\";\n> > +\t    command_oneline(qw(@DIFF@ --cached --name-status --), $path) || \"\";\n> >  \tmy $diff_status = (split(' ', $diff_output))[0] || \"\";\n> >  \n> >  \tmy $ls_tree = command_oneline(qw(ls-tree HEAD), $path) || \"\";\n> \n> The changed line calls git-diff, not diff; you should keep it as it is.\n\nOkay, thanks.\n\n> > diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh\n> > index 0241329..0330f13 100755\n> > --- a/t/t1002-read-tree-m-u-2way.sh\n> > +++ b/t/t1002-read-tree-m-u-2way.sh\n> > @@ -215,7 +215,7 @@ test_expect_success \\\n> >       if cmp M.sum actual14a.sum; then false; else :; fi &&\n> >       check_cache_at nitfol clean &&\n> >       echo nitfol nitfol >nitfol1 &&\n> > -     diff nitfol nitfol1 &&\n> > +     @DIFF@ nitfol nitfol1 &&\n> >       rm -f nitfol1'\n> \n> Here and for most of the rest of the test scripts using test_cmp\n> (defined in test-lib.sh) instead of diff directly would be better.\n> \n> test_cmp calls the command in $GIT_TEST_CMP.  For your OS, you could set\n> it to \"cmp\" in Makefile instead of the default \"diff -u\".\n> \n> (That also means that test_cmp should only be used in places where the\n> output is discarded or displayed, not piped into another command which\n> might expect a certain diff format.)\n\nAgreed.\n\n> However, if there are no command line switches given to diff but only\n> two files, do you need to change anything at all?  Every diff\n> implementation should be able to handle that, right?\n> \n> [Lots of test script changes snipped.]\n\nThere are a ton of these, so I probably did the substitution with a\nsed script, and then tested to make sure the testsuite didn't regress,\nrather than manually checking and substituting on a case by case\nbasis like I did in the other parts of the patch.\n\n> > diff --git a/t/test-lib.sh b/t/test-lib.sh\n> > index a0e396a..cd2c886 100644\n> > --- a/t/test-lib.sh\n> > +++ b/t/test-lib.sh\n> > @@ -59,7 +59,7 @@ export GIT_MERGE_VERBOSITY\n> >  export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME\n> >  export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME\n> >  export EDITOR\n> > -GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\n> > +GIT_TEST_CMP=${GIT_TEST_CMP:-@DIFF@}\n> >  \n> >  # Protect ourselves from common misconfiguration to export\n> >  # CDPATH into the environment\n> \n> Define GIT_TEST_CMP in Makefile..\n> \n> (I'd split the introduction of DIFF/$DIFF, the diff -> test_cmp\n> conversions and the change to set GIT_TEST_CMP=cmp for your platform\n> into three separate patches.)\n\nWill do. And then I'll resubmit the whole series.\n\nCheers,\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"},{"id":"140338","messageId":"4BD45874.9010700@lsrfire.ath.cx","threadId":"22988","inReplyTo":"20100315050943.GA22128@thor.il.thewrittenword.com","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-04-25T14:57:56Z","receivedAt":"2010-04-25T14:57:56Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 25.04.2010 10:35, schrieb Gary V. Vaughan:\n>> (I'd split the introduction of DIFF/$DIFF, the diff -> test_cmp\n>> conversions and the change to set GIT_TEST_CMP=cmp for your platform\n>> into three separate patches.)\n> \n> Will do. And then I'll resubmit the whole series.\n\nCommits c296134d and 4a2284b9 from Junio (in git 1.7.1) already do some\npart of the work, converting two test script to test_cmp.\n\nRené\n"},{"id":"140343","messageId":"20100425152130.GA27695@thor.il.thewrittenword.com","threadId":"22988","inReplyTo":"4BD45874.9010700@lsrfire.ath.cx","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-04-25T16:02:08Z","receivedAt":"2010-04-25T16:02:08Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"Apologies for the long delay before my resent repost... it took me\nuntil now to figure out why most of my messages to this lest were\nbeing rejected...\n\nOn Sun, Apr 25, 2010 at 04:57:56PM +0200, Ren? Scharfe wrote:\n> Am 25.04.2010 10:35, schrieb Gary V. Vaughan:\n> >> (I'd split the introduction of DIFF/$DIFF, the diff -> test_cmp\n> >> conversions and the change to set GIT_TEST_CMP=cmp for your platform\n> >> into three separate patches.)\n> > \n> > Will do. And then I'll resubmit the whole series.\n> \n> Commits c296134d and 4a2284b9 from Junio (in git 1.7.1) already do some\n> part of the work, converting two test script to test_cmp.\n\nExcellent.  ETA on a release from that branch so that I can finish any\nnecessary changes to my outstanding changesets?\n\n...or is there time for me to clone the repository and rebase those\nchanges in time for the 1.7.1 release?\n\nCheers,\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"},{"id":"140345","messageId":"4BD46BCA.3010308@lsrfire.ath.cx","threadId":"22988","inReplyTo":"20100425152130.GA27695@thor.il.thewrittenword.com","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-04-25T16:20:26Z","receivedAt":"2010-04-25T16:20:26Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 25.04.2010 18:03, schrieb Gary V. Vaughan:\n> Apologies for the long delay before my resent repost... it took me\n> until now to figure out why most of my messages to this lest were\n> being rejected...\n> \n> On Sun, Apr 25, 2010 at 04:57:56PM +0200, Ren? Scharfe wrote:\n>> Am 25.04.2010 10:35, schrieb Gary V. Vaughan:\n>>>> (I'd split the introduction of DIFF/$DIFF, the diff -> test_cmp\n>>>> conversions and the change to set GIT_TEST_CMP=cmp for your platform\n>>>> into three separate patches.)\n>>>\n>>> Will do. And then I'll resubmit the whole series.\n>>\n>> Commits c296134d and 4a2284b9 from Junio (in git 1.7.1) already do some\n>> part of the work, converting two test script to test_cmp.\n> \n> Excellent.  ETA on a release from that branch so that I can finish any\n> necessary changes to my outstanding changesets?\n> \n> ...or is there time for me to clone the repository and rebase those\n> changes in time for the 1.7.1 release?\n\nJunio released git 1.7.1 just yesterday.\n\nRené\n"},{"id":"140425","messageId":"20100426165010.GB28004@thor.il.thewrittenword.com","threadId":"22988","inReplyTo":"4BD46BCA.3010308@lsrfire.ath.cx","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-04-26T16:50:10Z","receivedAt":"2010-04-26T16:50:10Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"On Sun, Apr 25, 2010 at 06:20:26PM +0200, Ren? Scharfe wrote:\n> Am 25.04.2010 18:03, schrieb Gary V. Vaughan:\n> > ETA on a release from that branch so that I can finish any\n> > necessary changes to my outstanding changesets?\n> \n> Junio released git 1.7.1 just yesterday.\n\nhttp://git-scm.com/download still shows 1.7.0.6 as the latest release,\nor is 1.7.1 not considered stable?\n\nIn any case, I'll rebase my outstanding changesets and resubmit to the\nlist presently.\n\nCheers,\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"},{"id":"140445","messageId":"4BD5E2BC.3000106@lsrfire.ath.cx","threadId":"22988","inReplyTo":"20100426165010.GB28004@thor.il.thewrittenword.com","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-04-26T19:00:12Z","receivedAt":"2010-04-26T19:00:12Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 26.04.2010 18:50, schrieb Gary V. Vaughan:\n> On Sun, Apr 25, 2010 at 06:20:26PM +0200, Ren? Scharfe wrote:\n>> Am 25.04.2010 18:03, schrieb Gary V. Vaughan:\n>>> ETA on a release from that branch so that I can finish any\n>>> necessary changes to my outstanding changesets?\n>>\n>> Junio released git 1.7.1 just yesterday.\n> \n> http://git-scm.com/download still shows 1.7.0.6 as the latest release,\n> or is 1.7.1 not considered stable?\n\nI guess the release is just too fresh and Scott hasn't come around to\nupdating the website, yet.  1.7.1 is the current stable version.\n\nRené\n"},{"id":"143573","messageId":"AANLkTin6rVO9n0NmTjCrxjDR9NL7ITal913MpGaCGjEV@mail.gmail.com","threadId":"22988","inReplyTo":"4BD5E2BC.3000106@lsrfire.ath.cx","subject":"Re: [PATCH 2/5] Not all vendor diffs support GNUisms (resend)","fromName":"Scott Chacon","fromEmail":"schacon@gmail.com","sentAt":"2010-06-12T16:24:02Z","receivedAt":"2010-06-12T16:24:02Z","isPatch":true,"sender":{"key":"schacon@gmail.com","avatar":"https://gravatar.com/avatar/9b13a8a078e1dcf8588c4eea9554445d51ebed6c41b51f56f4d96738130b05c6?d=mp&s=160"},"body":"Hey,\n\nOn Mon, Apr 26, 2010 at 12:00 PM, René Scharfe\n<rene.scharfe@lsrfire.ath.cx> wrote:\n>>\n>> http://git-scm.com/download still shows 1.7.0.6 as the latest release,\n>> or is 1.7.1 not considered stable?\n>\n> I guess the release is just too fresh and Scott hasn't come around to\n> updating the website, yet.  1.7.1 is the current stable version.\n>\n\nI realize this is a rather old thread, but I didn't see it before.  I\ndon't actually maintain the version by hand - it is updated\nautomatically when Junio cuts the maint branch.  It took him a bit\nlonger to cut the maint branch after 1.7.1 was released, so the site\nwasn't updated until then.  FYI.\n\nScott\n"}]}