[PATCH v3 3/4] completion: complete 'git history --update-refs' values
From: Vincent Mailhol <mailhol@kernel.org>
Date: 2026-08-13 19:05:31
Subsystem:
the rest · Maintainer:
Linus Torvalds
The "--update-refs" option accepts either "branches" or "head". Complete these values for the documented --update-refs=<value> form. While parse-options also accepts the split --update-refs <value> form, it is not documented. Omit it from completion as a trade-off for code simplicity. Signed-off-by: Vincent Mailhol <mailhol@kernel.org> --- Changes in v3: - Complete only the documented stuck form. Changes in v2: - New patch. --- contrib/completion/git-completion.bash | 5 +++++ t/t9902-completion.sh | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7f3cabd595..19600940dc 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash@@ -2178,6 +2178,11 @@ _git_history () esac return ;; + --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 851be383e1..b225dd3800 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh@@ -3131,7 +3131,10 @@ test_expect_success 'git history subcommand options' ' test_completion "git history fixup --empty=ke" "keep " && test_completion "git history fixup --empty=drop" "drop " && 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=branch" "branches " && + test_completion "git history split --update-refs=he" "head " && + test_completion "git history reword main -- --update-refs=he" "" ' test_expect_success 'git history revisions' '
--
2.54.0