git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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?

Previous: SZEDER GáborNext: SZEDER Gábor
Message 6 of 9 in “completion: complete "git diff ...branc<TAB>"”
  1. completion: complete "git diff ...branc<TAB>"Junio C Hamano, Feb 23, 2011
  2. Michael J GruberFeb 24, 2011
  3. SZEDER GáborFeb 24, 2011
  4. Michael J GruberFeb 24, 2011
  5. SZEDER GáborFeb 24, 2011
  6. Junio C HamanoFeb 24, 2011
  7. 1/2 bash: fix misindented esac statement in __git_complete_file()SZEDER Gábor, Mar 10, 2011
  8. 2/2 bash: complete 'git diff ...branc<TAB>'SZEDER Gábor, Mar 10, 2011
  9. Junio C HamanoMar 10, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.