From: Quy Tonthat <qtonthat@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] git-branch: deleting remote branches in new layout
Date: Mon, 18 Dec 2006 17:08:04 +1100 [thread overview]
Message-ID: <45863044.4040406@gmail.com> (raw)
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
next reply other threads:[~2006-12-18 6:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-18 6:08 Quy Tonthat [this message]
2006-12-18 7:08 ` [PATCH] git-branch: deleting remote branches in new layout 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45863044.4040406@gmail.com \
--to=qtonthat@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.