git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] completion: don't comp revs when --no-format-patch
       [not found] <20240108093601.136370-1-britton.kerin@gmail.com>
@ 2024-01-08  9:36 ` Britton Leo Kerin
  2024-01-08 18:39   ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Britton Leo Kerin @ 2024-01-08  9:36 UTC (permalink / raw)
  To: git; +Cc: Britton Leo Kerin

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>
---
 contrib/completion/git-completion.bash | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 185b47d802..c983f3b2ab 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1242,10 +1242,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
@@ -2429,7 +2431,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 ()
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] completion: don't comp revs when --no-format-patch
  2024-01-08  9:36 ` [PATCH 1/1] completion: don't comp revs when --no-format-patch Britton Leo Kerin
@ 2024-01-08 18:39   ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2024-01-08 18:39 UTC (permalink / raw)
  To: Britton Leo Kerin; +Cc: git

>Subject: Re: [PATCH 1/1] completion: don't comp revs when --no-format-patch

I suspect "comp revs" -> "complete revs" is what you meant, but
if so, please spell it out to help folks who read "git shortlog --no-merges"
output, i.e. without help from the body of the log message.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-08 18:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240108093601.136370-1-britton.kerin@gmail.com>
2024-01-08  9:36 ` [PATCH 1/1] completion: don't comp revs when --no-format-patch Britton Leo Kerin
2024-01-08 18:39   ` Junio C Hamano

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 NNTP newsgroup(s).