[packages/rpm-build-tools] builder: rewrite code to checkout refs
draenog
draenog at pld-linux.org
Thu Aug 23 15:49:18 CEST 2012
commit 6217f40703a29f733a546091358749d912b639c4
Author: Kacper Kornet <draenog at pld-linux.org>
Date: Thu Aug 23 14:12:43 2012 +0100
builder: rewrite code to checkout refs
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 | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/builder.sh b/builder.sh
index e61f014..3284d47 100755
--- a/builder.sh
+++ b/builder.sh
@@ -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
More information about the pld-cvs-commit
mailing list