]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
Fix test if build is from correct branch with shallow fetch
authorKacper Kornet <draenog@pld-linux.org>
Thu, 12 May 2011 14:28:54 +0000 (15:28 +0100)
committerKacper Kornet <draenog@pld-linux.org>
Thu, 12 May 2011 14:53:04 +0000 (15:53 +0100)
In case of shallow fetch, there is no local information about all remote
branches. Therefore the test if build is from correct branch, should use
git ls-remote in this case.

builder.sh

index 06212cc0cf5633f291c104003d2754bccbc4c8e6..f5abfb8c57c14f4536e161fb1de7b359d68ccacc 100755 (executable)
@@ -2405,7 +2405,14 @@ case "$COMMAND" in
                        TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
                        if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
                                TAG_BRANCH="${TREE_PREFIX}-branch"
-                               TAG_STATUS=$(git show-ref | grep -i "${REMOTE_PLD}/$TAG_BRANCH$")
+                               if [ -n "$DEPTH" ]; then
+                                       cmd_branches="git ls-remote --heads"
+                                       ref_prefix=refs/heads
+                               else
+                                       cmd_branches="git show-ref"
+                                       ref_prefix=refs/remotes/${REMOTE_PLD}
+                               fi
+                               TAG_STATUS=$($cmd_branches | grep -i "${ref_prefix}/$TAG_BRANCH$")
                                if [ -n "$TAG_STATUS" -a "$TAG_STATUS" != "$CVSTAG" ]; then
                                        Exit_error err_branch_exists "$TAG_STATUS"
                                fi
This page took 0.043791 seconds and 4 git commands to generate.