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

[RFH] plumber's puzzle

From
Junio C Hamano <junkio@cox.net>
Date
Apr 22, 2007, 19:53 UTC
Message-ID
<7v647ombi6.fsf@assigned-by-dhcp.cox.net>

I know people had trouble fetching from the official git.git repository this morning; sorry about the gotcha.

Now it has all been hopefully sorted out, here is one thing that I have been having trouble with lately, and can use some help.

Please try this, after getting the latest 'pu':
	$ git checkout origin/pu
	$ make all test-chmtime
	$ cd t
        $ sh ./t0021-filter.sh
        $ cd trash
        $ rm -f test.t
        $ ../../git-checkout-index -f -q -a
	$ ../../git-diff

This shows the single "diff --git" header line without anything, to show that the path is not stat-clean, but the contents are unchanged, which is what is expected.

A bit of background. test.t has a funny "rot13" filter set for both smudge and clean. So test.t file has "a b c d e...", but the actual blob records "n o p q r...". Since we teached git about the filter, git-checkout-index and git-diff do the right thing.

Now, go back to the toplevel, comment out "close(1)" in convert.c::filter_buffer() around line 236, and rebuild.

	$ cd ../..
        $ edit convert.c ;# comment out "close(1)"
        $ make
        $ cd t/trash
We get a quite _WRONG_ diff, like this:
        $ ../../git-diff
        diff --git a/test.t b/test.t
        --- a/test.t
        +++ b/test.t
        @@ -1,3 +1,4 @@
         n o p q r s t u v w x y z
         a b c d e f g h i j k l m
         $vqrag$
        +diff --git a/test.t b/test.t
and if you disable pager like this:
	$ PAGER= ../../git-diff

then you get the expected correct result. Also you get this if we disable the internal pager:

        $ ../../git-diff | cat
        diff --git a/test.t b/test.t
        --- a/test.t
        +++ b/test.t
        @@ -1,3 +1,4 @@
         n o p q r s t u v w x y z
         a b c d e f g h i j k l m
         $vqrag$
        +diff --git a/test.t b/test.t

I do not want to have a "fix" that I do not understand *why* it fixes things in the tree; I couldn't figure out why that close(1) in that codepath matters, although I was the one who added that line.

Insights?
Next: Florian Weimer
Message 1 of 8 in “[RFH] plumber's puzzle”
  1. Junio C HamanoApr 22, 2007
  2. Florian WeimerApr 22, 2007
  3. Linus TorvaldsApr 22, 2007
  4. Junio C HamanoApr 22, 2007
  5. Linus TorvaldsApr 22, 2007
  6. Junio C HamanoApr 22, 2007
  7. H. Peter AnvinApr 24, 2007
  8. Johannes SchindelinApr 24, 2007

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.