git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [patch 06/16] diff-test_cmp.patch

From
GVGary V. Vaughan <git@mlists.thewrittenword.com>
Date
Apr 28, 2010, 09:00 UTC
Message-ID
<20100428090045.GD36271@thor.il.thewrittenword.com>
In-Reply-To
<20100427171531.GA15553@progeny.tock>
On Tue, Apr 27, 2010 at 12:15:52PM -0500, Jonathan Nieder wrote:
Show 13 quoted lines
> Hi,
> 
> Gary V. Vaughan wrote:
> 
> > Subject: diff-test_cmp.patch
> >
> > In tests, call test_cmp rather than raw diff where possible (i.e. if
> > the output does not go to a pipe), to allow the use of, say, 'cmp'
> > when the default 'diff -u' is not compatible with a vendor diff.
> > 
> > When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS.
> 
> Sign-off?  (See SubmittingPatches for what I am asking about here.)
Ah, okay.  I didn't read carefully enough. Sorry.

Can I add a Sign-off message to each patch subthread? Or do you need me to resubmit the entire series?

> And is it possible to change your mailing script to use more
> meaningful subject lines?

Sure. What is preferable? As short a sentence summarising the fixed issue as I can muster? (Like SuSE Linux, we use quilt to manage and submit our patch stacks... git seems to require hosting the entire history of each project which is too heavyweight for the 1000's of packages we build - if git provides the means to store just the head of an upstream release branch along with our patch stacks on local disk, I would love to be proven wrong here).

> This patch makes a good change, but I do not think your description
> captures it.  Most of the changes are from ???diff???, not from ???diff -u???.
> Is your bare ???diff??? really incapable of distinguishing between
> identical and differing files?

A good point, thanks. I think the scope has crept since I first started applying such a patch to earlier releases of git in our package tree.

Show 16 quoted lines
> But using test_cmp consistently would make debugging test scripts
> with -v much easier, since the output is more readable.
> 
> > --- a/t/t0000-basic.sh
> > +++ b/t/t0000-basic.sh
> > @@ -280,7 +280,7 @@ $expectfilter >expected <<\EOF
> >  EOF
> >  test_expect_success \
> >      'validate git diff-files output for a know cache/work tree state.' \
> > -    'git diff-files >current && diff >/dev/null -b current expected'
> > +    'git diff-files >current && test_cmp current expected >/dev/null'
> 
> The original ignores whitespace changes; this version does not.  It
> turns out that???s okay, but it???s worth mentioning in the commit
> message.  (I think we do guarantee that diff-files will not change the
> whitespace it produces without good reason.)

Okay, I'll rewrite the patch headers where they have bit-rotted. Maybe in combination with the missing Signed-off-by: headers and unsuitable Subject headers I need to amend and resubmit the whole patch series again?

Show 16 quoted lines
> The original suppressed its output, without any good reason to.  Could
> you remove the >/dev/null while at it, to make it easier to debug?
> 
> > --- a/t/t4124-apply-ws-rule.sh
> > +++ b/t/t4124-apply-ws-rule.sh
> > @@ -44,7 +44,7 @@ test_fix () {
> >  	apply_patch --whitespace=fix || return 1
> >  
> >  	# find touched lines
> > -	diff file target | sed -n -e "s/^> //p" >fixed
> > +	$DIFF file target | sed -n -e "s/^> //p" >fixed
> >  
> >  	# the changed lines are all expeced to change
> >  	fixed_cnt=$(wc -l <fixed)
> 
> Is this needed?  I don???t mind it, just curious.

Probably not, though I prefer the consistency rather than having to consider diff vs $DIFF at every occurence. libtool has had numerous silly bugs tickled by making the wrong choice between echo, $echo, $lt_echo and $ECHO in rarely exercised corners of the code.

> I hope some earlier patch takes care of setting DIFF in test-lib.sh.
> Tests need to be usable without running them through the makefile.
Unfortunately, that is not the case in 7.1.1.  This is it:
GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
The obvious fix would be to use:

: ${DIFF=@DIFF@} : ${GIT_TEST_CMP=@DIFF@ -u}

And substitute at configure time. Makefile only builds will require additional support though.

Show 20 quoted lines
> > --- a/t/Makefile
> > +++ b/t/Makefile
> > @@ -6,10 +6,14 @@
> >  -include ../config.mak
> >  
> >  #GIT_TEST_OPTS=--verbose --debug
> > +GIT_TEST_CMP ?= $(DIFF)
> >  SHELL_PATH ?= $(SHELL)
> >  TAR ?= $(TAR)
> >  RM ?= rm -f
> >  
> > +# Make sure test-lib.sh uses make's value of GIT_TEST_CMP
> > +export GIT_TEST_CMP
> > +
> >  # Shell quote;
> >  SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
> 
> If neither DIFF nor GIT_TEST_CMP is already set, this will export
> GIT_TEST_CMP as the empty string.  Will t/test-lib.sh treat that as
> asking for the default?  Yes --- phew.

That change was just added to my patch yesterday, to fix the massive testsuite failures I had previously experienced.

>   Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Much appreciated!
Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)
Previous: Jonathan NiederNext: Jonathan Nieder
Message 15 of 49 in “Portability Patches for git-1.7.1 (v4)”
  1. 00/16 Portability Patches for git-1.7.1 (v4)Gary V. Vaughan, Apr 27, 2010
  2. 01/16 user-cppflags.patchGary V. Vaughan, Apr 27, 2010
  3. 02/16 const-expr.patchGary V. Vaughan, Apr 27, 2010
  4. Erik Faye-LundApr 27, 2010
  5. Gary V. VaughanApr 27, 2010
  6. 03/16 pthread.patchGary V. Vaughan, Apr 27, 2010
  7. 04/16 Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to compile git.Gary V. Vaughan, Apr 27, 2010
  8. Tor ArntsenApr 27, 2010
  9. Gary V. VaughanApr 28, 2010
  10. Tor ArntsenApr 28, 2010
  11. Jeff KingApr 28, 2010
  12. 05/16 diff-export.patchGary V. Vaughan, Apr 27, 2010
  13. 06/16 diff-test_cmp.patchGary V. Vaughan, Apr 27, 2010
  14. Jonathan NiederApr 27, 2010
  15. Gary V. VaughanApr 28, 2010
  16. Jonathan NiederApr 28, 2010
  17. Gary V. VaughanApr 28, 2010
  18. Jonathan NiederApr 28, 2010
  19. 07/16 diff-defaults.patchGary V. Vaughan, Apr 27, 2010
  20. 08/16 host-SunOS56.patchGary V. Vaughan, Apr 27, 2010
  21. 09/16 host-IRIX.patchGary V. Vaughan, Apr 27, 2010
  22. 10/16 host-HPUX10.patchGary V. Vaughan, Apr 27, 2010
  23. 11/16 host-HPUX11.patchGary V. Vaughan, Apr 27, 2010
  24. 12/16 host-OSF1.patchGary V. Vaughan, Apr 27, 2010
  25. Tor ArntsenApr 27, 2010
  26. Gary V. VaughanApr 27, 2010
  27. Tor ArntsenApr 27, 2010
  28. Gary V. VaughanApr 28, 2010
  29. 13/16 no-hstrerror.patchGary V. Vaughan, Apr 27, 2010
  30. 14/16 no-inet_ntop.patchGary V. Vaughan, Apr 27, 2010
  31. 15/16 no-socklen_t.patchGary V. Vaughan, Apr 27, 2010
  32. 16/16 no-inline.patchGary V. Vaughan, Apr 27, 2010
  33. Michael J GruberApr 27, 2010
  34. Jeff KingApr 27, 2010
  35. Andreas SchwabApr 27, 2010
  36. Jeff KingApr 28, 2010
  37. Gary V. VaughanApr 28, 2010
  38. Jeff KingApr 28, 2010
  39. Gary V. VaughanApr 28, 2010
  40. Gary V. VaughanApr 28, 2010
  41. Ævar Arnfjörð BjarmasonApr 28, 2010
  42. Michael J GruberMay 1, 2010
  43. Junio C HamanoMay 1, 2010
  44. Gary V. VaughanMay 3, 2010
  45. Øyvind A. HolmMay 2, 2010
  46. Gary V. VaughanApr 28, 2010
  47. Gary V. VaughanApr 29, 2010
  48. Gary V. VaughanMay 3, 2010
  49. Gary V. VaughanMay 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.