{"thread":{"id":"30145","subject":"Output of 'diff' and 'diff --raw' not the same for modified submodule","startedAt":"2012-04-04T13:03:26Z","lastAt":"2012-04-04T18:02:46Z","messageCount":2,"participants":["Tim Henigan","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188488","messageId":"CAFouetg6rB7oyYGBuMMSgWzaKFwUWTdp4OUo3czvJro4iHa_kg@mail.gmail.com","threadId":"30145","inReplyTo":null,"subject":"Output of 'diff' and 'diff --raw' not the same for modified submodule","fromName":"Tim Henigan","fromEmail":"tim.henigan@gmail.com","sentAt":"2012-04-04T13:03:26Z","receivedAt":"2012-04-04T13:03:26Z","isPatch":false,"sender":{"key":"tim.henigan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42022?v=4"},"body":"If a submodule has new commits, then 'git diff' and 'git diff --raw'\nreport different outputs.\n\nFor example, the following output is given after adding a new commit\nto a submodule:\n\n$ git version\ngit version 1.7.10.rc4\n\n$ git diff\ndiff --git a/lib/tst-mergetool b/lib/tst-mergetool\nindex 9917ea0..5bc1908 160000\n--- a/lib/tst-mergetool\n+++ b/lib/tst-mergetool\n@@ -1 +1 @@\n-Subproject commit 9917ea0c228a0c24153da38df954f8a9d78cafac\n+Subproject commit 5bc19083c436aaa85762cdc309e62ed98f5cc276\n\n$ git diff --raw --no-abbrev\n:160000 160000 9917ea0c228a0c24153da38df954f8a9d78cafac\n0000000000000000000000000000000000000000 M  lib/tst-mergetool\n\n\n'git diff' shows the new SHA1 for the submodule, but 'git diff --raw'\nshows the NULL ID.  From the diff man page, I understand that the NULL\nID indicates \"creation, unmerged or 'look at the work tree'\", but I\nexpected the output of two commands to match.\n\nIs this the intended behavior?\n\nThanks,\nTim\n"},{"id":"188504","messageId":"7v1uo39xyx.fsf@alter.siamese.dyndns.org","threadId":"30145","inReplyTo":"CAFouetg6rB7oyYGBuMMSgWzaKFwUWTdp4OUo3czvJro4iHa_kg@mail.gmail.com","subject":"Re: Output of 'diff' and 'diff --raw' not the same for modified submodule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-04T18:02:46Z","receivedAt":"2012-04-04T18:02:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tim Henigan <tim.henigan@gmail.com> writes:\n\n> If a submodule has new commits, then 'git diff' and 'git diff --raw'\n> report different outputs.\n\nThere is nothing different except for the inherent difference between a\npatch and the row information.\n\n> $ git version\n> git version 1.7.10.rc4\n>\n> $ git diff\n> diff --git a/lib/tst-mergetool b/lib/tst-mergetool\n> index 9917ea0..5bc1908 160000\n> --- a/lib/tst-mergetool\n> +++ b/lib/tst-mergetool\n> @@ -1 +1 @@\n> -Subproject commit 9917ea0c228a0c24153da38df954f8a9d78cafac\n> +Subproject commit 5bc19083c436aaa85762cdc309e62ed98f5cc276\n>\n> $ git diff --raw --no-abbrev\n> :160000 160000 9917ea0c228a0c24153da38df954f8a9d78cafac\n> 0000000000000000000000000000000000000000 M  lib/tst-mergetool\n>\n>\n> 'git diff' shows the new SHA1 for the submodule, but 'git diff --raw'\n> shows the NULL ID.  From the diff man page, I understand that the NULL\n> ID indicates \"creation, unmerged or 'look at the work tree'\", but I\n> expected the output of two commands to match.\n\nYou are fooled by the textual patch output.\n\nConsider \"Subproject commit <blah>\" a textconv-ed version of what is on\nthat path.  Repeat the above but with a regular file at tst-mergetool in\nboth preimage and postimage.  You will see exactly the same output.  Lines\nthat begin with \"-\" show the information for the preimage, while those\nthat begin with \"+\" show the information for the postimage.\n\nThe --raw output always uses 0{40} to tell you that you need to look at\nthe working tree for the information you seek for the right hand side (for\n\"U\" entries, 0{40} merely means that we do not have any information to\nshow on the unmerged side in the first place), and also to mark that the\nside that has 0{40} on an \"M\" entry talks about the working tree.\n"}]}