From 22eb99b358d9716695ad4b1deddbd47c5f0038d5 Mon Sep 17 00:00:00 2001 From: LukeZGD <26163116+LukeZGD@users.noreply.github.com> Date: Sat, 17 Feb 2024 16:49:15 +0800 Subject: [PATCH] Detect if git repo is shallow, and unshallow it --- restore.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/restore.sh b/restore.sh index 732812d..54124ea 100755 --- a/restore.sh +++ b/restore.sh @@ -393,6 +393,8 @@ version_update() { fi if [[ -d .git ]]; then log "Running git pull..." + print "* If this fails for some reason, run: git reset --hard" + print "* To clean more files if needed, run: git clean -df" git pull log "Done! Please run the script again" exit @@ -427,6 +429,10 @@ version_update() { version_get() { pushd .. >/dev/null if [[ -d .git ]]; then + if [[ -e .git/shallow ]]; then + log "Shallow git repository detected. Unshallowing..." + git fetch --unshallow + fi git_hash=$(git rev-parse HEAD | cut -c -7) local dm=$(git log -1 --format=%ci | cut -c 3- | cut -c -5) version_current=v${dm//-/.}.