summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2015-10-11 11:54:06 +0200
committerFrank Terbeck <ft@bewatermyfriend.org>2015-10-11 12:29:41 +0200
commit7a1678767f44f200295d88dfea94902718275266 (patch)
tree9e3895f45d72657e420ee024bacc83797137731e
parent83a175795a444e8169fcb592a110d4d15a09b907 (diff)
downloadzsh-7a1678767f44f200295d88dfea94902718275266.tar.gz
zsh-7a1678767f44f200295d88dfea94902718275266.zip
36830: vcs_info: Silence an error message with new git versions
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.
-rw-r--r--ChangeLog5
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git34
2 files changed, 27 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 6369cf6e9..c8cad2adb 100644
--- a/ChangeLog
+++ b/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
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 8664d510e..7fc213916 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -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