Re: [PATCH v2 2/2] completion: checkout: complete paths when ref given

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

 




On 02/14/2017 10:31 PM, Junio C Hamano wrote:
> cornelius.weig@xxxxxxxxxxx writes:
> 
>> From: Cornelius Weig <cornelius.weig@xxxxxxxxxxx>
>>
>> Git-checkout completes words starting with '--' as options and other
>> words as refs. Even after specifying a ref, further words not starting
>> with '--' are completed as refs, which is invalid for git-checkout.
>>
>> This commit ensures that after specifying a ref, further non-option
>> words are completed as paths. Four cases are considered:
>>
>>  - If the word contains a ':', do not treat it as reference and use
>>    regular revlist completion.
>>  - If no ref is found on the command line, complete non-options as refs
>>    as before.
>>  - If the ref is HEAD or @, complete only with modified files because
>>    checking out unmodified files is a noop.
>>    This case also applies if no ref is given, but '--' is present.
> 
> Please at least do not do this one; a completion that is or pretends
> to be more clever than the end users will confuse them at best and
> annoy them.  Maybe the user does not recall if she touched the path
> or not, and just trying to be extra sure that it matches HEAD or
> index by doing "git checkout [HEAD] path<TAB>".  Leave the "make it
> a noop" to Git, but just allow her do so.

Hmm.. I'm a bit reluctant to let go of this just yet, because it was my
original motivation for the whole patch. I admit that it may be
confusing to not get completion in your example. However, I think that
once acquainted with the new behavior, a user who wants some files
cleaned would start by having a look at the list of files from "git
checkout HEAD <TAB><TAB>". That's probably faster than spelling the
first few characters and hit <TAB> for a file that's already clean.
Let's hear if anybody else has an opinion about this.

> I personally feel that "git checkout <anything>... foo<TAB>" should
> just fall back to the normal "path on the filesystem" without any
> cleverness, instead of opening a tree object or peek into the index.

I was thinking about that as well, but it's not what happens for "git
checkout topic:path<TAB>". And given that "git checkout topic path<TAB>"
refers to the same object, consistency kind of demands that the tree
objects are opened in the latter case as well. However, because the
differences to filesystem path completion are somewhat corner cases, I'm
fine with that as long as I'm not offered ref names any longer...




[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]