summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-23 15:49:23 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-23 22:52:51 -0700
commit9cde57fa58b70cf5d9233531edc08de5c93308fb (patch)
treeaba9deba9f1db50dc845ea6c9bb63fca4447b1d7 /lib-src
parent826d153880d5934df086a6f1aea9cfd5433b7062 (diff)
downloaddotfiles-9cde57fa58b70cf5d9233531edc08de5c93308fb.tar.gz
add git_repack myrepos action
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/mr/config16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib-src/mr/config b/lib-src/mr/config
index aea3bd03..6a8a8743 100644
--- a/lib-src/mr/config
+++ b/lib-src/mr/config
@@ -35,6 +35,22 @@ unstow = hstow unstow "$MR_REPO"
restow = hstow restow "$MR_REPO"
adopt = hstow adopt "$MR_REPO"
+# Repack git-remote-gcrypt origin remotes.
+# Useful to avoid surprise repacks; see git-remote-gcrypt README.rst.
+git_repack =
+ git config --get remote.origin.gcrypt-id >/dev/null || exit 0
+ if ! git is-clean; then
+ echo >&2 must commit first; exit 1
+ elif [ -n "$(git for-each-ref \
+ --no-contains=origin/master refs/heads/master)" ]; then
+ git pull origin master
+ fi
+ # Ensure that there is something to push, else no repack will occur.
+ [ -n "$(git for-each-ref \
+ --contains=master refs/remotes/origin/master)" ] \
+ && git push -f origin origin/master~1:master
+ GCRYPT_FULL_REPACK=yes git push origin master
+
lib =
if [ -n "$USER" ]; then
whoami="$USER"