[PATCH 6/6] completion: clarify ls-tree, archive, show completion
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jun 2, 2013, 14:03 UTC
- Message-ID
- <1370181822-23450-7-git-send-email-artagnon@gmail.com>
- In-Reply-To
- <1370181822-23450-1-git-send-email-artagnon@gmail.com>
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.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> --- contrib/completion/git-completion.bash | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8d70c30..84d1548 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -592,11 +592,6 @@ __git_complete_diff_index_file () esac } -__git_complete_file () -{ - __git_complete_revlist_file -} - __git_complete_revlist () { __git_complete_revlist_file @@ -1007,7 +1002,7 @@ _git_archive () return ;; esac - __git_complete_file + __git_complete_revlist_file } _git_bisect () @@ -1476,7 +1471,7 @@ _git_ls_remote () _git_ls_tree () { - __git_complete_file + __git_complete_revlist_file } # Options that go well for log, shortlog and gitk @@ -2382,7 +2377,7 @@ _git_show () return ;; esac - __git_complete_file + __git_complete_revlist_file } _git_show_branch ()
-- 1.8.3.457.g2410d5e