git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-revover-tags-script
@ 2005-07-16 20:20 Eric W. Biederman
  2005-07-17  0:51 ` Junio C Hamano
  2005-07-20  0:20 ` [RFD] server-info to help clients Junio C Hamano
  0 siblings, 2 replies; 12+ messages in thread
From: Eric W. Biederman @ 2005-07-16 20:20 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git


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 <ebiederm@xmission.com>
---

 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-07-20  1:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-16 20:20 [PATCH] git-revover-tags-script Eric W. Biederman
2005-07-17  0:51 ` Junio C Hamano
2005-07-17  8:40   ` Eric W. Biederman
2005-07-17 18:53     ` Junio C Hamano
2005-07-18  0:06       ` Eric W. Biederman
2005-07-18  1:13         ` Junio C Hamano
2005-07-18  5:40           ` Eric W. Biederman
2005-07-18  6:36             ` Junio C Hamano
2005-07-18  0:19       ` Eric W. Biederman
2005-07-20  0:20 ` [RFD] server-info to help clients Junio C Hamano
2005-07-20  0:35   ` David Lang
2005-07-20  1:53     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).