1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-10 20:43:48 -05:00

Fix fetch_git with --keep (sstephenson/ruby-build#549)

This commit is contained in:
Yamashita Yuu
2014-06-09 22:41:43 +09:00
parent 00596b4b46
commit 2ec8f0f0a4
2 changed files with 46 additions and 1 deletions

View File

@@ -394,7 +394,14 @@ fetch_git() {
popd >&4
fi
git clone --depth 1 --branch "$git_ref" "$git_url" "${package_name}" >&4 2>&1
if [ -e "${package_name}" ]; then
( cd "${package_name}"
git fetch --depth 1 origin "+${git_ref}"
git checkout -q -B "$git_ref" "origin/${git_ref}"
) >&4 2>&1
else
git clone --depth 1 --branch "$git_ref" "$git_url" "${package_name}" >&4 2>&1
fi
else
echo "error: please install \`git\` and try again" >&2
exit 1