From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17682 invoked by alias); 23 Sep 2015 19:06:09 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36601 Received: (qmail 21549 invoked from network); 23 Sep 2015 19:06:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= x-mailer:message-id:date:date:subject:subject:from:from:received :received:received; s=postfix2; t=1443034545; bh=l/X669zUiyJV0yH YicXXd/HCgQVQ0bsQI8cS1Axa3eI=; b=kw6/SKt0HLn/tH+cgs18gCQgtqgApC+ SoLalcywCB5bHnT//mD67NdbRWgKiYms1HI/BWgY4qUqgbqoGG8+DfN5l4SyW8DO VlG7Te5vmYLjPXQgHdsS6HQTNhisaoxGmEBFAHGvQYA0d1UcFWkyjJayY/RnnPu1 2FpJYHJdB180= From: Daniel Hahler 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 Message-Id: <1443034540-30672-1-git-send-email-genml+zsh-workers@thequod.de> X-Mailer: git-send-email 2.5.3.dirty From: Daniel Hahler 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