Re: [PATCH] branch: reject -D/-d without branch name

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] branch: reject -D/-d without branch name

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:55:53

Nguyễn Thái Ngọc Duy [off-list ref] writes:
quoted hunk
diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..1d3e842 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		colopts = 0;
 	}
 
-	if (delete)
+	if (delete && argc)
 		return delete_branches(argc, argv, delete > 1, kinds, quiet);
 	else if (list) {
 		int ret = print_ref_list(kinds, detached, verbose, abbrev,
Shouldn't this error out with a clean error message ("branch name
expected" or so)?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [PATCH] branch: reject -D/-d without branch name

From: Duy Nguyen <hidden>
Date: 2016-06-15 22:55:53

On Fri, Jan 25, 2013 at 3:45 PM, Matthieu Moy
[off-list ref] wrote:
Nguyễn Thái Ngọc Duy [off-list ref] writes:
quoted
diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..1d3e842 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
              colopts = 0;
      }

-     if (delete)
+     if (delete && argc)
              return delete_branches(argc, argv, delete > 1, kinds, quiet);
      else if (list) {
              int ret = print_ref_list(kinds, detached, verbose, abbrev,
Shouldn't this error out with a clean error message ("branch name
expected" or so)?
Yeah. But on the other hand, this command seems to prefer to print
help usage when incorrect number of arguments is given (checkout
blocks "if (edit_description)" and "if (rename)" in cmd_branch).
Should those be fixed too?
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help