From: Michael Haggerty Date: Sat, 18 Jun 2016 04:15:11 +0000 (+0200) Subject: remote rm: handle symbolic refs correctly X-Git-Tag: v2.10.0-rc0~96^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29a7cf96441241a291edca8136ab3cc80201e7ee;p=thirdparty%2Fgit.git remote rm: handle symbolic refs correctly In the modern world of reference backends, it is not OK to delete a symref by unlink()ing the file directly. This must be done via the refs API. We do so by adding the symref to the list of references to delete along with the non-symbolic references, then calling delete_refs() with the new flags option set to REF_NODEREF. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- diff --git a/builtin/remote.c b/builtin/remote.c index 1bbf9b44df..c4b4d674bd 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -539,10 +539,6 @@ static int add_branch_for_removal(const char *refname, return 0; } - /* make sure that symrefs are deleted */ - if (flags & REF_ISSYMREF) - return unlink(git_path("%s", refname)); - string_list_append(branches->branches, refname); return 0; @@ -788,7 +784,7 @@ static int rm(int argc, const char **argv) strbuf_release(&buf); if (!result) - result = delete_refs(&branches, 0); + result = delete_refs(&branches, REF_NODEREF); string_list_clear(&branches, 0); if (skipped.nr) {