summaryrefslogtreecommitdiff
path: root/bin/pre-generate
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-02-10 18:42:31 -0500
committerAndrewMurrell <ImFromNASA@gmail.com>2017-02-10 19:09:29 -0500
commit18ffed0c8baf19b53a26b23490c5f4e2367ea398 (patch)
tree552ef9cabc7898958d94b03efe0494bf330066aa /bin/pre-generate
parent9ce576387ea86232aef9539da0194c11850df820 (diff)
Improve post-commit tooling
Diffstat (limited to 'bin/pre-generate')
-rwxr-xr-xbin/pre-generate19
1 files changed, 17 insertions, 2 deletions
diff --git a/bin/pre-generate b/bin/pre-generate
index e5f8f5e..c2d3516 100755
--- a/bin/pre-generate
+++ b/bin/pre-generate
@@ -13,23 +13,38 @@ if [[ $branch == master ]]; then
git worktree prune
git branch -D pre-generated.tmp &>/dev/null || true
+ unset GIT_INDEX_FILE
git worktree add -b pre-generated.tmp "${gitdir}/pre-generated" master
(
unset GIT_DIR GIT_WORK_TREE
cd "$workdir"
+
msg="$(git log -n1 master --pretty=format:%B)"
+ export GIT_AUTHOR_NAME='Maker'
+ export GIT_AUTHOR_EMAIL='maker@andrewdm.me'
make -j1
echo '!/out/' >> .gitignore
git add .
git commit -m "make: $msg"
- git checkout pre-generated
+
+ git checkout pre-generated # Ensure it exists locally
+ git pull --no-edit -s ours # Avoid conflicts
+
+ # What we want is
+ #
+ # git merge --no-edit -s theirs pre-generated.tmp
+ #
+ # Unfortunately, there is no 'theirs' strategy; so we
+ # have to switch branches and do it backward with the
+ # 'ours' strategry, switch back, then merge the merge
+ # commit.
git checkout pre-generated.tmp
git merge --no-edit -s ours pre-generated
git checkout pre-generated
- git pull
git merge pre-generated.tmp
+
git branch -d pre-generated.tmp
)
rm -rf -- "$workdir"