summaryrefslogtreecommitdiff
path: root/lib-src/mr
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-03 11:48:27 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-03 13:25:06 -0700
commitbf933f0447162bb31baeddfe805ac5c82ee004f8 (patch)
tree9862be9c33235289f25f94ca0f65f17f5a71dadb /lib-src/mr
parent3873418f962378aea0efb0b26ba9600551423a71 (diff)
downloaddotfiles-bf933f0447162bb31baeddfe805ac5c82ee004f8.tar.gz
dotfiles pre_push: always rebase localhost's branch if we amended
Diffstat (limited to 'lib-src/mr')
-rw-r--r--lib-src/mr/config9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib-src/mr/config b/lib-src/mr/config
index 9994a006..d10504f0 100644
--- a/lib-src/mr/config
+++ b/lib-src/mr/config
@@ -114,18 +114,17 @@ checkout = git clone https://git.spwhitton.name/dotfiles.git dotfiles
# out and committed to on only a single host, so no need to update them here,
# and they'll always be rebaseable.
update = git dotfiles-update-master
-# This is how we update from master on a host that has its own branch.
+# Update from master on a host that has its own branch.
pull = git dotfiles-update-master; git co "$hostname" && git rebase master
# Attempt to ensure tip of master is signed before attempting to push.
pre_push =
if git diff-index --quiet --cached HEAD \
&& ! git verify-commit-by-fp \
8DC2487E51ABDD90B5C4753F0F56D0553B6D411B master; then
- branch="$(git rev-parse --abbrev-ref HEAD)"
- [ "$branch" = master ] || git checkout master
+ [ "$(git rev-parse --abbrev-ref HEAD)" = master ] || git co master
git commit -S --amend --no-edit
- if [ "$branch" != master ]; then
- git checkout "$branch"
+ if git rev-parse -q --verify refs/heads/"$hostname" >/dev/null; then
+ git co "$hostname"
git rebase master
fi
fi