[PATCH v3 2/4] completion: complete 'git history --empty' values
From: Vincent Mailhol <mailhol@kernel.org>
Date: 2026-08-13 19:05:29
Subsystem:
the rest · Maintainer:
Linus Torvalds
The "--empty" option accepts "drop", "keep", or "abort" for the "drop" and "fixup" subcommands. Complete these values for the documented --empty=<value> form. While parse-options also accepts the split --empty <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 | 9 +++++++++ t/t9902-completion.sh | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1727768487..7f3cabd595 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash@@ -2169,6 +2169,15 @@ _git_history () if ! __git_has_doubledash; then case "$cur" in + --empty=*) + case "$subcommand" in + drop|fixup) + __gitcomp "drop keep abort" "" \ + "${cur##--empty=}" + ;; + esac + return + ;; --*) __gitcomp_builtin "history_$subcommand" return
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index d0d8f2ba4a..851be383e1 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh@@ -3127,7 +3127,11 @@ test_expect_success 'git history subcommand options' ' test_completion "git history fixup --ree" "--reedit-message " && test_completion "git history split --upd" "--update-refs=" && test_completion "git history split main --dry" "--dry-run " && - test_completion "git history reword main -- --d" "" + test_completion "git history reword main -- --d" "" && + 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_expect_success 'git history revisions' '
--
2.54.0