From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24871 invoked by alias); 8 Oct 2014 22:35:36 -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: 33393 Received: (qmail 14392 invoked from network); 8 Oct 2014 22:35:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3A0zkuIzjBf8JQcV9+HrmBWfqV/3WqJWSR6AzPFyodc=; b=wUEIKFkluYX8a3Ee64Y0QyjSBqi2bGdzzpm8PUmcN3AFEHdYgczur2VcFw6ti0oy5k P6fbWGoqle5OGE6ptm6WGqnz1NG/FcALCb3LcSQjRbtv8qT6Rgik9g5LwiwoQX/z8qJh HkbzVOe+3aRh1Ke0cikb0Vni65Vql4QTsOv8pM7CUIpB9+wB6Zsm3mrRD5U+SM2HCNDb NtAebsvCPsoWgygPL2L9sBSrTkoUc/HUHMrDbLLmeTLhJ+zRmb8PJEvfzUOv70dS9beS XdhdDmCYooinLrZK5QzHuyfr9qq9Xo6YTm62uiOcxyrxRruRWO3cOKkLqVsPhmgK7z1h ij5g== MIME-Version: 1.0 X-Received: by 10.43.126.201 with SMTP id gx9mr1079204icc.66.1412807728566; Wed, 08 Oct 2014 15:35:28 -0700 (PDT) In-Reply-To: <20141009002445.7d6c82a5@mlap.lactee> References: <20141009002445.7d6c82a5@mlap.lactee> Date: Thu, 9 Oct 2014 00:35:28 +0200 Message-ID: Subject: Re: [PATCH] vcs_info git: fix applied patch detection on git am From: Mikael Magnusson To: Marc Finet Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On 9 October 2014 00:24, Marc Finet wrote: > 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). > --- > Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > index ee50be6..48d552f 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 > -- > 2.1.1 > We should possibly have a -f check for every instance of $(< since this construct will abort script execution if the file does not exist, eg echo $(