File: revert_update_version.sh

package info (click to toggle)
ldapjdk 5.5.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,664 kB
  • sloc: java: 39,720; sh: 606; xml: 563; makefile: 26
file content (19 lines) | stat: -rwxr-xr-x 516 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash -e

# Use this script to revert the commit and delete the tag created using the update_version.sh script.

HEAD_TAG=$(git tag --points-at HEAD)

HEAD_COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
UPDATE_COMMIT_MESSAGE="Updating version to"

# Only proceed if the HEAD commit is a version update

if [[ "$HEAD_COMMIT_MESSAGE=" == *"$UPDATE_COMMIT_MESSAGE"* ]]; then
    git tag -d "$HEAD_TAG"
    git reset --hard HEAD~1
else
    echo "The HEAD commit is not a version update, aborting."
    exit 1
fi