summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-02 08:17:41 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-02 08:17:41 +0100
commit0f6d455410f67ca072a9cde61c744b5ce65973a6 (patch)
treef462c9e29aee9fe8eb7f94a87e6fad97a044239c
parente68463b2ff26100336c35f11baf69e5f574a7f80 (diff)
downloadndim-git-utils-0f6d455410f67ca072a9cde61c744b5ce65973a6.tar.gz
ndim-git-utils-0f6d455410f67ca072a9cde61c744b5ce65973a6.tar.xz
ndim-git-utils-0f6d455410f67ca072a9cde61c744b5ce65973a6.zip
Improve handling of branch params, manpage
-rwxr-xr-xsrc/git-amb32
-rw-r--r--src/git-amb.1.in88
2 files changed, 80 insertions, 40 deletions
diff --git a/src/git-amb b/src/git-amb
index 26800c1..fb036b2 100755
--- a/src/git-amb
+++ b/src/git-amb
@@ -73,14 +73,20 @@ cond_cat_path() {
}
amb_init() {
- git_branch="$(git branch | sed -n 's/^* //p')"
+ if test "x$1" = "x"; then
+ git_branch="$(git branch | sed -n 's/^* //p')"
+ elif git branch | sed 's/^[ *] //' | grep "$1" > /dev/null; then
+ git_branch="${1}"
+ else
+ die "Invalid branch \"$1\" given."
+ fi
test "x.git" = "x$(basename "$GIT_DIR")"
top_srcdir="$(cd_to_toplevel && pwd)"
- tmp="$(git config amb.builddir)" || tmp="$GIT_DIR/amb/build"
+ tmp="$(git-config amb.builddir)" || tmp="$GIT_DIR/amb/build"
top_builddir="$(cond_cat_path "${top_srcdir}" "$tmp" "${git_branch}")"
- tmp="$(git config amb.installdir)" || tmp="$GIT_DIR/amb/install"
+ tmp="$(git-config amb.installdir)" || tmp="$GIT_DIR/amb/install"
top_installdir="$(cond_cat_path "${top_srcdir}" "$tmp" "$git_branch")"
amb_detect_configure
@@ -164,11 +170,11 @@ command="$1"
if shift; then
case "$command" in
builddir)
- amb_init
+ amb_init "$@"
echo "$top_builddir"
;;
installdir)
- amb_init
+ amb_init "$@"
echo "$top_installdir"
;;
autoreconf)
@@ -187,22 +193,22 @@ if shift; then
amb_printvars
;;
clean)
- amb_init
- amb_make "$@" clean
+ amb_init "$@"
+ amb_make clean
amb_printvars
;;
distclean)
- amb_init
- amb_make "$@" distclean
+ amb_init "$@"
+ amb_make distclean
amb_printvars
;;
purge)
- amb_init
- amb_purge "$@"
+ amb_init "$@"
+ amb_purge
;;
uninstall)
- amb_init
- amb_uninstall "$@"
+ amb_init "$@"
+ amb_uninstall
;;
sh)
amb_init
diff --git a/src/git-amb.1.in b/src/git-amb.1.in
index 4212c91..0461368 100644
--- a/src/git-amb.1.in
+++ b/src/git-amb.1.in
@@ -1,48 +1,82 @@
-.TH git\-amb 1 "@PACKAGE_TARNAME@ @PACKAGE_VERSION@" "2007\-11\-02" "@PACKAGE_NAME@ @PACKAGE_VERSION@"
+.TH GIT-AMB 1 "@PACKAGE_TARNAME@ @PACKAGE_VERSION@" "2007\-11\-02" "@PACKAGE_NAME@ @PACKAGE_VERSION@"
.SH NAME
git-amb \- git automake build utitilty
.SH SYNOPSIS
-.BI git\-amb command params
+.B "git\-amb"
+.RB "command"
+.RI [ params ]
.SH DESCRIPTION
Build automake based git checkout in branch specific build and install trees.
That makes it easy to compare build results from different branches.
-The params are passed to the respective command called.
-.TP 13
-.B autoreconf
+.SH "COMMAND OVERVIEW"
+.TP
+.B "git\-amb autoreconf [params...]"
Run autoreconf on ${top_srcdir}.
-.TP 13
-.B configure
+Optional params will be passed on to autoreconf.
+.TP
+.B "git\-amb configure [params...]"
Run configure in ${top_builddir}.
-.TP 13
-.B make
+Optional params will be passed on to configure.
+.TP
+.B "git\-amb make [params...]"
Run make in ${top_builddir}.
-.TP 13
-.B sh
+Optional params will be passed on to make.
+.TP
+.B "git\-amb sh [params...]"
Start shell in ${top_builddir}.
-.TP 13
-.B clean
+Optional params will be passed on to the shell.
+.TP
+.B "git\-amb clean [branch]"
Run 'make clean' in ${top_builddir}.
-.TP 13
-.B distclean
+The optional branch is the branch to clean up.
+.TP
+.B "git\-amb distclean [branch]"
Run 'make distclean' in ${top_builddir}.
-.TP 13
-.B purge
+The optional branch is the branch to clean up.
+.TP
+.B "git\-amb purge [branch]"
Remove both build and install tree.
-.TP 13
-.B uninstall
+The optional branch is the branch to purge.
+.TP
+.B "git\-amb uninstall [branch]"
Remove ${installdir}.
-.TP 13
-.B builddir
+The optional branch is the branch to uninstall.
+.TP
+.B "git\-amb builddir [branch]"
Print ${builddir}.
-.TP 13
-.B installdir
+The optional branch is the branch to print the builddir for.
+.TP
+.B "git\-amb installdir [branch]"
Print ${installdir}.
+The optional branch is the branch to print the installdir for.
.SH CONFIGURATION
+Get the value with
+.B git config amb.foo
+or set it with
+.B git config amb.foo value
.SS amb.builddir
-Relative to top checkout dir, or absolute.
+Location of build tree, relative to top checkout (source) dir, or absolute.
+The branch name will be appended to it.
.SS amb.installdir
-Relative to top checkout dir, or absolute.
-.SH AUTHORS
+Location of installation, relative to top checkout (source) dir, or absolute.
+The branch name will be appended to it.
+.SH EXAMPLES
+.nf
+ $ git config amb.builddir _builds
+ $ git config amb.installdir _installs
+.fi
+.PP
.nf
-Hans Ulrich Niedermann \fIhun@n\-dimensional.de\fP
+ $ git checkout master
+ $ git-amb make install
+ $ git checkout foo/bar
+ $ git-amb make dist install
+ $ diff -ru $(git-amb installdir) $(git-amb installdir master)
+ $ git-amb sh
+ <----> [...] $ ls *.tar.gz
.fi
+.SH AUTHORS
+.B "git\-amb"
+was written by Hans Ulrich Niedermann.
+.SH "SEE ALSO"
+git-branch(1), git-checkout(1), git-config(1).