Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: small nit about zsh vcs_info module



Michel Lespinasse wrote:
> On Sun, Jul 18, 2010 at 10:44:43PM +0200, Frank Terbeck wrote:
[...]
>> How about this?
>> ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2>/dev/null
>> (( $? && $? <= 127 )) && gitstaged=1
>> 
>> or maybe even (( $? && $? != 128 ))
>
> (( $? && $? != 128 )) looks good & works fine for me.

I'll commit the following then. Thanks!

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 778d061..9765a6e 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -121,8 +121,8 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && \
     # Default: off - these are potentially expensive on big repositories
     ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code ||
         gitunstaged=1
-    ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD ||
-        gitstaged=1
+    ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null
+    (( $? && $? != 128 )) && gitstaged=1
 fi
 
 VCS_INFO_adjust



Messages sorted by: Reverse Date, Date, Thread, Author