about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Hahler <dhahler@gmail.com>2014-09-22 16:37:23 +0200
committerFrank Terbeck <ft@bewatermyfriend.org>2014-09-22 23:23:03 +0200
commit64e2b4426e72e0359cd4c621ab2e2f521050e620 (patch)
treed5d9fa2919aa8dae46393027ab4faeecc938b062
parent7c6e267da47cc8f65440517d755b3a9509740b63 (diff)
downloadzsh-64e2b4426e72e0359cd4c621ab2e2f521050e620.tar.gz
zsh-64e2b4426e72e0359cd4c621ab2e2f521050e620.tar.xz
zsh-64e2b4426e72e0359cd4c621ab2e2f521050e620.zip
33217: vcs_info: use `--ignore-submodules=dirty` with diff/diff-index
This will detect changes to submodules from the superproject's
perspective, e.g. after `git rm submodule`.

>From GIT-DIFF-INDEX(1)/GIT-DIFF(1):

    Using "dirty" ignores all changes to the work tree of submodules,
    only changes to the commits stored in the superproject are shown
    (this was the behavior until 1.7.0).
-rw-r--r--ChangeLog5
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f32094f21..faa3f8731 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-22  Daniel Hahler  <dhahler@gmail.com>
+
+	* 33217: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+	vcs_info: use `--ignore-submodules=dirty` with diff/diff-index
+
 2014-09-22  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 33208: Tanu Kaskinen: 
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index c243bf7ba..ee50be6ca 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -176,17 +176,17 @@ if (( querystaged || queryunstaged )) && \
    [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-work-tree 2> /dev/null)" == 'true' ]] ; then
     # Default: off - these are potentially expensive on big repositories
     if (( queryunstaged )) ; then
-        ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code ||
+        ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules=dirty --quiet --exit-code ||
             gitunstaged=1
     fi
     if (( querystaged )) ; then
         if ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then
-            ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null
+            ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules=dirty HEAD 2> /dev/null
             (( $? && $? != 128 )) && gitstaged=1
         else
             # empty repository (no commits yet)
             # 4b825dc642cb6eb9a060e54bf8d69288fbee4904 is the git empty tree.
-            ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules 4b825dc642cb6eb9a060e54bf8d69288fbee4904 2>/dev/null
+            ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules=dirty 4b825dc642cb6eb9a060e54bf8d69288fbee4904 2>/dev/null
             (( $? && $? != 128 )) && gitstaged=1
         fi
     fi