Now that remote branches are in refs/remotes/, branch -D needs to know where to find them. Signed-off-by: Quy Tonthat <qtonthat@xxxxxxxxx> --- 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html