From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 6/6] completion: clarify ls-tree, archive, show completion
Date: Mon, 03 Jun 2013 10:33:33 -0700 [thread overview]
Message-ID: <7vehcjgkuq.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1370181822-23450-7-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Sun, 2 Jun 2013 19:33:42 +0530")
Ramkumar Ramachandra <artagnon@gmail.com> 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. 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>
> ---
I think this is the same as 5/6 and better explained in a single
patch, as the rationale is the same: these commands can all take the
usual revs and then paths, so using misnamed complete_FILE helper is
wrong.
Mind if I squashed them together?
> 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 ()
next prev parent reply other threads:[~2013-06-03 17:33 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-02 14:03 [PATCH 0/6] Minor prompt, completion cleanups Ramkumar Ramachandra
2013-06-02 14:03 ` [PATCH 1/6] prompt: don't scream continuation state Ramkumar Ramachandra
2013-06-03 8:58 ` Thomas Rast
2013-06-03 9:47 ` Ramkumar Ramachandra
2013-06-03 21:15 ` Jeff King
2013-06-04 3:44 ` Ramkumar Ramachandra
2013-06-04 4:38 ` Jeff King
2013-06-04 5:59 ` Junio C Hamano
2013-06-03 17:23 ` Junio C Hamano
2013-06-02 14:03 ` [PATCH 2/6] completion: add common options for rev-parse Ramkumar Ramachandra
2013-06-07 15:33 ` Ramkumar Ramachandra
2013-06-02 14:03 ` [PATCH 3/6] completion: add common options for blame Ramkumar Ramachandra
2013-06-03 9:03 ` Thomas Rast
2013-06-03 9:32 ` Ramkumar Ramachandra
2013-06-03 18:07 ` SZEDER Gábor
2013-06-03 18:34 ` Junio C Hamano
2013-06-06 9:58 ` Peter Krefting
2013-06-03 17:24 ` Junio C Hamano
2013-06-02 14:03 ` [PATCH 4/6] completion: correct completion for format-patch Ramkumar Ramachandra
2013-06-02 17:20 ` Felipe Contreras
2013-06-02 17:29 ` Ramkumar Ramachandra
2013-06-02 14:03 ` [PATCH 5/6] completion: clarify difftool completion Ramkumar Ramachandra
2013-06-03 17:29 ` Junio C Hamano
2013-06-02 14:03 ` [PATCH 6/6] completion: clarify ls-tree, archive, show completion Ramkumar Ramachandra
2013-06-03 17:33 ` Junio C Hamano [this message]
2013-06-04 3:49 ` Ramkumar Ramachandra
2013-06-04 6:01 ` Junio C Hamano
2013-06-03 17:58 ` Junio C Hamano
2013-06-03 19:25 ` SZEDER Gábor
2013-06-07 17:21 ` Ramkumar Ramachandra
2013-06-07 18:36 ` Junio C Hamano
2013-06-07 18:45 ` SZEDER Gábor
2013-06-09 20:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vehcjgkuq.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).