All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-branch: deleting remote branches in new layout
@ 2006-12-18  6:08 Quy Tonthat
  2006-12-18  7:08 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Quy Tonthat @ 2006-12-18  6:08 UTC (permalink / raw)
  To: git

Now that remote branches are in refs/remotes/, branch -D needs to know
where to find them.

Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
---
 builtin-branch.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index 560309c..b2f0aae 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -95,6 +95,8 @@ static void delete_branches(int argc, const char **argv, int force)
 	unsigned char sha1[20];
 	char *name;
 	int i;
+	char ** s;
+	static char * branches_dir[] = {"refs/heads", "refs/remotes", NULL};
 
 	if (!force) {
 		head_rev = lookup_commit_reference(head_sha1);
@@ -105,8 +107,12 @@ static void delete_branches(int argc, const char **argv, int force)
 		if (!strcmp(head, argv[i]))
 			die("Cannot delete the branch you are currently on.");
 
-		name = xstrdup(mkpath("refs/heads/%s", argv[i]));
-		if (!resolve_ref(name, sha1, 1, NULL))
+		for (s = branches_dir; *s != NULL; s++) {
+			name = xstrdup(mkpath("%s/%s", *s, argv[i]));
+			if (resolve_ref(name, sha1, 1, NULL))
+				break;
+		}
+		if (*s == NULL)
 			die("Branch '%s' not found.", argv[i]);
 
 		rev = lookup_commit_reference(sha1);
-- 
1.4.4.1.GIT

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

end of thread, other threads:[~2006-12-18 22:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-18  6:08 [PATCH] git-branch: deleting remote branches in new layout Quy Tonthat
2006-12-18  7:08 ` Junio C Hamano
2006-12-18  7:49   ` Junio C Hamano
2006-12-18 10:02     ` Quy Tonthat
2006-12-18 13:39     ` [PATCH] (Take 2) " Quy Tonthat
2006-12-18 22:42     ` [PATCH] (Take 3) " Quy Tonthat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.