diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-02-10 18:42:31 -0500 |
---|---|---|
committer | AndrewMurrell <ImFromNASA@gmail.com> | 2017-02-10 19:09:29 -0500 |
commit | 18ffed0c8baf19b53a26b23490c5f4e2367ea398 (patch) | |
tree | 552ef9cabc7898958d94b03efe0494bf330066aa /bin | |
parent | 9ce576387ea86232aef9539da0194c11850df820 (diff) |
Improve post-commit tooling
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/auto-changelog | 2 | ||||
-rwxr-xr-x | bin/pre-generate | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/bin/auto-changelog b/bin/auto-changelog index 2b8187f..64d15e9 100755 --- a/bin/auto-changelog +++ b/bin/auto-changelog @@ -39,7 +39,7 @@ main() { if should-insert; then insert git add src/changelog.md - git commit -m 'Auto-insert entry to ChangeLog' + git commit -m 'Auto-insert entry to ChangeLog' --author='Logger <logger@andrewdm.me>' fi } 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" |