Re: [PATCH 6/6] completion: clarify ls-tree, archive, show completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 02, 2013 at 07:33:42PM +0530, Ramkumar Ramachandra wrote:
> Currently, the 'git ls-tree', 'git archive', and 'git show' completions
> use __git_complete_file (aliased to __git_complete_revlist_file).
> 
> In the case of 'git ls-tree' and 'git archive', they necessarily require
> a tree-ish argument (and optionally a pathspec filter, or "file
> argument"):
> 
>   $ git ls-tree hot-branch git.c
>   $ git archive HEAD~4 git.c
> 
> So, __git_complete_file is a misleading name.
> 
> In the case of 'git show', it can take a pathspec and default the
> revision to HEAD like:
> 
>   $ git show git.c
> 
> (which is useful if git.c was modified in HEAD)
> 
> However, this usage is not idiomatic at all.  The more common usage is
> like:
> 
>   $ git show HEAD~1
>   $ git show origin/pu:git.c
> 
> So, __git_complete_file is again a poor name.
> 
> Replace these three instances of __git_complete_file with
> __git_complete_revlist_file, without making any functional changes.
> 
> Remove __git_complete_file, as it has no other callers.
> 

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.

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.

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.

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.


Gábor

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]