diff mbox series

[3/3] branch: don't mix --edit-description

Message ID 1d0eebd1ecf24db0241801af31d904a19ad391a8.1592221875.git.liu.denton@gmail.com (mailing list archive)
State New, archived
Headers show
Series branch and t3200 cleanup | expand

Commit Message

Denton Liu June 15, 2020, 11:53 a.m. UTC
`git branch` accepts `--edit-description` in conjunction with other
arguments. However, `--edit-description` is its own mode, similar to
`--set-upstream-to`, which is also made mutually exclusive with other
modes. Prevent `--edit-description` from being mixed with other modes.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 builtin/branch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junio C Hamano June 17, 2020, 6:09 p.m. UTC | #1
Denton Liu <liu.denton@gmail.com> writes:

> `git branch` accepts `--edit-description` in conjunction with other
> arguments. However, `--edit-description` is its own mode, similar to
> `--set-upstream-to`, which is also made mutually exclusive with other
> modes. Prevent `--edit-description` from being mixed with other modes.

Makes sense.  Do we have some "these options are mutually exclusive"
test?

It makes me wonder if this can/should be switched to OPT_CMDMODE()
so that we do not have to write this if statement in the first
place.


> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
>  builtin/branch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index accb61b1aa..99633ad004 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -693,7 +693,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		list = 1;
>  
>  	if (!!delete + !!rename + !!copy + !!new_upstream + !!show_current +
> -	    list + unset_upstream > 1)
> +	    list + edit_description + unset_upstream > 1)
>  		usage_with_options(builtin_branch_usage, options);
>  
>  	if (filter.abbrev == -1)
diff mbox series

Patch

diff --git a/builtin/branch.c b/builtin/branch.c
index accb61b1aa..99633ad004 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -693,7 +693,7 @@  int cmd_branch(int argc, const char **argv, const char *prefix)
 		list = 1;
 
 	if (!!delete + !!rename + !!copy + !!new_upstream + !!show_current +
-	    list + unset_upstream > 1)
+	    list + edit_description + unset_upstream > 1)
 		usage_with_options(builtin_branch_usage, options);
 
 	if (filter.abbrev == -1)