summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2015-09-23 20:55:40 +0200
committerFrank Terbeck <ft@bewatermyfriend.org>2015-09-28 20:03:12 +0200
commit45bdc87a1f4058f9a8cd5eaceda704284d4a89a1 (patch)
tree975e9a6522dc29fa39bfe36f386ac7472f784021
parent4bed2cf256cf79f8e17093d54a67f75dfa54794a (diff)
downloadzsh-45bdc87a1f4058f9a8cd5eaceda704284d4a89a1.tar.gz
zsh-45bdc87a1f4058f9a8cd5eaceda704284d4a89a1.zip
36601: vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
When pressing Ctrl-C after `git am`, only `last` exists in `.git/rebase-apply/`, which is empty. This patch fixes it to fall back to "no patch applied" then.
-rw-r--r--ChangeLog5
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git25
2 files changed, 19 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index bebc97b53..5a4db9010 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-28 Daniel Hahler <git@thequod.de>
+
+ * 36601: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
+
2015-09-28 Barton E. Schaefer <schaefer@zsh.org>
* 36669: Src/lex.c: fix ${(z)...} of an an incomplete math
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 638ea4572..8ecc7c7f7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -217,18 +217,21 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
elif [[ -d "${gitdir}/rebase-apply" ]]; then
# Fake patch names for all but current patch
patchdir="${gitdir}/rebase-apply"
- local cur=$(< "${patchdir}/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")
+ 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")))
fi
- git_patches_unapplied=($(seq $cur $(< "${patchdir}/last")))
VCS_INFO_git_handle_patches
elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then