Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 6/6] completion: clarify ls-tree, archive, show completion

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:32

Ramkumar Ramachandra [off-list ref] writes:
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.
More idiomatic is after seeing "git show --stat" doing "git show dir/".

But I do not think it really matters.

Just like "diff" and "difftool", "show" optionally takes revs and
paths, and because the current completion code does not do anything
fancy like "we have seen enough revs and there will appear no revs
hence we only complete paths from here on", complete_revlist_file is
the right helper to use for all of them.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help