From e500dcc19286c10d7910b6e4393df91667d4de0e Mon Sep 17 00:00:00 2001 From: Vincent Mailhol Date: Thu, 6 Aug 2026 22:27:38 +0200 Subject: [PATCH] completion: complete 'git history --update-refs' values The "--update-refs" option accepts either "branches" or "head". Complete these values. Although the synopsis only documents the: --update-refs= form, parse-options also accepts the value as a separate argument: --update-refs Support both forms to follow the parser. Signed-off-by: Vincent Mailhol Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 5 +++++ t/t9902-completion.sh | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index fe5223b8ec..6f1ba96763 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2181,6 +2181,11 @@ _git_history () ;; esac ;; + --update-refs,*|*,--update-refs=*) + __gitcomp "branches head" "" \ + "${cur##--update-refs=}" + return + ;; *,--*) __gitcomp_builtin "history_$subcommand" return diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 52a036a1ad..ea86ecc08f 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -3129,7 +3129,11 @@ test_expect_success 'git history subcommand options' ' test_completion "git history reword main -- --d" "" && test_completion "git history fixup --empty=ke" "keep " && test_completion "git history drop --empty ab" "abort " && - test_completion "git history reword --empty=ke" "" + test_completion "git history reword --empty=ke" "" && + test_completion "git history fixup --update-refs=he" "head " && + test_completion "git history split --update-refs he" "head " && + test_completion "git history reword main -- --update-refs=he" "" && + test_completion "git history reword main -- --update-refs he" "" ' test_expect_success 'git history revisions' '