git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin-branch - allow deleting a fully specified branch-name
@ 2009-04-10  0:28 Mark Levedahl
  2009-04-10  0:39 ` Junio C Hamano
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Levedahl @ 2009-04-10  0:28 UTC (permalink / raw)
  To: git; +Cc: Mark Levedahl

This change allows, for instance
	git branch -d refs/heads/foo
to succeed. Without this patch, the code just assumes that the
given branch name should be appended to "refs/heads" or
"refs/remotes", thus attempting (and failing) in the above case
to delete "refs/heads/refs/heads/foo"

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 builtin-branch.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index ca81d72..f433bc5 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -131,7 +131,11 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
 		free(name);
 
-		name = xstrdup(mkpath(fmt, bname.buf));
+		if (bname.len < 5 || memcmp("refs/", bname.buf, 5))
+			name = xstrdup(mkpath(fmt, bname.buf));
+		else
+			name = xstrdup(bname.buf);
+
 		if (!resolve_ref(name, sha1, 1, NULL)) {
 			error("%sbranch '%s' not found.",
 					remote, bname.buf);
-- 
1.6.2.2.27.g034b

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

end of thread, other threads:[~2009-04-15 18:02 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10  0:28 [PATCH] builtin-branch - allow deleting a fully specified branch-name Mark Levedahl
2009-04-10  0:39 ` Junio C Hamano
2009-04-10  1:19   ` Mark Levedahl
2009-04-10  3:18     ` Junio C Hamano
2009-04-11 17:01       ` Mark Levedahl
2009-04-12  7:20         ` Jeff King
2009-04-12  8:22           ` Junio C Hamano
2009-04-13  8:56             ` Jeff King
2009-04-13  9:54               ` Junio C Hamano
2009-04-13 11:09                 ` Jeff King
2009-04-13 11:11                   ` [PATCH 1/5] doc: clarify --no-track option Jeff King
2009-04-13 11:11                   ` [PATCH 2/5] doc: refer to tracking configuration as "upstream" Jeff King
2009-04-13 11:18                   ` [PATCH 3/5] doc/checkout: refer to git-branch(1) as appropriate Jeff King
2009-04-13 11:19                   ` [PATCH 4/5] doc/checkout: split checkout and branch creation in synopsis Jeff King
     [not found]                     ` <fabb9a1e0904130613g5b664706jb6a3c29107ac1fc9@mail.gmail.com>
2009-04-13 13:19                       ` Jeff King
2009-04-13 13:21                         ` Sverre Rabbelier
2009-04-13 11:21                   ` [PATCH 5/5] docs/checkout: clarify what "non-branch" means Jeff King
2009-04-13 16:31                     ` Junio C Hamano
2009-04-14  3:40                       ` Mark Levedahl
2009-04-14  4:20                         ` Junio C Hamano
2009-04-14 11:36                         ` Jakub Narebski
2009-04-15 18:00                           ` Jeff King
2009-04-15 17:58                       ` Jeff King
2009-04-13 10:57               ` [PATCH] builtin-branch - allow deleting a fully specified branch-name Jeff King

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).