diff options
author | Marc Finet <m.dreadlock@gmail.com> | 2014-10-09 00:24:45 +0200 |
---|---|---|
committer | Frank Terbeck <ft@bewatermyfriend.org> | 2014-10-09 18:11:08 +0200 |
commit | 0f73b35f4e0d8adad216ee6650bfef4622df43b1 (patch) | |
tree | a311604f640fd35d81689421e2fe4da0f0a4dd83 | |
parent | 185476e70e4a9b33481be13f915c2b3c6f7a311d (diff) | |
download | zsh-0f73b35f4e0d8adad216ee6650bfef4622df43b1.tar.gz zsh-0f73b35f4e0d8adad216ee6650bfef4622df43b1.tar.xz zsh-0f73b35f4e0d8adad216ee6650bfef4622df43b1.zip |
33391: vcs_info git: fix applied patch detection on git am
git-am also uses .git/rebase-apply for patch list but the file original-commit does not exist (as no commit exist). This patch handles both git rebase and git am. Also: - get the first line (rather than the first char) when the message contains only one line; - remove unused function (ironically that should have been used here).
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 17 |
2 files changed, 12 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 445f1e709..57850eb0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-10-09 Marc Finet <m.dreadlock@gmail.com> + + * 33391: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: fix applied patch detection on git am + 2014-10-08 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted: Config/version.mk: update to 5.0.7-dev-0 to avoid diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index ee50be6ca..48d552f68 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -195,14 +195,6 @@ fi VCS_INFO_adjust VCS_INFO_git_getaction ${gitdir} - -VCS_INFO_get_get_rebase() -{ - if [[ -f "$1" ]]; then - echo "$(< "$1")" - fi -} - local patchdir=${gitdir}/patches/${gitbranch} if [[ -d $patchdir ]] && [[ -f $patchdir/applied ]] \ && [[ -f $patchdir/unapplied ]] @@ -223,11 +215,16 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then # Fake patch names for all but current patch patchdir="${gitdir}/rebase-apply" local cur=$(< "${patchdir}/next") - local p + local p subject for p in $(seq $(($cur - 1))); do git_patches_applied+=("$(printf "%04d" $p) ?") done - git_patches_applied+=("$(< "${patchdir}/original-commit") ${${(f)$(< "${patchdir}/msg-clean")}[1]}") + 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"))) VCS_INFO_git_handle_patches |