git diff, external diff tool, and submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

When a submodule has new commits, I noticed the following:

$ git diff
diff --git a/submodule b/submodule
index 4c75be6..b272d40 160000
--- a/submodule
+++ b/submodule
@@ -1 +1 @@
-Subproject commit 4c75be6435cd515887d35c300ed8b487f8143d8e
+Subproject commit b272d4077fda29028c0bd02efba2837e12a8319c

As you can see, the diff shows the submodule has new commits.

However when using an external diff tool, it seems to me that git diff
fails to handle the submodule case:

$ GIT_EXTERNAL_DIFF=echo git diff
submodule /var/folders/1h/q9nt7m6d2fs61_v177kq1_h00000gn/T//cz1ati_submodule
4c75be6435cd515887d35c300ed8b487f8143d8e 160000 submodule
0000000000000000000000000000000000000000 160000

$LOCAL is set to a temp file that contains:
Subproject commit 4c75be6435cd515887d35c300ed8b487f8143d8e

And I expected $REMOTE to be set to another temp file that contains:
Subproject commit b272d4077fda29028c0bd02efba2837e12a8319c

Instead, $REMOTE is set to the actual submodule path and then visual
diff tools rightfully complains $REMOTE doesn't point to a valid file.

I think git diff should handle the submodule case and create 2
temporary files containing "Subproject commit sha1" for external diff
tools to compare.

What do you think?
Gregory

PS: git difftool has a special "directory mode" triggered with "-d"
that does what git diff does when GIT_EXTERNAL_DIFF is not set. It
creates temp files with "Subproject commit sha1" lines for diff tools
to compare.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]