[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Small add-on for git_export
From: |
Yury Polyanskiy |
Subject: |
[Monotone-devel] Small add-on for git_export |
Date: |
Mon, 4 May 2009 02:33:16 -0400 |
Hello everyone!
I thought to contribute this smallish interactive script, which I use to
manually commit signed tags after "mtn git_export".
Note: if run as "tag-script auto" it will non-interactively recommit all
of the existing lightweight tags w/o changing names. Also, best use
with gpg-agent or the analog (e.g., seahorse in gnome).
#!/bin/sh
#
# iterates over all tags in the repo and readds them as tag-objects
#
# run as "tag-script auto" to automatically recommit lightweight tags as
tag-objects
AUTO_NAME=0
if [ "x$1" == "xauto" ]; then
AUTO_NAME=1
echo "Note: automatically recomitting tags"
fi
# give this environment variable a value if you have a broken repository with
null-names
DEFAULT_NAME=""
for CUR_TAG in `git tag`; do
TAG_TYPE=`git cat-file -t $CUR_TAG`
if [ "$TAG_TYPE" != "commit" ]; then
echo ">>> tag $CUR_TAG: points to objtype $TAG_TYPE, skipping "
continue;
fi
GIT_COMMITTER_NAME=`git log -1 --pretty=format:%cn $CUR_TAG`
GIT_COMMITTER_EMAIL=`git log -1 --pretty=format:%ce $CUR_TAG`
GIT_COMMITTER_DATE=`git log -1 --pretty=format:%ci $CUR_TAG`
commit_id=`git log -1 --pretty=format:%H $CUR_TAG`
# subject=`git log -1 --pretty=format:%b $CUR_TAG`
refnames=`git log -1 --pretty=format:%d $CUR_TAG`
if [ -z "$GIT_COMMITTER_NAME" ]; then
GIT_COMMITTER_NAME="$DEFAULT_NAME"
fi
export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
echo ""
echo ">>> tag $CUR_TAG -> commit $commit_id"
echo " commitref: $refnames"
# echo " subject : $subject"
echo " committer: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
echo " date : $GIT_COMMITTER_DATE"
if [ "$AUTO_NAME" == "1" ]; then
NEW_TAG="$CUR_TAG"
else
read -er -p " enter new tag name (enter to skip): " NEW_TAG
if [ -z "$NEW_TAG" ]; then
echo " skipping tag-object creation";
continue;
fi
fi
echo " committing new tag: git tag $NEW_TAG $commit_id"
git tag -s -m "" $NEW_TAG $commit_id
done
Best,
Yury
PS. Please CC me, I'm not currently on the list.
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-devel] Small add-on for git_export,
Yury Polyanskiy <=