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

Output of 'diff' and 'diff --raw' not the same for modified submodule

From
Tim Henigan <tim.henigan@gmail.com>
Date
Apr 4, 2012, 13:03 UTC
Message-ID
<CAFouetg6rB7oyYGBuMMSgWzaKFwUWTdp4OUo3czvJro4iHa_kg@mail.gmail.com>

If a submodule has new commits, then 'git diff' and 'git diff --raw' report different outputs.

For example, the following output is given after adding a new commit to a submodule:

$ git version git version 1.7.10.rc4

$ git diff
diff --git a/lib/tst-mergetool b/lib/tst-mergetool
index 9917ea0..5bc1908 160000
--- a/lib/tst-mergetool
+++ b/lib/tst-mergetool
@@ -1 +1 @@
-Subproject commit 9917ea0c228a0c24153da38df954f8a9d78cafac
+Subproject commit 5bc19083c436aaa85762cdc309e62ed98f5cc276

$ git diff --raw --no-abbrev
:160000 160000 9917ea0c228a0c24153da38df954f8a9d78cafac
0000000000000000000000000000000000000000 M  lib/tst-mergetool


'git diff' shows the new SHA1 for the submodule, but 'git diff --raw'
shows the NULL ID.  From the diff man page, I understand that the NULL
ID indicates "creation, unmerged or 'look at the work tree'", but I
expected the output of two commands to match.

Is this the intended behavior?

Thanks,
Tim
Next: Junio C Hamano
Message 1 of 2 in “Output of 'diff' and 'diff --raw' not the same for modified submodule”
  1. Tim HeniganApr 4, 2012
  2. Junio C HamanoApr 4, 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.