From 85018e2e96c6bf22dbbf588f2aa43386c96b22ce Mon Sep 17 00:00:00 2001 From: Abner Silva Date: Fri, 18 Oct 2013 14:42:41 -0300 Subject: commit-repo-tag: Checking if there's something new to commit. --- commit-repo-tag.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/commit-repo-tag.sh b/commit-repo-tag.sh index 4ac52c6..79510ab 100755 --- a/commit-repo-tag.sh +++ b/commit-repo-tag.sh @@ -62,22 +62,26 @@ rm -fr $TMP_M_FILENAME TMP_C_FILENAME=`mktemp --suffix=.msg` # Store changes for commiting -git diff $MANIFEST_FILENAME > $TMP_C_FILENAME +git diff --exit-code $MANIFEST_FILENAME > $TMP_C_FILENAME -# Commit new manifest file -git commit -F $TMP_C_FILENAME -- $MANIFEST_FILENAME || true +# Check if there's something new to commit +if [ $? = 1 ]; +then + # Commit new manifest file + git commit -F $TMP_C_FILENAME -- $MANIFEST_FILENAME || true -echo "Tagging manifest for storaging." + echo "Tagging manifest for storaging." -# Tag the new manifest version -CUR_DATE=`date +%Y%m%d` -git tag -a "build_$CUR_DATE-$BUILD_NUMBER" \ - -m "Tagging manifest build $BUILD_NUMBER on $CURDATE" + # Tag the new manifest version + CUR_DATE=`date +%Y%m%d` + git tag -a "build_$CUR_DATE-$BUILD_NUMBER" \ + -m "Tagging manifest build $BUILD_NUMBER on $CURDATE" -echo "Pushing new manifest to the branch $BUILD_BRANCH" + echo "Pushing new manifest to the branch $BUILD_BRANCH" -# Push new manifest to the build branch -git push origin $BUILD_BRANCH + # Push new manifest to the build branch + git push --tags origin $BUILD_BRANCH +fi # Remove temporary file rm -fr $TMP_C_FILENAME -- cgit v1.2.3