completion: send-email: don't complete revs when --no-format-patch
cover completion: send-email: don't complete revs when --no-format-patch
Along the way I taught __git_find_last_on_cmdline to understand '--', which isn't stricly necessary but I think reads more clearly at the call sites. __git_find_on_cmdline could be changed to work the same, or this part dropped if people don't like it.
Britton Leo Kerin (1):
completion: don't comp revs when --no-format-patch
contrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
base-commit: e79552d19784ee7f4bbce278fe25f93fbda196fa --
2.43.0
Quoted 4 lines · Britton Leo Kerin
Along the way I taught
__git_find_last_on_cmdlineto understand '--', which isn't stricly necessary but I think reads more clearly at the call sites.__git_find_on_cmdlinecould be changed to work the same, or this part dropped if people don't like it.
If I may suggest, there's no need for a cover letter for a single patch.
If you want to include some notes in the patch submission, which aren't
supposed to be part of the commit summary, you can do that in the patch itself.
Quoted 10 lines
Britton Leo Kerin (1):
completion: don't comp revs when --no-format-patchcontrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)base-commit:
e79552d19784ee7f4bbce278fe25f93fbda196fa--
2.43.0
Quoted 10 lines · Dragan Simic
Quoted 7 lines · Britton Leo Kerin
Along the way I taught
__git_find_last_on_cmdlineto understand '--', which
isn't stricly necessary but I think reads more clearly at the call sites.__git_find_on_cmdlinecould be changed to work the same, or this part dropped
if people don't like it.
Quoted 4 lines
If I may suggest, there's no need for a cover letter for a single patch.
If you want to include some notes in the patch submission, which aren't
supposed to be part of the commit summary, you can do that in the patch itself.
Ok thanks, I'll do it that way in future.
Britton
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 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').
--- contrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +5 -1
@@ -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 ()
Signature · 1 line
2.43.0
Re: [PATCH v2 1/1] completion: don't complete revs when --no-format-patch
Quoted 9 lines · 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 <[email protected]>--- contrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Any reviews people want to offer to this one?
Thanks.
Quoted 28 lines
contrib/completion/git-completion.bash +5
-1@@ -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 ()
Re: [PATCH v2 1/1] completion: don't complete revs when --no-format-patch
In reply to Britton Leo KerinQuoted 28 lines · 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 <[email protected]>--- contrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)contrib/completion/git-completion.bash +2
-0@@ -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
contrib/completion/git-completion.bash _git_send_email () · line 2437
Quoted 8 lines
contrib/completion/git-completion.bash +3
-1@@ -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 }
While this second hunk here makes perfect sense to me, there is no explanation why we need to change __git_find_last_on_cmdline (). It's already used with "--guess --no-guess" in another place, so I would think that it ought to work alright for this usecase, too. Or is it that the existing callsite of this function is buggy, too? If so, we should likely fix that in a separate patch together with a test.
Also, adding a test for git-send-email that exercises this new behaviour would be very much welcome, too.
Patrick
Re: [PATCH v2 1/1] completion: don't complete revs when --no-format-patch
Quoted 46 lines · Patrick Steinhardt
Quoted 28 lines · 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 <[email protected]>--- contrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)contrib/completion/git-completion.bash +2
-0@@ -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" ]; docontrib/completion/git-completion.bash _git_send_email () · line 2437
Quoted 8 lines
contrib/completion/git-completion.bash +3
-1@@ -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 }While this second hunk here makes perfect sense to me, there is no explanation why we need to change
__git_find_last_on_cmdline (). It's already used with "--guess --no-guess" in another place, so I would think that it ought to work alright for this usecase, too. Or is it that the existing callsite of this function is buggy, too? If so, we should likely fix that in a separate patch together with a test.
Quoted 2 lines
Also, adding a test for git-send-email that exercises this new behaviour would be very much welcome, too.
I'll look this one over again and add some tests eventually.
Britton
Re: [PATCH v2 1/1] completion: don't complete revs when --no-format-patch
Quoted 11 lines · Britton Kerin
Quoted 9 lines
While this second hunk here makes perfect sense to me, there is no explanation why we need to change
__git_find_last_on_cmdline (). It's already used with "--guess --no-guess" in another place, so I would think that it ought to work alright for this usecase, too. Or is it that the existing callsite of this function is buggy, too? If so, we should likely fix that in a separate patch together with a test.Also, adding a test for git-send-email that exercises this new behaviour would be very much welcome, too.
I'll look this one over again and add some tests eventually.
Thank you, both.
Re: [PATCH v2 1/1] completion: don't complete revs when --no-format-patch
In reply to Britton KerinQuoted 6 lines · Britton Kerin
Quoted 3 lines · Patrick Steinhardt
...
Also, adding a test for git-send-email that exercises this new behaviour would be very much welcome, too.I'll look this one over again and add some tests eventually.
Just pinging the thread to keep it visible in the list of recent topics I need to keep an eye on. No rush.
Thanks.
Re: [PATCH v2 1/1] completion: don't complete revs when --no-format-patch
In reply to Britton KerinQuoted 11 lines · Britton Kerin
Quoted 10 lines · Patrick Steinhardt
On Mon, Jan 08, 2024 at 04:08:30PM -0900, Britton Leo Kerin wrote:
...
While this second hunk here makes perfect sense to me, there is no explanation why we need to change__git_find_last_on_cmdline (). It's already used with "--guess --no-guess" in another place, so I would think that it ought to work alright for this usecase, too. Or is it that the existing callsite of this function is buggy, too? If so, we should likely fix that in a separate patch together with a test.
Quoted 4 lines
Quoted 2 lines
Also, adding a test for git-send-email that exercises this new behaviour would be very much welcome, too.
I'll look this one over again and add some tests eventually.
It has been a while, but is there any progress on this topic?
Thanks.
v2 cover completion: don't complete revs when --no-format-patch
In reply to Britton Leo KerinImprove commit message
Britton Leo Kerin (1):
completion: don't complete revs when --no-format-patch
contrib/completion/git-completion.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Range-diff against v1:
1: ff4d2e55e3 ! 1: e56dbbacd9 completion: don't comp revs when --no-format-patch
@@ Metadata
Author: Britton Leo Kerin <[email protected]>
## Commit message ##
- completion: don't comp revs when --no-format-patch
+ 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
--
2.43.0