git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] branch: die explicitly why when calling "git branch [-a|-r] branchname".
@ 2009-12-30 14:45 Matthieu Moy
  2009-12-31 23:09 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Moy @ 2009-12-30 14:45 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

The -a and -r options used to be silently ignored in such a command.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 builtin-branch.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index c87e63b..8aef2bb 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -638,10 +638,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		rename_branch(head, argv[0], rename > 1);
 	else if (rename && (argc == 2))
 		rename_branch(argv[0], argv[1], rename > 1);
-	else if (argc <= 2)
+	else if (argc <= 2) {
+		if (kinds != REF_LOCAL_BRANCH) {
+			die("-a and -r options to 'git branch' do not make sense with a branch name");
+		}
 		create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
 			      force_create, reflog, track);
-	else
+	} else
 		usage_with_options(builtin_branch_usage, options);
 
 	return 0;
-- 
1.6.6.71.gcc720.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] branch: die explicitly why when calling "git branch [-a|-r] branchname".
  2009-12-30 14:45 [PATCH] branch: die explicitly why when calling "git branch [-a|-r] branchname" Matthieu Moy
@ 2009-12-31 23:09 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-12-31 23:09 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git

Thanks; will apply to 'maint', together with the SubmittingPatches
addition.

Interestingly, this revealed a long-standing breakage in t5403.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-31 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30 14:45 [PATCH] branch: die explicitly why when calling "git branch [-a|-r] branchname" Matthieu Moy
2009-12-31 23:09 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).