[packages/rpm-build-tools] Fix for initialized git repo without any config
draenog
draenog at pld-linux.org
Wed Aug 8 19:40:41 CEST 2012
commit acd0d41d0d2244293a5c1bbd7f9624d3dc998581
Author: Kacper Kornet <draenog at pld-linux.org>
Date: Wed Aug 8 18:34:58 2012 +0100
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
More information about the pld-cvs-commit
mailing list