File: revert_update_version.sh

package info (click to toggle)
ldapjdk 5.3.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,756 kB
  • sloc: ansic: 44,727; java: 39,706; xml: 7,623; sh: 4,497; perl: 3,774; makefile: 1,680; cpp: 979
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