From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: zsh-workers@zsh.org
Subject: [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
Date: Wed, 23 Sep 2015 20:55:40 +0200 [thread overview]
Message-ID: <1443034540-30672-1-git-send-email-genml+zsh-workers@thequod.de> (raw)
From: Daniel Hahler <git@thequod.de>
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.
---
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 25 +++++++++++++----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 638ea45..8ecc7c7 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
--
2.5.3.dirty
next reply other threads:[~2015-09-23 19:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 18:55 Daniel Hahler [this message]
2015-09-28 1:34 ` Daniel Shahaf
2015-09-28 18:05 ` Frank Terbeck
2015-09-28 20:53 ` Daniel Hahler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443034540-30672-1-git-send-email-genml+zsh-workers@thequod.de \
--to=genml+zsh-workers@thequod.de \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).