[gnome-initial-setup] maintainer-upload-release: Make tagging idempotent



commit 161d43e95893b77ef769cad81720f1175fef2b4c
Author: Will Thompson <will willthompson co uk>
Date:   Fri Sep 16 12:34:17 2022 +0100

    maintainer-upload-release: Make tagging idempotent
    
    While uploading the 43.0 release, the 'scp the tarball' stage failed.
    After I fixed the problem, running 'ninja maintainer-upload-release'
    again failed because the tag already existed.
    
    If the tag already exists, check it points to the expected commit.

 build-aux/maintainer-upload-release | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/build-aux/maintainer-upload-release b/build-aux/maintainer-upload-release
index 3893c5b8..2f1eaf1e 100755
--- a/build-aux/maintainer-upload-release
+++ b/build-aux/maintainer-upload-release
@@ -17,12 +17,17 @@ pushd "$MESON_SOURCE_ROOT"
         echo "Project version $project_version does not match branch $branch" >&2
         exit 1
     fi
-    if type git-evtag &>/dev/null; then
-        # Can't specify tag message on command line
-        # https://github.com/cgwalters/git-evtag/issues/9
-        EDITOR=true git evtag sign "$project_version"
+    if git show-ref --tags "$project_version" --quiet; then
+        # Tag already exists; verify that it points to HEAD
+        [ "$(git rev-parse "$project_version"^{})" = "$(git rev-parse HEAD)" ]
     else
-        git tag -s "$project_version" -m "Version $project_version"
+        if type git-evtag &>/dev/null; then
+            # Can't specify tag message on command line
+            # https://github.com/cgwalters/git-evtag/issues/9
+            EDITOR=true git evtag sign "$project_version"
+        else
+            git tag -s "$project_version" -m "Version $project_version"
+        fi
     fi
     git push --atomic origin "$branch" "$project_version"
 popd


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]