From: ebiederm@xmission.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@osdl.org>
Cc: <git@vger.kernel.org>
Subject: [PATCH] git-revover-tags-script
Date: Sat, 16 Jul 2005 14:20:49 -0600 [thread overview]
Message-ID: <m1u0iuo63i.fsf@ebiederm.dsl.xmission.com> (raw)
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
next reply other threads:[~2005-07-16 20:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-16 20:20 Eric W. Biederman [this message]
2005-07-17 0:51 ` [PATCH] git-revover-tags-script 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1u0iuo63i.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).