[PATCH] builtin remote rm: remove symbolic refs, too

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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@xxxxxx>
---
 builtin-remote.c  |    5 +++++
 t/t5505-remote.sh |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/builtin-remote.c b/builtin-remote.c
index aa90cc9..f7653b6 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -267,6 +267,11 @@ static int add_branch_for_removal(const char *refname,
 
 	if (!prefixcmp(refname, branches->prefix)) {
 		struct path_list_item *item;
+
+		/* make sure that symrefs are deleted */
+		if (flags & REF_ISSYMREF)
+			return unlink(git_path(refname));
+
 		item = path_list_append(refname, branches->branches);
 		item->util = xmalloc(20);
 		hashcpy(item->util, sha1);
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index f45ea68..2822a65 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -80,6 +80,7 @@ test_expect_success 'add another remote' '
 test_expect_success 'remove remote' '
 (
 	cd test &&
+	git symbolic-ref refs/remotes/second/HEAD refs/remotes/second/master &&
 	git remote rm second
 )
 '
-- 
1.5.4.3.653.gbc310

--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux