diff options
author | varac <varacanero@zeromail.org> | 2013-09-03 15:09:39 +0200 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2013-09-03 15:09:39 +0200 |
commit | ac627aacf00c2f888f21c6f108931dea38260f73 (patch) | |
tree | 0f3b0c06653c95a0c05102d9b7e73d39f2b5b93a /git | |
parent | 4de9cbe5ddcdc688d6723262728dc4d86c898afa (diff) |
reorganized directory layout
Diffstat (limited to 'git')
-rwxr-xr-x | git/superproject-post-push.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/git/superproject-post-push.sh b/git/superproject-post-push.sh new file mode 100755 index 0000000..d680a94 --- /dev/null +++ b/git/superproject-post-push.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# how to use: +# put all of this in some directory (eg. /home/micah/bin/superproject-post-push.sh) and then do this in the git submodule directory: +# micah@minnow:~/leap/puppet/modules/apt$ git config alias.xpush "push && /home/micah/bin/superproject-post-push.sh" + +# use git xpush for pushing + +# this assumes a couple things: +# 1. you do the commit in the top level of the submodule (not any subdirectory within) +# 2. you have no local, uncomitted changes in your superproject when you do any submodule commit + +# exit on any error +set -e + +# change this variable to your superproject checkout +superproject=${HOME}/leap/puppet + +submodule_base=`basename $PWD` +submodule=${submodule_base#puppet_} + +# check out the latest version of the superproject +# note: this part is fragile, because if you have local, uncomitted changes in your superproject, then this pull will fail +cd ${superproject} +git pull +git submodule update --init + +# check out latest version of submodule +# according to https://we.riseup.net/riseup+tech/puppet-git-submodules +cd ${superproject}/modules/${submodule} +git remote update +git merge origin/master + +# commit and push the submodule update commit +cd .. +git add $submodule +git commit -m "automatic update of submodule $submodule_base" +git push |