prelude.sh: better git remote logic

This commit is contained in:
lassulus 2015-05-15 15:19:10 +02:00 committed by tv
parent bc7843b03d
commit 6dbf8e292e

View File

@ -14,15 +14,14 @@ clone_or_update() {(
cd "$nixpkgs_dir" cd "$nixpkgs_dir"
if [ ! -e "$nixpkgs_dir"/.git ]; then git init -q
git init
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 fi
if git remote -v | grep -q "^config\>"; then
git remote remove config
fi
git remote add config "$git_url"
git fetch config git fetch config
git checkout "$git_rev" git checkout "$git_rev"