zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: [PATCH] _git-cat-file blob completion fix
Date: Wed, 19 Aug 2015 23:24:19 +0000	[thread overview]
Message-ID: <20150819232419.GA4673@tarsus.local2> (raw)
In-Reply-To: <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@daniel.shahaf.name> 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' \


      reply	other threads:[~2015-08-19 23:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  2:05 Daniel Shahaf
2015-08-19  2:10 ` Mikael Magnusson
2015-08-19 23:24   ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150819232419.GA4673@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=mikachu@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).