Skip to content

Commit 640d040

Browse files
pcloudsgitster
authored andcommitted
branch: reject -D/-d without branch name
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 50a6b54 commit 640d040

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

builtin/branch.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
837837
colopts = 0;
838838
}
839839

840-
if (delete)
840+
if (delete) {
841+
if (!argc)
842+
die(_("branch name required"));
841843
return delete_branches(argc, argv, delete > 1, kinds, quiet);
842-
else if (list) {
844+
} else if (list) {
843845
int ret = print_ref_list(kinds, detached, verbose, abbrev,
844846
with_commit, argv);
845847
print_columns(&output, colopts, NULL);

0 commit comments

Comments
 (0)