site

A custom static site generator written in C.
git clone https://unitehenry.com/git/site.git
Log | Files | Refs | README

commit 476b71322d01b06aac81c9666d1d878abe166990
parent 243544c4112c425ad9160db8dc05a4e81ced61e5
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sat, 28 Nov 2026 21:11:46 +0000

fix(stagit): reclone mirrors when the GitHub URL changes

Diffstat:
Mscripts/stagit | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/stagit b/scripts/stagit @@ -126,8 +126,16 @@ while IFS=$'\t' read -r name description owner url; do repo_dir="$REPO_DIR/$name.git" if [ -d "$repo_dir" ]; then - printf 'Updating %s...\n' "$name" - git --git-dir="$repo_dir" remote update --prune + current_url="$(git --git-dir="$repo_dir" config --get remote.origin.url || true)" + + if [ "$current_url" != "$url" ]; then + printf 'Recloning %s (remote changed from %s)...\n' "$name" "$current_url" + rm -rf "$repo_dir" + git clone --quiet --mirror "$url" "$repo_dir" + else + printf 'Updating %s...\n' "$name" + git --git-dir="$repo_dir" remote update --prune + fi else printf 'Cloning %s...\n' "$name" git clone --quiet --mirror "$url" "$repo_dir"