Permalink
Browse files

Significantly speed up hack/ship by more efficiently detecting a git-…

…svn repo.
  • Loading branch information...
1 parent 32e0384 commit ab5784ceb46b56375e320551681bf6eb4b7c0933 Brian Donovan committed Feb 28, 2011
Showing with 6 additions and 6 deletions.
  1. +4 −4 bin/hack
  2. +2 −2 bin/ship
View
8 bin/hack
@@ -2,6 +2,7 @@
CURRENT=$(git symbolic-ref -q HEAD || git rev-parse HEAD)
CURRENT=${CURRENT#refs/heads/}
+gitdir=$(git rev-parse --git-dir)
# default settings
explain=false
@@ -77,8 +78,8 @@ git() {
}
no_changes () {
- $GIT diff-index --quiet --cached HEAD -- &&
- $GIT diff-files --quiet
+ $GIT diff-index --quiet --cached HEAD -- &&
+ $GIT diff-files --quiet
}
check_stash() {
@@ -123,8 +124,7 @@ if [ "$CURRENT" != "$TRACK_BRANCH" ]; then
die "Could not switch to $TRACK_BRANCH. Nothing has been changed yet."
fi
-$GIT svn info >/dev/null 2>/dev/null
-if [ $? = 0 ]; then
+if [ -d "$gitdir/svn" ]; then
TYPE="git-svn"
else
TYPE="git"
View
4 bin/ship
@@ -2,6 +2,7 @@
CURRENT=$(git symbolic-ref -q HEAD || git rev-parse HEAD)
CURRENT=${CURRENT#refs/heads/}
+gitdir=$(git rev-parse --git-dir)
# default settings
explaining=false
@@ -105,8 +106,7 @@ if [ "$CURRENT" != "$TRACK_BRANCH" ]; then
die "Could not switch to $TRACK_BRANCH. Nothing has been changed yet."
fi
-$GIT svn info >/dev/null 2>/dev/null
-if [ $? = 0 ]; then
+if [ -d "$gitdir/svn" ]; then
TYPE="git-svn"
else
TYPE="git"

0 comments on commit ab5784c

Please sign in to comment.