]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
Fix for initialized git repo without any config
authorKacper Kornet <draenog@pld-linux.org>
Wed, 8 Aug 2012 17:34:58 +0000 (18:34 +0100)
committerKacper Kornet <draenog@pld-linux.org>
Wed, 8 Aug 2012 17:34:58 +0000 (18:34 +0100)
Previous version failed in the repo initialized by git init but before
the first commit was committed to it. The reason was that
git symbolic-ref HEAD returns refs/heads/master, however
git checkout-master failed. The solution is to check if HEAD points to a
real commit with git-rev-parse.

builder.sh

index 35b070e6a214abf185175002b49dd5a27f39a9b0..edd84a1ccd1b1b4562911568d171b2437babe420 100755 (executable)
@@ -796,7 +796,7 @@ init_builder() {
        export GIT_WORK_TREE=$PACKAGE_DIR
        export GIT_DIR=$PACKAGE_DIR/.git
 
-       if [ -d "$GIT_DIR" ] && [ -z "$CVSTAG" ]; then
+       if [ -d "$GIT_DIR" ] &&  [ -z "$CVSTAG" ] && git rev-parse --verify -q HEAD > /dev/null; then
                if CVSTAG=$(GIT_DIR=$GIT_DIR git symbolic-ref HEAD) 2>/dev/null; then
                        CVSTAG=${CVSTAG#refs/heads/}
                        if [ "$CVSTAG" != "master" ]; then
This page took 0.031071 seconds and 4 git commands to generate.