diff options
author | Colin Guthrie <colin@mageia.org> | 2013-06-13 00:13:26 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2013-06-13 00:13:26 +0100 |
commit | 1466c54b3cf08a8dd6790f1957fbd1a92fb1bf49 (patch) | |
tree | 150e3de7eedea0a141cf2e3a83ccac0b98b67e09 /scripts | |
parent | 5f8ff77b3ecd8af56fccbe30de00d7ca67306d97 (diff) | |
download | svn-git-migration-1466c54b3cf08a8dd6790f1957fbd1a92fb1bf49.tar svn-git-migration-1466c54b3cf08a8dd6790f1957fbd1a92fb1bf49.tar.gz svn-git-migration-1466c54b3cf08a8dd6790f1957fbd1a92fb1bf49.tar.bz2 svn-git-migration-1466c54b3cf08a8dd6790f1957fbd1a92fb1bf49.tar.xz svn-git-migration-1466c54b3cf08a8dd6790f1957fbd1a92fb1bf49.zip |
Whitespace
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mageia-reset-and-import.sh | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/scripts/mageia-reset-and-import.sh b/scripts/mageia-reset-and-import.sh index d2d8d9d..b7badc1 100755 --- a/scripts/mageia-reset-and-import.sh +++ b/scripts/mageia-reset-and-import.sh @@ -332,40 +332,40 @@ git branch -D origin/master 2>/dev/null declare -A tagmap tags=$(git for-each-ref --format='%(refname)' refs/heads/tags | cut -d / -f 4) for tag in $tags; do - ref="refs/heads/tags/$tag" - refsha1=$(git rev-parse "$ref") - reftreesha1=$(git rev-parse "$ref":) - - # Find the oldest ancestor for which the tree is the same - parentref="$ref" - while [ $(git rev-parse --quiet --verify "$parentref"^:) = "$reftreesha1" ]; do - parentref="$parentref"^ - done - parent=$(git rev-parse "$parentref") - - # If this ancestor is in master then we can just tag it - # otherwise the tag has diverged from master and it's actually more like a - # branch than a tag - merge=$(git merge-base master $parent) - if [ "$merge" = "$parent" ]; then - targetref=$parent - else - targetref=$refsha1 - fi + ref="refs/heads/tags/$tag" + refsha1=$(git rev-parse "$ref") + reftreesha1=$(git rev-parse "$ref":) + + # Find the oldest ancestor for which the tree is the same + parentref="$ref" + while [ $(git rev-parse --quiet --verify "$parentref"^:) = "$reftreesha1" ]; do + parentref="$parentref"^ + done + parent=$(git rev-parse "$parentref") + + # If this ancestor is in master then we can just tag it + # otherwise the tag has diverged from master and it's actually more like a + # branch than a tag + merge=$(git merge-base master $parent) + if [ "$merge" = "$parent" ]; then + targetref=$parent + else + targetref=$refsha1 + fi - tagmap[$refsha1]=$tag + tagmap[$refsha1]=$tag - # create an annotated tag based on the last commit in the tag, and delete the "branchy" ref for the tag - git show -s --pretty='format:%s%n%n%b' "$ref" | \ - env GIT_COMMITTER_NAME="$(git show -s --pretty='format:%an' "$ref")" \ - GIT_COMMITTER_EMAIL="$(git show -s --pretty='format:%ae' "$ref")" \ - GIT_COMMITTER_DATE="$(git show -s --pretty='format:%ad' "$ref")" \ - GIT_AUTHOR_NAME="$(git show -s --pretty='format:%an' "$ref")" \ - GIT_AUTHOR_EMAIL="$(git show -s --pretty='format:%ae' "$ref")" \ - GIT_AUTHOR_DATE="$(git show -s --pretty='format:%ad' "$ref")" \ - git tag -a -F - "$tag" "$targetref" + # create an annotated tag based on the last commit in the tag, and delete the "branchy" ref for the tag + git show -s --pretty='format:%s%n%n%b' "$ref" | \ + env GIT_COMMITTER_NAME="$(git show -s --pretty='format:%an' "$ref")" \ + GIT_COMMITTER_EMAIL="$(git show -s --pretty='format:%ae' "$ref")" \ + GIT_COMMITTER_DATE="$(git show -s --pretty='format:%ad' "$ref")" \ + GIT_AUTHOR_NAME="$(git show -s --pretty='format:%an' "$ref")" \ + GIT_AUTHOR_EMAIL="$(git show -s --pretty='format:%ae' "$ref")" \ + GIT_AUTHOR_DATE="$(git show -s --pretty='format:%ad' "$ref")" \ + git tag -a -F - "$tag" "$targetref" - git update-ref -d "$ref" + git update-ref -d "$ref" done git gc --aggressive |