summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-05-15 15:19:10 +0200
committertv <tv@shackspace.de>2015-05-19 23:17:20 +0200
commit6dbf8e292eb7a1465fcd79bc955169716fc3966a (patch)
tree7212c6d617fb3e9b528751d2eab17c8a2d67d630
parentbc7843b03dd8f6d017467c81b7c08b3b6fd874c9 (diff)
prelude.sh: better git remote logic
-rw-r--r--lib/prelude.sh11
1 files 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"