@matheusbsbs / matheus-bagliano / commits / 3b9dcff5df
Fork 0

builtin remote rm: remove symbolic refs, too

"git remote add" can add a symbolic ref "HEAD", and "rm" should delete it, too. Noticed by Teemu Likonen. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Mar 8, 2008 at 23:40 UTC 3b9dcff5df97ab642de48bc1ce781961686081aa
2 files changed +6
builtin-remote.c
+5
@@ -264,6 +264,11 @@ static int add_branch_for_removal(const char *refname,
264
265 if (!prefixcmp(refname, branches->prefix)) {
266 struct path_list_item *item;
267 +
268 + /* make sure that symrefs are deleted */
269 + if (flags & REF_ISSYMREF)
270 + return unlink(git_path(refname));
271 +
272 item = path_list_append(refname, branches->branches);
273 item->util = xmalloc(20);
274 hashcpy(item->util, sha1);
t/t5505-remote.sh
+1
@@ -80,6 +80,7 @@ test_expect_success 'add another remote' '
80 test_expect_success 'remove remote' '
81 (
82 cd test &&
83 + git symbolic-ref refs/remotes/second/HEAD refs/remotes/second/master &&
84 git remote rm second
85 )
86 '