From 2be813e29c8caeaabeb53f3b28e4a0a7cde6621e Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Thu, 19 Feb 2009 19:08:34 +0100 Subject: document exported env vars and add example posttag hook --- docs/chapters/building.sgml | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/docs/chapters/building.sgml b/docs/chapters/building.sgml index a0467e53..2d587a8f 100644 --- a/docs/chapters/building.sgml +++ b/docs/chapters/building.sgml @@ -62,17 +62,48 @@ export-dir=../build-area Pushing into a remote repository If you want to push your changes automatically after a succesful build and tag - you can use &git-buildpackage;'s posttag hook: + you can use &git-buildpackage;'s posttag hook. A very simple invocation would look like this: git-buildpackage ="git push && git push --tags" - This assumes you have set up a remote repository to push to in either - .git/config or - .git/remotes/. Setting up the posttag hook in - .gbp.conf looks like: + This assumes you have set up a remote repository to push to in .git/config. + + The following hook pushes out the created tag to were you pulled from + and forwards the remote branch to that position: -="git push git.debian.org && git push --tags git.debian.org" +#!/bin/sh -e +# +# gbp-push: post tag hook to push out the newly created tag and to forward the +# remote branch to that position + +if ! REMOTE=$(git config --get branch."${GBP_BRANCH}".remote); then + REMOTE=origin +fi + +if [ "$GBP_TAG" ]; then + echo "Pushing $GBP_TAG to $REMOTE" + git push "$REMOTE" "$GBP_TAG" +else + echo "GBP_TAG no set." + exit 1 +fi + +if [ "$GBP_SHA1" ] && [ "$GBP_BRANCH" ]; then + git push "$REMOTE" "$GBP_SHA1":"$GBP_BRANCH" +else + echo "GBP_SHA1 or GBP_BRANCH not set." + exit 1 +fi +echo "done." + GBP_TAG, GBP_SHA1 + and GBP_BRANCH are passed to the hook via the + environment. To call this hook automatically upon tag creation add: + +="gbp-push" + + to your .gbp.conf and make sure gbp-push + is somewhere in your $PATH. -- cgit v1.2.3