All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol@kernel.org>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	 Philippe Blain <levraiphilippeblain@gmail.com>,
	 Patrick Steinhardt <ps@pks.im>,
	Ben Knoble <ben.knoble@gmail.com>,
	 Vincent Mailhol <mailhol@kernel.org>
Subject: [PATCH v3 2/4] completion: complete 'git history --empty' values
Date: Thu, 13 Aug 2026 21:05:03 +0200	[thread overview]
Message-ID: <20260813-history_autocompletion-v3-2-69eed1cea93a@kernel.org> (raw)
In-Reply-To: <20260813-history_autocompletion-v3-0-69eed1cea93a@kernel.org>

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


  parent reply	other threads:[~2026-08-13 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 19:56 [PATCH] completion: add 'git history' subcommands Vincent Mailhol
2026-08-05  6:19 ` Patrick Steinhardt
2026-08-05 11:56   ` D. Ben Knoble
2026-08-05 16:15   ` Junio C Hamano
2026-08-05 21:20     ` Vincent Mailhol
2026-08-06  5:18       ` Patrick Steinhardt
2026-08-13 19:05 ` [PATCH v3 0/4] completion: add support for 'git history' Vincent Mailhol
2026-08-13 19:05   ` [PATCH v3 1/4] completion: add 'git history' subcommands Vincent Mailhol
2026-08-19 11:13     ` Patrick Steinhardt
2026-08-13 19:05   ` Vincent Mailhol [this message]
2026-08-19 11:13     ` [PATCH v3 2/4] completion: complete 'git history --empty' values Patrick Steinhardt
2026-08-13 19:05   ` [PATCH v3 3/4] completion: complete 'git history --update-refs' values Vincent Mailhol
2026-08-13 19:05   ` [PATCH v3 4/4] completion: complete 'git history split' pathspecs Vincent Mailhol
2026-08-13 20:30   ` [PATCH v3 0/4] completion: add support for 'git history' Kristoffer Haugsbakk
2026-08-14  6:25     ` Vincent Mailhol
2026-08-14  7:50       ` Kristoffer Haugsbakk
2026-08-19 11:13   ` Patrick Steinhardt
2026-08-19 20:18     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260813-history_autocompletion-v3-2-69eed1cea93a@kernel.org \
    --to=mailhol@kernel.org \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.