Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _git-cat-file blob completion fix
- X-seq: zsh-workers 36247
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: [PATCH] _git-cat-file blob completion fix
- Date: Wed, 19 Aug 2015 23:24:19 +0000
- Cc: zsh workers <zsh-workers@xxxxxxx>
- 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=
- In-reply-to: <CAHYJk3QDaBiMxLeG=+dUwt1=Pu7wzKi1Qtbeovok7nFq8vvdMA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20150819020536.GE2005@tarsus.local2> <CAHYJk3QDaBiMxLeG=+dUwt1=Pu7wzKi1Qtbeovok7nFq8vvdMA@mail.gmail.com>
Mikael Magnusson wrote on Wed, Aug 19, 2015 at 04:10:42 +0200:
> On Wed, Aug 19, 2015 at 4:05 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > 'git cat-file HEAD:<TAB>', 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:<TAB>'.)
> >
> > 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' \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author