allow for edge case same name repo; set perms anyway
authorShane <chown_tee@proton.me>
Sun, 11 Jan 2026 03:02:09 +0000 (03:02 +0000)
committerShane <chown_tee@proton.me>
Sun, 11 Jan 2026 03:04:33 +0000 (03:04 +0000)
Makefile

index 32c27737981f67bc97a2f7854721b866095b6b73..f5c12880584c7a57ca1a0da08a6071e49a794893 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -182,8 +182,16 @@ endif
        @# Auto-append .git if missing
        $(eval OLD_GIT := $(if $(filter %.git,$(OLD)),$(OLD),$(OLD).git))
        $(eval NEW_GIT := $(if $(filter %.git,$(NEW)),$(NEW),$(NEW).git))
-       @echo "Moving $(OLD_GIT) to $(NEW_GIT) on $(VPS_HOST)..."
-       ssh $(VPS) "mkdir -p /srv/git/$$(dirname $(NEW_GIT)) && mv /srv/git/$(OLD_GIT) /srv/git/$(NEW_GIT)"
-       @echo "Repository moved."
-       @echo "  Don't forget to update your local remote URL:"
-       @echo "  git remote set-url helio-web ssh://$(VPS_USER)@$(VPS_HOST)/srv/git/$(NEW_GIT)"
+       @if [ "$(OLD_GIT)" != "$(NEW_GIT)" ]; then \
+               echo "Moving $(OLD_GIT) to $(NEW_GIT) on $(VPS_HOST)..."; \
+               ssh $(VPS) "mkdir -p /srv/git/$$(dirname $(NEW_GIT)) && mv /srv/git/$(OLD_GIT) /srv/git/$(NEW_GIT)"; \
+               echo "Repository moved."; \
+       else \
+               echo "Source and destination are the same. Skipping move."; \
+       fi
+       @echo "Marking directory as safe..."
+       ssh $(VPS) "git config --global --add safe.directory /srv/git/$(NEW_GIT)"
+       @if [ "$(OLD_GIT)" != "$(NEW_GIT)" ]; then \
+               echo "  Don't forget to update your local remote URL:"; \
+       fi
+       echo "  git remote set-url helio-web ssh://$(VPS_USER)@$(VPS_HOST)/srv/git/$(NEW_GIT)"