]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
builder: skip checkout if already on the target branch
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 25 Oct 2020 11:16:50 +0000 (13:16 +0200)
committerElan Ruusamäe <glen@pld-linux.org>
Mon, 9 Nov 2020 13:21:07 +0000 (15:21 +0200)
this avoids poisoning git reflog with entries

builder.sh

index e903fc6dc1c3ab3aebf4cdbbf7400da4c68aae0a..7d11e10d605ec7c42749c5e861b081bc5f3b020a 100755 (executable)
@@ -1050,7 +1050,10 @@ get_spec() {
 
        if [ -n "$CVSTAG" ]; then
                if git rev-parse --verify -q "$CVSTAG" >/dev/null; then
-                       git checkout "$CVSTAG" --
+                       # checkout only if differs, so this will not trash git reflog
+                       if [ $(git rev-parse "$CVSTAG") != $(git rev-parse HEAD) ]; then
+                               git checkout "$CVSTAG" --
+                       fi
                elif git rev-parse --verify -q "refs/remotes/${REMOTE_PLD}/$CVSTAG"; then
                        git checkout -t "refs/remotes/${REMOTE_PLD}/$CVSTAG" > /dev/null
                fi
This page took 0.068656 seconds and 4 git commands to generate.