zsh-workers
 help / color / mirror / code / Atom feed
* VCS_INFO_get_data_git produces output in git-annex directories
@ 2014-03-10 18:31 Nils Steinger
  2014-03-29  9:54 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Nils Steinger @ 2014-03-10 18:31 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

Hi,

I'm using oh-my-zsh and noticed that whenever I changed into a directory
containing a git-annex repository, "fatal: This operation must be run in
a work tree" appeared above my shell prompt.
After unsuccessfully grep-ing the oh-my-zsh sources for a command that
could cause this output, I 'set -x' and found that the error message was
caused by line 119 in
/usr/share/zsh/functions/VCS_Info/Backends/VCS_INFO_get_data_git.

I assume that's accidental (since it's useless and annoying) and have
attached a patch to fix this behavior.

Nils

[-- Attachment #2: VCS_INFO_get_data_git.patch --]
[-- Type: text/x-diff, Size: 812 bytes --]

--- /usr/share/zsh/functions/VCS_Info/Backends/VCS_INFO_get_data_git.old    2014-03-10 18:16:33.514629788 +0000
+++ /usr/share/zsh/functions/VCS_Info/Backends/VCS_INFO_get_data_git    2014-03-10 18:15:54.919823850 +0000
@@ -116,7 +116,7 @@
    [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-git-dir 2> /dev/null)" != 'true' ]] && \
    ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then
     # Default: off - these are potentially expensive on big repositories
-    ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code ||
+    ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code &> /dev/null ||
         gitunstaged=1
     ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null
     (( $? && $? != 128 )) && gitstaged=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: VCS_INFO_get_data_git produces output in git-annex directories
  2014-03-10 18:31 VCS_INFO_get_data_git produces output in git-annex directories Nils Steinger
@ 2014-03-29  9:54 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2014-03-29  9:54 UTC (permalink / raw)
  To: Nils Steinger; +Cc: zsh-workers

Nils Steinger wrote on Mon, Mar 10, 2014 at 19:31:56 +0100:
> Hi,
> 
> I'm using oh-my-zsh and noticed that whenever I changed into a directory
> containing a git-annex repository, "fatal: This operation must be run in
> a work tree" appeared above my shell prompt.

Would it be a better fix to change the if's condition to include 'git
rev-parse --is-inside-work-tree'?  I'm not sure whether that would break
some other use-case, but avoiding a non-working case seems preferable to
swallowing errors silently.

Cheers,

Daniel

P.S.  This patch conflicts with the one I just sent.  The conflict is
trivial (my patch just reindents the line your patch changes), but if
both patches are applied then whoever applies the second one will run
into it.

> After unsuccessfully grep-ing the oh-my-zsh sources for a command that
> could cause this output, I 'set -x' and found that the error message was
> caused by line 119 in
> /usr/share/zsh/functions/VCS_Info/Backends/VCS_INFO_get_data_git.
> 
> I assume that's accidental (since it's useless and annoying) and have
> attached a patch to fix this behavior.
> 
> Nils

> --- /usr/share/zsh/functions/VCS_Info/Backends/VCS_INFO_get_data_git.old    2014-03-10 18:16:33.514629788 +0000
> +++ /usr/share/zsh/functions/VCS_Info/Backends/VCS_INFO_get_data_git    2014-03-10 18:15:54.919823850 +0000
> @@ -116,7 +116,7 @@
>     [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-git-dir 2> /dev/null)" != 'true' ]] && \
>     ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then
>      # Default: off - these are potentially expensive on big repositories
> -    ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code ||
> +    ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code &> /dev/null ||
>          gitunstaged=1
>      ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null
>      (( $? && $? != 128 )) && gitstaged=1
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-29  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 18:31 VCS_INFO_get_data_git produces output in git-annex directories Nils Steinger
2014-03-29  9:54 ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).