aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRubén Justo <rjusto@gmail.com>2024-03-02 16:50:47 +0100
committerJunio C Hamano <gitster@pobox.com>2024-03-03 14:21:38 -0800
commitc689c38bc2dceac3f8fe975472f12c0dbe473537 (patch)
tree1ce5fd2914c4d5e4b192e9c55da9c595a71c7394
parent85452a1d4b582701772b02b5a70b8bf5a82258bc (diff)
downloadgit-c689c38bc2dceac3f8fe975472f12c0dbe473537.tar.gz
completion: reflog show <log-options>
Let's add completion for <log-options> in "reflog show" so that the user can easily discover uses like: $ git reflog --since=1.day.ago Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--contrib/completion/git-completion.bash10
-rwxr-xr-xt/t9902-completion.sh5
2 files changed, 14 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ff216f1c65..d4f0e08f58 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2407,6 +2407,16 @@ _git_rebase ()
_git_reflog ()
{
local subcommands="show delete expire"
+ local subcommand="$(__git_find_subcommand "$subcommands" "show")"
+
+ case "$subcommand,$cur" in
+ show,--*)
+ __gitcomp "
+ $__git_log_common_options
+ "
+ return
+ ;;
+ esac
__git_complete_refs
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index dbd57e6a28..04f3620e5b 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2626,7 +2626,10 @@ test_expect_success 'git reflog show' '
shown Z
EOF
test_completion "git reflog show sho" "shown " &&
- test_completion "git reflog shown sho" "shown "
+ test_completion "git reflog shown sho" "shown " &&
+ test_completion "git reflog --unt" "--until=" &&
+ test_completion "git reflog show --unt" "--until=" &&
+ test_completion "git reflog shown --unt" "--until="
'
test_expect_success 'options with value' '