~ chicken-core (chicken-5) 66af4494896e27a174896423667fcfe32456ec6f
commit 66af4494896e27a174896423667fcfe32456ec6f
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Jan 7 14:49:11 2010 +0100
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Thu Jan 7 14:49:11 2010 +0100
tweaks to identify-branch
diff --git a/defaults.make b/defaults.make
index 86b7c38b..bd9acd75 100644
--- a/defaults.make
+++ b/defaults.make
@@ -70,7 +70,7 @@ IDOCDIR = $(IDATADIR)$(SEP)doc
ICHICKENLIBDIR = $(ILIBDIR)$(SEP)chicken
IEGGDIR = $(ICHICKENLIBDIR)$(SEP)$(BINARYVERSION)
else
-BRANCHNAME = $(shell scripts/identify-branch)
+BRANCHNAME = $(shell scripts/identify-branch $(SRCDIR))
SPREFIX = $(PREFIX)
IBINDIR = $(BINDIR)
ILIBDIR = $(LIBDIR)
diff --git a/scripts/README b/scripts/README
index 33318671..4833284c 100644
--- a/scripts/README
+++ b/scripts/README
@@ -39,3 +39,8 @@ This directory contains a couple of things that might be useful:
takes a path to a local checkout of the extensions repository
and compiles each egg from scratch, reporting success or
failure.
+
+ identify-branch
+
+ Obtains the branchname, if this is a git(1) checkout, otherwise
+ does nothing.
diff --git a/scripts/identify-branch b/scripts/identify-branch
index 65afbf5b..24033ee0 100755
--- a/scripts/identify-branch
+++ b/scripts/identify-branch
@@ -1,10 +1,14 @@
#!/bin/sh
#
# identify-branch - check for .git directory and obtain branchname (unless "master")
+#
+# usage: identify-branch SOURCEDIR
-if test -d .git; then
- branchname=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'`
- if test "${branchname}" \!= "(master)"; then
- echo "${branchname}"
- fi
+if test -d "$1/.git"; then
+ branchname=`GIT_DIR="$1/.git" git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'`
+ case ${branchname} in
+ "") ;;
+ "(master)") ;;
+ *) echo "${branchname}";;
+ esac
fi
Trap