Update 2 files: bootstrap.sh, functions.zsh
This commit is contained in:
+8
-1
@@ -142,7 +142,14 @@ update_repo() {
|
||||
local TARGET_DIR="$HOME/.config/dotstate/storage"
|
||||
|
||||
if [[ -d "$TARGET_DIR/.git" ]]; then
|
||||
info "Repository exists. Pulling updates..."
|
||||
local remote_sha local_sha
|
||||
remote_sha=$(git ls-remote origin HEAD | awk '{print $1}')
|
||||
local_sha=$(git -C "$TARGET_DIR" rev-parse HEAD)
|
||||
if [[ "$remote_sha" == "$local_sha" ]]; then
|
||||
info "Repository up to date"
|
||||
return 0
|
||||
fi
|
||||
info "Repository out of date. Pulling updates..."
|
||||
git -C "$TARGET_DIR" pull &>/dev/null
|
||||
else
|
||||
info "Repository not found. Cloning..."
|
||||
|
||||
@@ -16,12 +16,17 @@ update_repo() {
|
||||
local TARGET_DIR="$HOME/.config/dotstate/storage"
|
||||
|
||||
if [[ -d "$TARGET_DIR/.git" ]]; then
|
||||
info "Repository exists. Pulling updates..."
|
||||
local remote_sha local_sha
|
||||
remote_sha=$(git ls-remote origin HEAD | awk '{print $1}')
|
||||
local_sha=$(git -C "$TARGET_DIR" rev-parse HEAD)
|
||||
if [[ "$remote_sha" == "$local_sha" ]]; then
|
||||
info "Repository up to date"
|
||||
return 0
|
||||
fi
|
||||
info "Repository out of date. Pulling updates..."
|
||||
git -C "$TARGET_DIR" pull &>/dev/null
|
||||
else
|
||||
info "Repository not found. Cloning..."
|
||||
git clone --depth=1 "$REPO_URL" "$TARGET_DIR" &>/dev/null
|
||||
fi
|
||||
|
||||
exec zsh
|
||||
}
|
||||
Reference in New Issue
Block a user