git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 6/6] completion: clarify ls-tree, archive, show completion
Date: Fri, 7 Jun 2013 20:45:27 +0200	[thread overview]
Message-ID: <20130607184527.GB25731@goldbirke> (raw)
In-Reply-To: <CALkWK0mbVgJHRoNXNkc6n7==-H+caNqvzrzUwspS_Eq2sMfJbg@mail.gmail.com>

On Fri, Jun 07, 2013 at 10:51:53PM +0530, Ramkumar Ramachandra wrote:
> SZEDER Gábor wrote:
> > Well, people out there might have completion scriplets for their
> > aliases or custom git commands which use __git_complete_file().
> > Removing this function would break those scripts.
> 
> What is the advantage of using __git_complete_file() over
> __git_complete_revlist_file()?

That it doesn't imply that the command takes refs in the form of
ref1..ref2.

> Isn't it just a misleading alias?

No.  It's an implementation detail that __git_complete_file() became
an alias to __git_complete_revlist_file() to avoid unnecessary code
duplication.

And it was a concious decision to keep __git_complete_file() (and
__git_complete_revlist()) around in order not to break completion
scriplets for users' alieses and custom git commands which might call
it.

> > Arguably the name of __git_complete_file() could describe better what
> > the function does, or what it did, i.e. it used to provide completion
> > for the master:Doc<TAB> notation.  But that's only the name.  Since
> > both git ls-tree and git archive understand this notation, calling the
> > helper for master:Doc<TAB> in their completion functions is not
> > misleading at all.
> 
> But __git_complete_revlist_file() provides all this and more, no?

Indeed, and this "more" is exactly why it is misleading to call
__git_complete_revlist_file() directly for git ls-tree and git
archive.

> > Now, __git_complete_revlist_file() provides completion both for this
> > master:Doc<TAB> notation and for revision ranges, i.e. for
> > master..n<TAB> and master...n<TAB>.  However, since neither git
> > ls-tree nor git archive accept revision ranges, calling
> > __git_complete_revlist_file() in their completion function would be
> > misleading.
> 
> Yeah, they accept tree-ish'es.  Isn't __git_complete_file() still a
> horrible name?

We can't go back in time to correct it, unfortunately.

> If anything, we
> should write a new __git_complete_treeish() function that does what
> __git_complete_revlist_file() does, except that it doesn't complete
> revision ranges, right?  Frankly, I don't know if it's worth the
> additional trouble

I agree that it isn't worth it, and that is exactly why
__git_complete_revlist() and __git_complete_file() were unified in
__git_complete_revlist_file().

>   $ git log HEAD:Doc<TAB>
> 
> Note how log doesn't even error out.

But note how git log master..HEAD:Documentation/ errors out.

> > git show is special, as it understands both the master:Doc<TAB>
> > notation and revision ranges, and even the combination of the two, so
> > calling __git_complete_revlist_file() there would indeed be better.
> 
> It just accepts any revspec with pathspec filtering, like many many
> other commands.

Which many many other commands do accept ref1..ref2:file?


Gábor

  parent reply	other threads:[~2013-06-07 18:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-02 14:03 [PATCH 0/6] Minor prompt, completion cleanups Ramkumar Ramachandra
2013-06-02 14:03 ` [PATCH 1/6] prompt: don't scream continuation state Ramkumar Ramachandra
2013-06-03  8:58   ` Thomas Rast
2013-06-03  9:47     ` Ramkumar Ramachandra
2013-06-03 21:15       ` Jeff King
2013-06-04  3:44         ` Ramkumar Ramachandra
2013-06-04  4:38           ` Jeff King
2013-06-04  5:59             ` Junio C Hamano
2013-06-03 17:23     ` Junio C Hamano
2013-06-02 14:03 ` [PATCH 2/6] completion: add common options for rev-parse Ramkumar Ramachandra
2013-06-07 15:33   ` Ramkumar Ramachandra
2013-06-02 14:03 ` [PATCH 3/6] completion: add common options for blame Ramkumar Ramachandra
2013-06-03  9:03   ` Thomas Rast
2013-06-03  9:32     ` Ramkumar Ramachandra
2013-06-03 18:07       ` SZEDER Gábor
2013-06-03 18:34         ` Junio C Hamano
2013-06-06  9:58       ` Peter Krefting
2013-06-03 17:24     ` Junio C Hamano
2013-06-02 14:03 ` [PATCH 4/6] completion: correct completion for format-patch Ramkumar Ramachandra
2013-06-02 17:20   ` Felipe Contreras
2013-06-02 17:29     ` Ramkumar Ramachandra
2013-06-02 14:03 ` [PATCH 5/6] completion: clarify difftool completion Ramkumar Ramachandra
2013-06-03 17:29   ` Junio C Hamano
2013-06-02 14:03 ` [PATCH 6/6] completion: clarify ls-tree, archive, show completion Ramkumar Ramachandra
2013-06-03 17:33   ` Junio C Hamano
2013-06-04  3:49     ` Ramkumar Ramachandra
2013-06-04  6:01       ` Junio C Hamano
2013-06-03 17:58   ` Junio C Hamano
2013-06-03 19:25   ` SZEDER Gábor
2013-06-07 17:21     ` Ramkumar Ramachandra
2013-06-07 18:36       ` Junio C Hamano
2013-06-07 18:45       ` SZEDER Gábor [this message]
2013-06-09 20:56     ` Junio C Hamano

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=20130607184527.GB25731@goldbirke \
    --to=szeder@ira.uka.de \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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).