summaryrefslogtreecommitdiff
path: root/tools/pre-commit
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-08 15:29:27 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-08 16:09:33 -0400
commit7b2d75904c8f93cbec40bdc3905ba81f48f84853 (patch)
tree66810cfc85ec4f27bea3e3ecab470aa49d13b38a /tools/pre-commit
parentdb70bb1d044a867cd517728fdf03a1b12f27bbc8 (diff)
downloadfork-ledger-7b2d75904c8f93cbec40bdc3905ba81f48f84853.tar.gz
fork-ledger-7b2d75904c8f93cbec40bdc3905ba81f48f84853.tar.bz2
fork-ledger-7b2d75904c8f93cbec40bdc3905ba81f48f84853.zip
Several improvements to how directories are chosen
Diffstat (limited to 'tools/pre-commit')
-rwxr-xr-xtools/pre-commit14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/pre-commit b/tools/pre-commit
index 3508958d..b04b895c 100755
--- a/tools/pre-commit
+++ b/tools/pre-commit
@@ -10,8 +10,18 @@ if [ $(git rev-parse --symbolic-full-name HEAD) = refs/heads/test ]; then
fi
# These are the locations I keep my temporary source and build trees in
-TMPDIR=$HOME/Products/ledger-pre-commit
-MIRROR=$HOME/Products/ledger-pre-commit-mirror
+OUTPUT=$(tools/outdir) # generates a build directory name such as
+ # ~/Products/ledger
+PRODUCTS=$(dirname "$OUTPUT")
+BASE=$(basename "$OUTPUT")
+
+if [ -z "$BASE" ]; then
+ TMPDIR=$PWD/pre-commit
+ MIRROR=$PWD/pre-commit-mirror
+else
+ TMPDIR=$PRODUCTS/$BASE-pre-commit
+ MIRROR=$PRODUCTS/$BASE-pre-commit-mirror
+fi
# Exit with status 1 if any command below fails
set -e