gbp_retag_commit.sh: fix a typo
[debian/scripts.git] / gbp_retag_commit.sh
index 371cecb..c333947 100755 (executable)
@@ -17,19 +17,22 @@ usage() {
 }
 
 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)"
+if [ "x$CHANGELOG_HEADER" = "x" ];
+then
+  echo "Check that the active branch is a debian branch" 1>&2
+  exit 1
+fi
 
-# TODO: give a warning or an error if this is is an UNRELEASED version?
+# TODO: give a warning or an error if this 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"
+# Use the same default values of gbp-buildpackage
+TAG="debian/$VERSION"
 TAG_MESSAGE="$PACKAGE Debian release $VERSION"
 
 # TODO: maybe drop the older $TAG if it exists?