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

[PATCH 1/4] branch: '--edit-description' is incompatible with other options

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jan 1, 2018, 22:54 UTC
Message-ID
<20180101225448.2561-2-szeder.dev@gmail.com>
In-Reply-To
<20180101225448.2561-1-szeder.dev@gmail.com>

'--edit-description' is incompatible with 'git branch's other options, but the check for conflicting options doesn't look for this option. As a result 'git branch' doesn't error out showing usage when '--edit-description' is used in combination with other options, but e.g. 'git branch --list --edit-description' lists all branches and doesn't edit any branch descriptions, while 'git branch --edit-description --list' edits the current branch's description but doesn't list the branches.

Look for '--edit-description', too, when looking for conflicting options.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 builtin/branch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 8dcc2ed05..32531aa44 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -662,7 +662,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		list = 1;
 
 	if (!!delete + !!rename + !!copy + !!new_upstream +
-	    list + unset_upstream > 1)
+	    list + unset_upstream + edit_description > 1)
 		usage_with_options(builtin_branch_usage, options);
 
 	if (filter.abbrev == -1)
-- 
2.16.0.rc0.67.g3a46dbca7
Previous: SZEDER Gábor
Message 10 of 10 in “branch: add '--show-description' option”
  1. 0/4 branch: add '--show-description' optionSZEDER Gábor, Jan 1, 2018
  2. 2/4 t3200: fix a misindented lineSZEDER Gábor, Jan 1, 2018
  3. 4/4 branch: add '--show-description' optionSZEDER Gábor, Jan 1, 2018
  4. Eric SunshineJan 2, 2018
  5. SZEDER GáborJan 2, 2018
  6. Johannes SixtJan 2, 2018
  7. SZEDER GáborJan 2, 2018
  8. SZEDER GáborJan 2, 2018
  9. 3/4 t3200: restore branch after "unborn --edit-description" testSZEDER Gábor, Jan 1, 2018
  10. 1/4 branch: '--edit-description' is incompatible with other optionsSZEDER Gábor, Jan 1, 2018

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.