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

Re: git diff vs git diff-files

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Aug 13, 2012, 15:13 UTC
Message-ID
<vpq1uja25b1.fsf@bauges.imag.fr>
In-Reply-To
<CAF7PVPrex6sJMU+uvxQOSpB12qSTp2barTycow_-LZ8Ngbv7uQ@mail.gmail.com>
Bernd Jendrissek <bernd.jendrissek@gmail.com> writes:
> $ /usr/local/git/bin/git diff-files -p --color -- TwoStageAmp-output.net
> diff --git a/gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
> b/gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
> index a5ee1e7..a9f3620 100644
> $ /usr/local/git/bin/git diff TwoStageAmp-output.netdiff --git
> a/gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.net
> b/gnetlist/tests/common/outputs/osmond/TwoStageAmp-output.n
> index a5ee1e7..a9f3620 100644

What's surprising is that both diff show the same "index" line, so both commands actually diff the same content, and then show a different output.

You can try something like

git cat-file blob a5ee1e7 > /tmp/staged.txt diff -u /tmp/staged.txt TwoStageAmp-output.netdiff

to recover the content from the index (Thomas' version should also work and give the same result), and use another diff tool. This "diff -u" should give you an output similar to one of "git diff" and "git diff-files" (my understanding is that it should match diff-files, and "git diff" is the one being wrong here).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Bernd Jendrissek
Message 9 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.