git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] branch: Remove unnecessary verbose flag

From
K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Date
Dec 26, 2025, 03:28 UTC
Message-ID
<20251226032804.596058-1-jayatheerthkulkarni2005@gmail.com>
In-Reply-To
<xmqq1pkim1p6.fsf@gitster.g>

The --show-current option doesn't know how to handle verbose logic. In such a case, we want the program to die when both flags are used together.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
---
 builtin/branch.c  | 2 ++
 t/t3200-branch.sh | 4 ++++
 2 files changed, 6 insertions(+)
diff --git a/builtin/branch.c b/builtin/branch.c
index c577b5d20f..433c213dc0 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -860,6 +860,8 @@ int cmd_branch(int argc,
 		ret = delete_branches(argc, argv, delete > 1, filter.kind, quiet);
 		goto out;
 	} else if (show_current) {
+		if (filter.verbose)
+			die(_("options '%s' and '%s' cannot be used together"), "--show-current", "-v");
 		print_current_branch_name();
 		ret = 0;
 		goto out;
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index c58e505c43..5bb49de9c2 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -1716,4 +1716,8 @@ test_expect_success 'errors if given a bad branch name' '
 	test_cmp expect actual
 '
 
+test_expect_success 'git branch --show-current rejects -v' '
+	test_must_fail git branch --show-current -v
+'
+
 test_done
-- 
2.52.0
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 6 in “Why git branch --show-current ignores -v?”
  1. Sergey OrganovDec 25, 2025
  2. Junio C HamanoDec 26, 2025
  3. Junio C HamanoDec 26, 2025
  4. branch: Remove unnecessary verbose flagK Jayatheerth, Dec 26, 2025
  5. Junio C HamanoDec 26, 2025
  6. Sergey OrganovDec 26, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.