Skip to content
Browse files

Fix detection of when a build is needed with better git fu

  • Loading branch information...
1 parent 6c43af5 commit 78e06d8e204ff08c2ef2c3c54adbe1dd7b34cc57 @mattjgalloway mattjgalloway committed with fpotter May 3, 2013
Showing with 9 additions and 3 deletions.
  1. +3 −1 build.sh
  2. +3 −1 build_needed.sh
  3. +3 −1 xctool.sh
View
4 build.sh
@@ -6,7 +6,9 @@ set -e
XCTOOL_DIR=$(cd $(dirname $0); pwd)
# Will be a short git hash or just '.' if we're not in a git repo.
-REVISION=$((git log -n 1 --format=%h "$XCTOOL_DIR" 2> /dev/null) || echo ".")
+REVISION=$((\
+ git --git-dir="${XCTOOL_DIR}/.git" log -n 1 --format=%h 2> /dev/null) || \
+ echo ".")
BUILD_OUTPUT_DIR="$XCTOOL_DIR"/build/$REVISION
XCTOOL_PATH="$BUILD_OUTPUT_DIR"/Products/Release/xctool
View
4 build_needed.sh
@@ -6,7 +6,9 @@ set -e
XCTOOL_DIR=$(cd $(dirname $0); pwd)
# Will be a short git hash or just '.' if we're not in a git repo.
-REVISION=$((git log -n 1 --format=%h "$XCTOOL_DIR" 2> /dev/null) || echo ".")
+REVISION=$((\
+ git --git-dir="${XCTOOL_DIR}/.git" log -n 1 --format=%h 2> /dev/null) || \
+ echo ".")
# If we're in a git repo, figure out if any changes have been made to xctool.
if [[ "$REVISION" != "." ]]; then
View
4 xctool.sh
@@ -43,6 +43,8 @@ if [ "$BUILD_NEEDED" -eq 1 ]; then
fi
# Will be a short git hash or just '.' if we're not in a git repo.
-REVISION=$((git log -n 1 --format=%h "$XCTOOL_DIR" 2> /dev/null) || echo ".")
+REVISION=$((\
+ git --git-dir="${XCTOOL_DIR}/.git" log -n 1 --format=%h 2> /dev/null) || \
+ echo ".")
"$XCTOOL_DIR"/build/$REVISION/Products/Release/xctool "$@"

0 comments on commit 78e06d8

Please sign in to comment.
Something went wrong with that request. Please try again.