diff options
author | Thomas Haller <thaller@redhat.com> | 2020-10-05 18:14:50 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-10-05 19:35:04 +0200 |
commit | 5e83bac5aa9fd0088269780b2ad0ecbac2e94319 (patch) | |
tree | fcd94b8bdf640ddad640001d3e01277b24a5d9fd /contrib | |
parent | a74cb152f2fcf1d9521676c0855f8dc920a8706d (diff) |
contrib/release: restore original branch in dry-run mode
In dry-run mode, reset the branch to the state where it was before.
Also, in real mode delete the temporary "release-branch" branch on
success.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/fedora/rpm/release.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/fedora/rpm/release.sh b/contrib/fedora/rpm/release.sh index e049ecbe8c..baec7665fd 100755 --- a/contrib/fedora/rpm/release.sh +++ b/contrib/fedora/rpm/release.sh @@ -207,6 +207,7 @@ TMP="$(LANG=C git clean -ndx)" || die "git clean -ndx failed" test -z "$TMP" || die "git working directory is not clean? (git clean -ndx)" CUR_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +CUR_HEAD="$(git rev-parse HEAD)" TMP_BRANCH=release-branch if [ "$CUR_BRANCH" = master ]; then @@ -476,7 +477,12 @@ for r in "${RELEASE_FILES[@]}"; do do_command ssh master.gnome.org ftpadmin install --unattended "$r" || die "ftpadmin install failed" done +CLEANUP_CHECKOUT_BRANCH= if [ "$DRY_RUN" = 0 ]; then CLEANUP_REFS=() - CLEANUP_CHECKOUT_BRANCH= + git branch -D "$TMP_BRANCH" +else + H="$(git rev-parse "$CUR_BRANCH")" + git checkout -B "$CUR_BRANCH" "$CUR_HEAD" || die "cannot reset $CUR_BRANCH to $CUR_HEAD" + echo "delete reference. Restore with $(echo_color 36 -n git checkout -B "\"$CUR_BRANCH\"" "$H")" fi |