Re: [PATCH] completion: complete "git diff ...branc<TAB>"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 24, 2011, 17:09 UTC
- Message-ID
- <7vfwrd2wbn.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20110224151328.GB14720@neumann>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 8 quoted lines
> There is this 'ref:file' notation (as in 'git show master:README', but > I don't know the proper term for it), which is understood by > __git_complete_file(), and can be useful for 'git diff', e.g. to > compare a file in two branches when the file was renamed in between: > > git diff branchA:old branchB:new > > However, __git_complete_revlist() doesn't understand this notation,
If that is the case, I wonder if complete-revlist should learn it as well. The "<tree>:<path>" notation is just one of the "extended SHA-1 expressions" to name an entry in a tree object and should be usable anywhere an object name is expected to occur.
The users of complete-revlist seems to be "log" and their friends, and they don't expect arbitrary object names; they are only interested in commit objects and tags and then paths. Teaching <tree>:<path> to it may make "git log HEAD:bar<TAB>" to complete to "git log HEAD:bar/boz" that would be a nonsense, but anything that the original "git log HEAD:bar" would complete would be a nonsense to begin with (as soon as you said "HEAD:<something to follow>", you are naming either a blob or a tree object, and you cannot start log from them), so I don't see a harm done in doing so.
IOW, shouldn't there be just one unified complete-rev-then-path that is a superset of the current complete-revlist and complete-file that all the current users of complete-revlist and complete-file should use?