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

Re: What's cooking in git.git (Jun 2013, #03; Thu, 6)

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 9, 2013, 21:20 UTC
Message-ID
<7v1u8bouam.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130608001147.GA32350@goldbirke>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 14 quoted lines
>> It is somewhat annoying that "git diff gi<TAB>" stops at expanding
>> it to "git diff git" and then upon another "git diff git<TAB>"
>> offers tags whose names begin with "git" (e.g. gitgui-0.10.0) but
>> the pathname git.c is not included in the choices.  My wish was to
>> take the union in such a fairly limited case.  I tend to agree with
>> you that "git diff <TAB>" that expands to all refs and pathnames
>> would be useless, but so is expansion to all pathnames (or refnames
>> for that matter).
>
> ... or trying to complete a branch name starting with a 'v', and then
> getting all the vx.y.z tags.
>
> If you know you want git.c, then you can force filename completion
> either by entering "--" before hitting tab...

Yes, that is exactly why I said "the current completion code already works better than reasonably well, at least for me" in the concluding part of my message.

Regarding that rr/complete-difftool topic, let's revert the tip 2 commits (the "ls-tree, archive and show" one, and the follow-up resurrection of __git_complete_file) with this:

    Revert 77c1305 and 3c3b46b
    
    As explained by SZEDER Gábor in $gmane/226272, git_complete_file
    helper is about completing <tree-ish>, taking <commit> at the tips
    of refs and also understanding <tree-ish>:<path> notation, and
    changing "archive" and "ls-tree" to use git_complete_revlist_file
    that in addition is meant to expand A..B range notation was a
    mistake.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

and then queue this on top of d8517cc6670d (completion: difftool takes both revs and files, 2013-06-02), so that the attached and d8517cc6670d will be the only two commits that graduate to 'master' from this topic.

-- >8 --
From: Ramkumar Ramachandra <artagnon@gmail.com>
Date: Sun, 2 Jun 2013 19:33:42 +0530
Subject: [PATCH] completion: show can take both revlist and paths

The 'git show' completion uses __git_complete_file (aliased to __git_complete_revlist_file), because accepts <tree-ish>:<path> as well as <commit-ish>. But the command also accepts range of commits in A..B notation, so using __git_complete_revlist_file is more appropriate.

There still remain two users of __git_complete_file, completions for "archive" and "ls-tree". As these commands do not take range notation, and "git show" no longer uses __git_complete_file, the implementation of can be updated not to complete ranges, but that is a separate topic.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1b4b0f9..b9dfc3b 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2360,7 +2360,7 @@ _git_show ()
 		return
 		;;
 	esac
-	__git_complete_file
+	__git_complete_revlist_file
 }
 
 _git_show_branch ()
-- 
1.8.3-477-gc2fede3
Previous: SZEDER GáborNext: SZEDER Gábor
Message 16 of 24 in “What's cooking in git.git (Jun 2013, #03; Thu, 6)”
  1. Junio C HamanoJun 6, 2013
  2. SZEDER GáborJun 7, 2013
  3. Junio C HamanoJun 7, 2013
  4. Junio C HamanoJun 7, 2013
  5. SZEDER GáborJun 7, 2013
  6. Ramkumar RamachandraJun 7, 2013
  7. SZEDER GáborJun 7, 2013
  8. Ramkumar RamachandraJun 7, 2013
  9. Junio C HamanoJun 7, 2013
  10. Ramkumar RamachandraJun 7, 2013
  11. SZEDER GáborJun 7, 2013
  12. Junio C HamanoJun 7, 2013
  13. SZEDER GáborJun 7, 2013
  14. Junio C HamanoJun 7, 2013
  15. SZEDER GáborJun 8, 2013
  16. Junio C HamanoJun 9, 2013
  17. SZEDER GáborJun 9, 2013
  18. Junio C HamanoJun 9, 2013
  19. Ramkumar RamachandraJun 10, 2013
  20. Junio C HamanoJun 10, 2013
  21. Ramkumar RamachandraJun 10, 2013
  22. SZEDER GáborJun 7, 2013
  23. Ramkumar RamachandraJun 8, 2013
  24. Matthieu MoyJun 8, 2013

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.