diff options
author | Britton Leo Kerin <britton.kerin@gmail.com> | 2024-01-09 04:08:30 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-01-13 02:30:32 +0300 |
commit | d372feb203cda9725e78154dd0553654427501e8 (patch) | |
tree | b571462e7f4af730f60e1ea1dbd22afc67d84f69 /contrib | |
parent | a54a84b333adbecf7bc4483c0e36ed5878cac17b (diff) |
completion: don't complete revs when --no-format-patch
In this case the user has specifically said they don't want send-email
to run format-patch so revs aren't valid argument completions (and it's
likely revs and dirs do have some same names or prefixes as in
Documentation/MyFirstContribution.txt 'psuh').
Signed-off-by: Britton Leo Kerin <britton.kerin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/completion/git-completion.bash | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8c40ade494..26ed750cdd 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1274,10 +1274,12 @@ __git_find_last_on_cmdline () while test $# -gt 1; do case "$1" in --show-idx) show_idx=y ;; + --) shift && break ;; *) return 1 ;; esac shift done + [ $# -eq 1 ] || return 1 # return 1 if we got wrong # of non-opts local wordlist="$1" while [ $c -gt "$__git_cmd_idx" ]; do @@ -2461,7 +2463,9 @@ _git_send_email () return ;; esac - __git_complete_revlist + if [ "$(__git_find_last_on_cmdline -- "--format-patch --no-format-patch")" != "--no-format-patch" ]; then + __git_complete_revlist + fi } _git_stage () |