]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: reflog show <log-options>
authorRubén Justo <rjusto@gmail.com>
Sat, 2 Mar 2024 15:50:47 +0000 (16:50 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Mar 2024 22:21:38 +0000 (14:21 -0800)
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>
contrib/completion/git-completion.bash
t/t9902-completion.sh

index ff216f1c6501c7d51d8d8fc2b444db63d21918e8..d4f0e08f5850ead53a5a8ea4a6c7c990dc695e22 100644 (file)
@@ -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
 
index dbd57e6a2834618afee1cc2b92c7e66539762884..04f3620e5bf7d6ec0bebd1152f3ef516322094fe 100755 (executable)
@@ -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' '