From acd0d41d0d2244293a5c1bbd7f9624d3dc998581 Mon Sep 17 00:00:00 2001 From: Kacper Kornet Date: Wed, 8 Aug 2012 18:34:58 +0100 Subject: [PATCH] Fix for initialized git repo without any config 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder.sh b/builder.sh index 35b070e..edd84a1 100755 --- a/builder.sh +++ b/builder.sh @@ -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 -- 2.44.0