summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-05-15 15:19:10 +0200
committertv <tv@krebsco.de>2015-05-19 23:17:20 +0200
commitc40cbe48aebc6385289edb217ab1506f49a5f283 (patch)
tree7212c6d617fb3e9b528751d2eab17c8a2d67d630
parent2e91f5632944b0b36ac6fd9a8d3913f6b927630e (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 c68bf55..0350642 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"