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

Re: git diff vs git diff-files

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 14, 2012, 09:55 UTC
Message-ID
<87393pztk4.fsf@thomas.inf.ethz.ch>
In-Reply-To
<CAF7PVPq0Wjck+53G4=Ofz0drMdx9NtpfgzMFR4j=32N-ez2xBg@mail.gmail.com>
Bernd Jendrissek <bernd.jendrissek@gmail.com> writes:
Show 19 quoted lines
> On Tue, Aug 14, 2012 at 10:18 AM, Thomas Rast <trast@student.ethz.ch> wrote:
>> Can you try the following:
>>
>>   git ls-files --debug gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
>>   cp .git/index .git/index.orig
>>   touch gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
>>   # note, it is important that you run diff first
>>   git diff gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
>>   git diff-files -p gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
>>   git ls-files --debug gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
>
> I'm can't tell what this was supposed to prove, but I think it's
> proven that I'm in the wrong mailing list, and that I should be taking
> this up with gnome-terminal. The Q1 part deletion line seems to be
> appearing (in the terminal) only after I've copy&pasted it into
> another terminal.
>
> Running the same commands in xterm (correctly) shows the Q1 part
> deletion line without having to copy & paste.

Fun stuff. This will be very interesting to debug. It's still possible, though perhaps not extremely likely, that git is writing garbage to the terminal and it just happens to work for xterm.

Whatever you do next, *please* post the *exact* file contents *and* output in a format that does not suffer any transport damage, neither to whitespace nor to binary data (such as terminal escapes). Piping through xxd comes to mind, perhaps by using

  GIT_PAGER=xxd git -p diff ....  >diff-hexdump

etc. to ensure that git takes the same code paths as when writing to less.

Cut&paste from a terminal will at best give you exactly what the terminal figures it is *currently displaying*, which is completely different from what programs write to it. At worst, it will also suffer whitespace damage. So pretty much everything you showed so far, except for the raw data of one (why only one?!) side of the diff, is useless.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Bernd JendrissekNext: Andreas Schwab
Message 6 of 9 in “git diff vs git diff-files”
  1. Bernd JendrissekAug 13, 2012
  2. Thomas RastAug 13, 2012
  3. Bernd JendrissekAug 13, 2012
  4. Thomas RastAug 14, 2012
  5. Bernd JendrissekAug 14, 2012
  6. Thomas RastAug 14, 2012
  7. Andreas SchwabAug 14, 2012
  8. Bernd JendrissekAug 14, 2012
  9. Matthieu MoyAug 13, 2012

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.