aboutsummaryrefslogtreecommitdiff
path: root/t/t7003-filter-branch.sh
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2008-08-21 16:45:11 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-21 23:39:13 -0700
commita9da1663dfc869141749c768e9e0f52bb48218e3 (patch)
tree5e283122f98ba71812f09d7cc297e02a3ea52e05 /t/t7003-filter-branch.sh
parent5a4a088add3bdcbe86ae7e87964ce4025ddbc389 (diff)
downloadgit-a9da1663dfc869141749c768e9e0f52bb48218e3.tar.gz
git-a9da1663dfc869141749c768e9e0f52bb48218e3.tar.xz
filter-branch: Grok special characters in tag names
The tag rewriting code used a 'sed' expression to substitute the new tag name into the corresponding field of the annotated tag object. But this is problematic if the tag name contains special characters. In particular, if the tag name contained a slash, then the 'sed' expression had a syntax error. We now protect against this by using 'printf' to assemble the tag header. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7003-filter-branch.sh')
-rwxr-xr-xt/t7003-filter-branch.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index a0ab096c8..f92d414e6 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -250,4 +250,12 @@ test_expect_success 'Tag name filtering strips gpg signature' '
test_cmp expect actual
'
+test_expect_success 'Tag name filtering allows slashes in tag names' '
+ git tag -m tag-with-slash X/1 &&
+ git cat-file tag X/1 | sed -e s,X/1,X/2, > expect &&
+ git filter-branch -f --tag-name-filter "echo X/2" &&
+ git cat-file tag X/2 > actual &&
+ test_cmp expect actual
+'
+
test_done