From 7b2d75904c8f93cbec40bdc3905ba81f48f84853 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 8 Mar 2009 15:29:27 -0400 Subject: Several improvements to how directories are chosen --- tools/pre-commit | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tools/pre-commit') 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 -- cgit v1.2.3