From 263aea1d33050c6013efccc64d4627769ca00c10 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 18 Nov 2015 15:04:04 +0100 Subject: [PATCH] Initial import --- gbp_retag_commit.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 gbp_retag_commit.sh diff --git a/gbp_retag_commit.sh b/gbp_retag_commit.sh new file mode 100755 index 0000000..371cecb --- /dev/null +++ b/gbp_retag_commit.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# gbp_retag_commit - retag a revision of a debian package, gbp style +# +# Copyright (C) 2015 Antonio Ospite +# +# This program is free software. It comes without any warranty, to +# the extent permitted by applicable law. You can redistribute it +# and/or modify it under the terms of the Do What The Fuck You Want +# To Public License, Version 2, as published by Sam Hocevar. See +# http://sam.zoy.org/wtfpl/COPYING for more details. + +set -e + +usage() { + echo "usage: $(basename $0) "; +} + +HASH="$1" + +git cat-file -e "${HASH}^{commit}" || { usage 1>&2; exit 1; } + +BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" + +CHANGELOG_HEADER="$(git show $HASH:debian/changelog | head -1)" + +# TODO: give a warning or an error if this is is an UNRELEASED version? + +PACKAGE=$(echo "$CHANGELOG_HEADER" | cut -d ' ' -f 1) +VERSION=$(echo "$CHANGELOG_HEADER" | cut -d '(' -f 2 | cut -d ')' -f 1 ) + +TAG="$BRANCH_NAME/$VERSION" +TAG_MESSAGE="$PACKAGE Debian release $VERSION" + +# TODO: maybe drop the older $TAG if it exists? + +GIT_COMMITTER_DATE="$(git show --format=%aD $HASH | head -1)" \ + git tag -a "$TAG" $HASH -m "$TAG_MESSAGE" -- 2.1.4