From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1048 invoked by alias); 8 Oct 2014 22:05:42 -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: 33390 Received: (qmail 12860 invoked from network); 8 Oct 2014 22:05:35 -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=from:message-id:date:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=nQ7m+Z+PAab1rCZmFmQrAAK1Df67ZlhkQa6mvhAqHIk=; b=nJ10AXNbI6fcnn13C0SSsmlgqjWykTmy+sGgaTcDAgwwdHw2QOHVcu8b9EKfnfofIh OJc2SGzlRJjq376xuCW1dVVdMAtd7Opxhf0iDlFxgIA4uTn4dETb2TGiact38TCROHty xDx+W8RyaMmKMO8hSWCmAwIBGp6+pR5rVaBn8D6dhBGWGWx0L65B+7jMmiQVqRjUMuSK tYMYlHMKn3nXVrb2NxD5+pybVlntJ1O+HlbvmheO0Yekp+IiBDxf9mB5XkPIP1lul1sL PzJT5cqhtLsRN67PO4lO98v9RHX1s/5Rpe3GbkkOkCv/UDkcm/88idBdbGH56DU/uwus LtMw== X-Received: by 10.112.204.197 with SMTP id la5mr13506346lbc.2.1412805925861; Wed, 08 Oct 2014 15:05:25 -0700 (PDT) From: Daniel Hahler X-Google-Original-From: Daniel Hahler Message-ID: <5435B523.5010804@thequod.de> Date: Thu, 09 Oct 2014 00:05:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Zsh Hackers' List Subject: Re: vcs_info: quoting (backticks) in git_patches_applied References: <54355781.7080004@thequod.de> <87a956i80i.fsf@ft.bewatermyfriend.org> In-Reply-To: <87a956i80i.fsf@ft.bewatermyfriend.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 08.10.2014 23:09, Frank Terbeck wrote: >> I've noticed that there is a problem when using `%m` in vcs_info, >> where the default `get-applied-string` hook returns something with > I'm a bit confused. There is no default gen-applied-string hook. You are right - there is no default hook, but the default handling in case of no hook. >>> 6410ed117e51a4288d06132d18e2ffdf33f51313 Add snippets `'`, `"` and `doc` > And there is no such commit in zsh's git repository. The commit is not in zsh's history, but in another private/local repo/branch. >> While the backticks can be replaced in the prompt itself, it might be >> better to quote it in `VCS_INFO_git_handle_patches`: > [...] >> - git_applied_s=${git_patches_applied[1]} >> + git_applied_s=${(qqq)git_patches_applied[1]} > [...] >> There is probably a better place to apply the quoting, e.g. when reading >> the patches from the file, or a more central place in vcs_info, because >> this is likely to affect other backends, too. > > I don't think we should post-process these values. The hooks should > return properly quoted data I've added an own gen-applied-string hook, which quotes the value, but the default behavior is to get the data via: elif [[ -d "${gitdir}/rebase-merge" ]]; then patchdir="${gitdir}/rebase-merge" local p for p in ${(f)"$(< "${patchdir}/done")"}; do # remove action git_patches_applied+=("${${(s: :)p}[2,-1]}") done The quoting needs to get applied to all places where the Git sources are being read in Functions/VCS_Info/Backends/VCS_INFO_get_data_git then probably, and also in the code for other VCS (e.g. hg). > (I suppose your problem is that your hook > does returns a - maybe even single - backtick and you use the > prompt_subst option which would cause problems) as the rest of the > configuration requires. That's correct. Regards, Daniel.