aboutsummaryrefslogtreecommitdiffstats
path: root/git-svn-fix-tags.sh
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2013-08-21 12:59:52 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-03-01 01:23:53 +0100
commit2769e5827d62a2d17c2fa7a0e14e461b6fddfda1 (patch)
treeef5491d5d0c930c3efefa1d7836a8cafcbfeb069 /git-svn-fix-tags.sh
parentc359fd903f928ea2f3e204a9df34eb26f3daa36b (diff)
downloadhlupak-2769e5827d62a2d17c2fa7a0e14e461b6fddfda1.tar.gz
feat(git-svn-fix-tags): Fix tags in git svn converted repo.
It is supposed that git svn clone had -s --prefix="svn/" set.
Diffstat (limited to 'git-svn-fix-tags.sh')
-rwxr-xr-xgit-svn-fix-tags.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-svn-fix-tags.sh b/git-svn-fix-tags.sh
new file mode 100755
index 0000000..2af9f14
--- /dev/null
+++ b/git-svn-fix-tags.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+reponame=$(git config svn-remote.svn.url|tr '/' '\n'|tail -n1)
+
+git for-each-ref refs/remotes/svn/tags | cut -d / -f 5- \
+ | while read oldref
+ do
+ ref=$(echo $oldref|sed -e "s/$reponame-*//")
+ echo "Converting branch $oldref to tag ${ref}."
+ git tag -a "$ref" -m"say farewell to SVN" \
+ "refs/remotes/svn/tags/$oldref" && \
+ git branch -r -d "svn/tags/$oldref" >/dev/null 2>&1
+ done