summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/init.el9
-rw-r--r--README3
-rwxr-xr-xbin/bstraph7
-rwxr-xr-xbin/git-dotfiles-rebase33
-rw-r--r--lib-src/mr/config17
5 files changed, 19 insertions, 50 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 64a1ace6..2b243c10 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -2089,15 +2089,6 @@ Useful after resizing the frame."
(while (re-search-forward key nil t)
(replace-match value))))))
-(defun spw/dotfiles-rebase ()
- "Rebase & push dotfiles."
- (interactive)
- (let ((default-directory (expand-file-name "~/src/dotfiles/"))
- (buffer (get-buffer-create "*dotfiles rebase*")))
- (display-buffer buffer)
- (async-shell-command "git-dotfiles-rebase" "*dotfiles rebase*")))
-(global-set-key "\C-cvd" #'spw/dotfiles-rebase)
-
(cl-defun spw/myrepos-global-action
(action &optional (command (concat "mr -s " action)))
(require 'term)
diff --git a/README b/README
index 387a994d..ecdc6160 100644
--- a/README
+++ b/README
@@ -10,8 +10,7 @@ master.
This restriction is to make usage less complex, even if it results in
some patches being duplicated between multiple host branches (that
aren't suitable for master). My dotfiles are too important for the
-repository to require time-consuming, complex rebase operations. I
-use ~/src/dotfiles/bin/git-dotfiles-rebase to do the rebasing.
+repository to require time-consuming, complex rebase operations.
On host branches, following the host-specific patches, there may be commits
destined for master. This is because hosts without access to my PGP keys
diff --git a/bin/bstraph b/bin/bstraph
index 445cd87e..972662cc 100755
--- a/bin/bstraph
+++ b/bin/bstraph
@@ -42,16 +42,17 @@ if command -v git >/dev/null; then
git config user.signingkey 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B
- # Pushing and pulling are always done explicitly.
for branch in $(git for-each-ref \
--format='%(refname:short)' refs/heads/); do
git rev-parse "$branch"@{upstream} >/dev/null 2>&1 \
&& git branch --unset-upstream "$branch"
done
git config push.default nothing
-
- # This is just for `magit-status'.
+ # Ensure 'git push-all' non-force pushes master to origin.
git config remote.pushDefault origin
+ git config --unset branch.master.pushRemote ||:
+ # Ensure 'git push-all' force pushes localhost's branch to origin.
+ git config branch."$(hostname | sed -e 's#\..*$##')".pushRemote origin
# Don't set up any tracking branches, or fetch it.
[ -z "$(git remote)" ] \
diff --git a/bin/git-dotfiles-rebase b/bin/git-dotfiles-rebase
deleted file mode 100755
index 5f96244a..00000000
--- a/bin/git-dotfiles-rebase
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-set -e
-
-sign () {
- if ! git is-clean; then
- echo >&2 "$0: cannot -S --amend commit: dotfiles working tree not clean"
- exit 1
- fi
- branch=$(git rev-parse --abbrev-ref HEAD)
- [ "$branch" = "master" ] || git checkout master
- git commit -S --amend --no-edit
- if [ "$branch" != "master" ]; then
- git checkout "$branch"
- git rebase master
- fi
-}
-
-cd $HOME/src/dotfiles
-hostname="$(hostname)" # use '-s' ?
-if git rev-parse refs/heads/$hostname >/dev/null 2>&1; then
- git checkout $hostname
- git rebase master
- if ! git push origin master +$hostname; then
- sign
- git push origin master +$hostname
- fi
-else
- if ! git push origin master; then
- sign
- git push origin master
- fi
-fi
diff --git a/lib-src/mr/config b/lib-src/mr/config
index 98f3d0d8..48e5e0d7 100644
--- a/lib-src/mr/config
+++ b/lib-src/mr/config
@@ -116,10 +116,21 @@ lib =
[src/dotfiles]
checkout = git clone https://git.spwhitton.name/dotfiles.git dotfiles
# We have a script to update master, and all other branches should be checked
-# out and committed to on only a single host, so no need to pull them, and
-# they'll always be rebaseable.
+# 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
-push = git dotfiles-rebase
+# This is how we 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 commit -S --amend --no-edit
+ [ "$branch" = master ] || git checkout "$branch"
+ fi
# Restowing is expensive, and most dangling symlinks into ~/.STOW do no harm,
# so we leave it to be run manually -- bstraph stows but does not restow.
# Possibly restowing could be done by locmaint, or we could have hstow skip