summaryrefslogtreecommitdiff
path: root/version_hook
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir@cohens.org.il>2010-08-03 16:31:08 +0300
committerTzafrir Cohen <tzafrir@cohens.org.il>2010-08-03 16:31:08 +0300
commit01896ce33536f7edef54df7de0649d49d79ae2da (patch)
tree2d59cb3fac2ad0e041aba0a31ece63aa2fe0608a /version_hook
parent3ab6e3329bcd2150d7398b35cdddc2f49320181f (diff)
install version script to all projects
("all" - asterisk, dahdi-linux, dahdi-tools, libpri ATM. See also PROJ_PAT in version_hack) * Adapt version_hack to also work with other projects - a slightly more complex sed. * Other minor fixes. * Install it (in the setup) by default as a post-checkout and post-merge script, to have .version updated on checkout and on pull.
Diffstat (limited to 'version_hook')
-rwxr-xr-xversion_hook12
1 files changed, 7 insertions, 5 deletions
diff --git a/version_hook b/version_hook
index bcadcfa..e3a813a 100755
--- a/version_hook
+++ b/version_hook
@@ -3,12 +3,14 @@
# version_hook: set a .version file in a git repository based on a
# svn.asterisk.org SVN repository
-# FIXME: any way to detect that?
-PROJECT="dahdi/linux"
+# Originally by Shaun Ruffel
+
+# FIXME: Nicer formatting. Preprocess?
+PROJ_PAT="\(dahdi/linux\|dahdi/tools\|asterisk\/libpri\)"
# Do not update the .version file if it's part of the repository
-git ls-files | grep ^\.version
-if [ $? -eq 0 ]; then
+# This normally means we're on a tags/ branch.
+if git ls-files | grep -q ^\.version; then
exit 0
fi
@@ -25,7 +27,7 @@ if [ -z "$SVN_REV" ]; then
exit 0
fi
-PARTS=`LANG=C git log --pretty=full | grep git-svn | head -1 | awk '{print $2;}' | sed -e s:^.*/svn/${PROJECT}/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
+PARTS=`LANG=C git log --pretty=full | grep '^ *git-svn-id:' | head -1 | awk '{print $2;}' | sed -e "s:^.*/svn/${PROJ_PAT}/::" -e 's:/: :g' -e 's/@.*$//g'`
BRANCH=0
TEAM=0