summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2012-02-07 04:05:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-07 16:59:40 (GMT)
commit701825de23da2bff6c784d33ff27f75e802abd81 (patch)
tree86234064ddf17ab0c2910bf20cc6968b54cd3737 /builtin
parentf174a2583c9f42315b60205890fa67a79a1f1669 (diff)
downloadgit-701825de23da2bff6c784d33ff27f75e802abd81.zip
git-701825de23da2bff6c784d33ff27f75e802abd81.tar.gz
git-701825de23da2bff6c784d33ff27f75e802abd81.tar.bz2
add -e: do not show difference in a submodule that is merely dirty
When the HEAD of the submodule matches what is recorded in the index of the superproject, and it has local changes or untracked files, the patch offered by "git add -e" for editing shows a diff like this: diff --git a/submodule b/submodule <header> -deadbeef... +deadbeef...-dirty Because applying such a patch has no effect to the index, this is a useless noise. Generate the patch with IGNORE_DIRTY_SUBMODULES flag to prevent such a change from getting reported. This patch also loses the "-dirty" suffix from the output when the HEAD of the submodule is different from what is in the index of the superproject. As such dirtiness expressed by the suffix does not affect the result of the patch application at all, there is no information lost if we remove it. The user could still run "git status" before "git add -e" if s/he cares about the dirtiness. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/add.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index c59b0c9..68fd050 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -279,6 +279,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
argc = setup_revisions(argc, argv, &rev, NULL);
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
+ DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
out = open(file, O_CREAT | O_WRONLY, 0644);
if (out < 0)
die (_("Could not open '%s' for writing."), file);