From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24907 invoked by alias); 19 Aug 2015 23:24:31 -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: 36247 Received: (qmail 10232 invoked from network); 19 Aug 2015 23:24:29 -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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=JcmAQoSPs0SdQAkp 95bOp8TI+vA=; b=M27S/aOPHxWj1TDUnPk9Zjkh+mu6pAxk+RlFpfDeJ4mIo8wH 4TC/wk8dDcNsoScnmwUY7egjs6+K6pVKMM6peWHAJq37XvkhHwJIbmRsdhNpcY9d Pgt2Y6g4XACMgZ5LRmGAqZF98K0E05xJfQQuufy6imhml4qfOsn36pS7+z0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=JcmAQoSPs0SdQAk p95bOp8TI+vA=; b=roRX8pVEfAOK2qT0d2NhPSMVBbByVbX0+DGqDyf0SoNiCP5 10kQq/qPnPVHias9Jrx6UY6S3kOvdNA36obpskfVnRAK5NVv+iPa283lR9YxJeMy Uqfsi8Pk7DeP+rQiVYqatjTrcVi7qaBG3J2ZhE7B4AaAIIvKpavKhiwUoCp0= X-Sasl-enc: V+RfpB47vbmn66NNIz5rqvvyMk9aVvztzW6076JObdx2 1440026666 Date: Wed, 19 Aug 2015 23:24:19 +0000 From: Daniel Shahaf To: Mikael Magnusson Cc: zsh workers Subject: Re: [PATCH] _git-cat-file blob completion fix Message-ID: <20150819232419.GA4673@tarsus.local2> References: <20150819020536.GE2005@tarsus.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mikael Magnusson wrote on Wed, Aug 19, 2015 at 04:10:42 +0200: > On Wed, Aug 19, 2015 at 4:05 AM, Daniel Shahaf wrote: > > 'git cat-file HEAD:', when cwd is a subdirectory of a repository, > > completes files within that subdirectory, but should complete files > > relative to the repository root. The attach patch implements that. > > > > Review would be appreciated — I might have missed something while > > reverse-engineering the semantics of everything. (I already checked > > gitrevisions(7) and tested 'git rev-parse HEAD:'.) > > > > I didn't make --root-relative a zparseopts option because I didn't want > > to have to name the same as git option it maps to. > > You can say HEAD:./foo to specify foo relative to the current > directory. However, this doesn't work in the current completer either > afaict, so it's not a regression to apply this patch :). To be applied on top of the previous. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 23113ac..18df09e 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5739,7 +5739,11 @@ __git_tree_ishs () { __git_objects () { compset -P '*:' if [[ -n $IPREFIX ]]; then - __git_tree_files --root-relative "$PREFIX" "${IPREFIX%:}" + if compset -P ./ ; then + __git_tree_files "$PREFIX" "${IPREFIX%:./}" + else + __git_tree_files --root-relative "$PREFIX" "${IPREFIX%:}" + fi else _alternative \ 'revisions::__git_revisions' \