First pass at a script to dig through .git/objects and find dangling tags. It likely has a lot of weird limitations, I don't know if it will work with packs, and the policy it implments is pretty stupid, but it is a sane start and should keep people from needing to rsync anything except the .git/objects part of the tree.
The current policy is if a tag's gpg signature can be verified and if the tag name does not conflict with an existing tag place it in .git/refs/tags/. So far this only works with dangling tags so I don't know if these tags will even be pulled with the pack methods. But since we aren't quite going at full speed on those yet we should be good. Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]> --- Makefile | 3 ++- git-recover-tags-script | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletions(-) create mode 100755 git-recover-tags-script 4b171e71fd6b5de56dd4a93ea203e49115c2caee diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -36,7 +36,8 @@ SCRIPTS=git git-apply-patch-script git-m git-reset-script git-add-script git-checkout-script git-clone-script \ gitk git-cherry git-rebase-script git-relink-script git-repack-script \ git-format-patch-script git-sh-setup-script git-push-script \ - git-branch-script git-parse-remote git-verify-tag-script + git-branch-script git-parse-remote git-verify-tag-script \ + git-recover-tags-script PROG= git-update-cache git-diff-files git-init-db git-write-tree \ git-read-tree git-commit-tree git-cat-file git-fsck-cache \ diff --git a/git-recover-tags-script b/git-recover-tags-script new file mode 100755 --- /dev/null +++ b/git-recover-tags-script @@ -0,0 +1,27 @@ +#!/bin/sh +# Copyright (c) 2005 Eric Biederman + +. git-sh-setup-script || die "Not a git archive" + +TMP_TAG=".tmp-tag.$$" +git-fsck-cache | +while read status type sha1 rest ; do + if [ '(' "$status" == "dangling" ')' -a '(' "$type" == "tag" ')' ] ; then + if ! git-verify-tag-script $sha1 ; then + echo "Could not verify tag $sha1" + else + tag=$(git-cat-file tag $sha1 | sed -ne 's/^tag //p') + tagger=$(git-cat-file tag $sha1 | sed -ne 's/^tagger //p') + if [ ! -e $GIT_DIR/refs/tags/$tag ]; then + echo "installing tag $tag tagger $tagger" + mkdir -p $GIT_DIR/refs/tags + echo "$sha1" > $GIT_DIR/refs/tags/$tag + fi + fi + else + if [ "$status" != "dangling" ] ; then + echo "$status $type $sha1 $rest"; + fi + fi +done +rm -f $TMP_TAG - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html