]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
builder: rewrite code to checkout refs
authorKacper Kornet <draenog@pld-linux.org>
Thu, 23 Aug 2012 13:12:43 +0000 (14:12 +0100)
committerKacper Kornet <draenog@pld-linux.org>
Thu, 23 Aug 2012 13:48:29 +0000 (14:48 +0100)
git-checkout $CVSTAG can fail due to other reasons then non existing tag,
i.e. when the merge is in progress. In previous version in such a remote
tracking branch was tried to be check out, which resulted in error. It
prevented user from checking if his merge commits builds correctly
before commiting it.

builder.sh

index e61f014722c5ddb43324210f96ee6ee92e7cbd77..3284d4727f8ca02c9a111e86df327dd18a2999ec 100755 (executable)
@@ -785,6 +785,9 @@ Exit_error() {
                        remove_build_requires
                        echo >&2 "Error: problem with remote (${2})"
                        exit 13 ;;
+               "err_no_checkut" )
+                       echo >&2 "Error: cannot checkout $2"
+                       exit 14 ;;
                "err_not_implemented" )
                        remove_build_requires
                        echo >&2 "Error: functionality not yet imlemented"
@@ -947,7 +950,14 @@ get_spec() {
        fi
 
        if [ -n "$CVSTAG" ]; then
-               git checkout "$CVSTAG" -- 2>/dev/null || git checkout -t "${REMOTE_PLD}/$CVSTAG" > /dev/null || exit
+               if git rev-parse --verify -q "$CVSTAG"; then
+                       git checkout "$CVSTAG" --
+               elif git rev-parse --verify -q "refs/remotes/${REMOTE_PLD}/$CVSTAG"; then
+                       git checkout -t "refs/remotes/${REMOTE_PLD}/$CVSTAG" > /dev/null
+               fi
+               if [ $(git rev-parse "$CVSTAG") != $(git rev-parse HEAD) ]; then
+                       Exit_error "err_no_checkut" "$CVSTAG"
+               fi
                git symbolic-ref -q HEAD > /dev/null &&
                        git merge '@{u}'
                if [ -n "$CVSDATE" ]; then
This page took 0.038301 seconds and 4 git commands to generate.