Skip to content

Commit

Permalink
36830: vcs_info: Silence an error message with new git versions
Browse files Browse the repository at this point in the history
Mikael informs me on IRC, that in new versions of git (he used 2.6.1)
where the "am" subcommand is now a builtin, a file that is used by the
git backend of vcs_info (namely .git/rebase-apply/msg-clean) is not
available anymore, leading to an annoying error message:

  VCS_INFO_get_data_git:232: no such file or directory: .git/rebase-apply/msg-clean

This patch checks for the availabiliy of the file before using it,
and adjusts the value of the dependant values accordingly.
  • Loading branch information
ft committed Oct 11, 2015
1 parent 83a1757 commit 7a16787
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2015-10-11 Frank Terbeck <ft@bewatermyfriend.org>

* 36830: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
vcs_info: Silence an error message with new git versions

2015-10-06 Peter Stephenson <p.stephenson@samsung.com>

* 36780: Src/params.c: ensure HOME parameter is unset if
Expand Down
34 changes: 22 additions & 12 deletions Functions/VCS_Info/Backends/VCS_INFO_get_data_git
Expand Up @@ -224,18 +224,28 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
patchdir="${gitdir}/rebase-apply"
local next="${patchdir}/next"
if [[ -f $next ]]; then
local cur=$(< $next)
local p subject
for p in $(seq $(($cur - 1))); do
git_patches_applied+=("$(printf "%04d" $p) ?")
done
subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
if [[ -f "${patchdir}/original-commit" ]]; then
git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
else
git_patches_applied+=("? $subject")
fi
git_patches_unapplied=($(seq $cur $(< "${patchdir}/last")))
local cur=$(< $next)
local p subject
for p in $(seq $(($cur - 1))); do
git_patches_applied+=("$(printf "%04d" $p) ?")
done
if [[ -f "${patchdir}/msg-clean" ]]; then
subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
fi
if [[ -f "${patchdir}/original-commit" ]]; then
if [[ -n $subject ]]; then
git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
else
git_patches_applied+=("$(< ${patchdir}/original-commit)")
fi
else
if [[ -n $subject ]]; then
git_patches_applied+=("? $subject")
else
git_patches_applied+=("?")
fi
fi
git_patches_unapplied=($(seq $cur $(< "${patchdir}/last")))
fi

VCS_INFO_git_handle_patches
Expand Down

5 comments on commit 7a16787

@ffxsam
Copy link

@ffxsam ffxsam commented on 7a16787 Apr 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually does not fix the issue for me, and I'm using zsh 5.2.

@danielshahaf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can reproduce that with latest zsh master, please report that to zsh-users[at]zsh.org. (The zsh project doesn't use github.)

@si74
Copy link

@si74 si74 commented on 7a16787 Apr 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ffxsam Did you ever fix this issue? Having the same problem and really need to rebase.

@mcornella
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the latest version of zsh 5.2. Perhaps your platform hasn't shipped a modified version of 5.2. For instance, I'm using Debian testing and my installed zsh package is version 5.2-5, meaning it's the 5th or 6th modified version of zsh 5.2. What system are you using?

@ft
Copy link
Contributor Author

@ft ft commented on 7a16787 May 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like Daniel explained, the zsh project does not use github. This repository is
a mere mirror. If you still see this issue happening, please report the issue to
zsh-users[at]zsh.org — there is no need to subscribe if you don't want to. Just
ask to be Cc:ed.

Also, please include a full minimal example of how to reproduce the issue on
your end. Just claiming "I am seeing this" does not help.

Please sign in to comment.