From 6dbf8e292eb7a1465fcd79bc955169716fc3966a Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 15 May 2015 15:19:10 +0200 Subject: prelude.sh: better git remote logic --- lib/prelude.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/prelude.sh b/lib/prelude.sh index c68bf5571..0350642b3 100644 --- a/lib/prelude.sh +++ b/lib/prelude.sh @@ -14,15 +14,14 @@ clone_or_update() {( cd "$nixpkgs_dir" - if [ ! -e "$nixpkgs_dir"/.git ]; then - git init - fi + git init -q - if git remote -v | grep -q "^config\>"; then - git remote remove config + if ! current_url=$(git config remote.src.url); then + ${cache-git} remote add "src" "$git_url" + elif [ $current_url != $git_url ]; then + ${cache-git} remote set-url src ${git_url} fi - git remote add config "$git_url" git fetch config git checkout "$git_rev" -- cgit v1.2.3