threads / discuss / 32483

git filter-branch doesn't dereference annotated tags

Subject: git filter-branch doesn't dereference annotated tags

## tl;dr

One message between Dec 31, 2012 and Dec 31, 2012.

replies: 0people: 1as markdown or json

Grégory Pakosz· Dec 31, 2012, 14:36 UTC · lore
Hello,

I noticed git-filter-branch doesn't dereference annotated tags prior to invoking git update-ref -d.

Please find a patch attached that changes the call to git update-ref:

-git update-ref -m "filter-branch: delete" -d "$ref" $sha1 +git update-ref -m "filter-branch: delete" -d $(git rev-parse --verify "$ref^{commit}") $sha1

Regards, Gregory

From cee5462f26bbb280f471ba1220398924bfd4bfd7 Mon Sep 17 00:00:00 2001
From: Gregory Pakosz <gpakosz@visionobjects.com>
Date: Mon, 31 Dec 2012 15:30:36 +0100
Subject: [PATCH] git-filter-branch: Dereference annotated tags upon deletion
git-filter-branch didn't dereference annotated tags upon deletion which made
git-update-ref -d unhappy.
---
 git-filter-branch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 5314249..773a91b 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -383,7 +383,7 @@ do
 	case "$rewritten" in
 	'')
 		echo "Ref '$ref' was deleted"
-		git update-ref -m "filter-branch: delete" -d "$ref" $sha1 ||
+		git update-ref -m "filter-branch: delete" -d $(git rev-parse --verify "$ref^{commit}") $sha1 ||
 			die "Could not delete $ref"
 	;;
 	$_x40)
-- 
1.8.0.1

← back to recent threads