aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-02-11 01:40:31 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-02-11 01:40:31 +0000
commit5f182fcbdc18a66abf61733d2149c5b34c96d9eb (patch)
tree12f340df3e752e1ba4fe8df31c3008308462cea4
parenta47ac614f60b75138803069e0a63726b3d492a2d (diff)
downloadpaludis-5f182fcbdc18a66abf61733d2149c5b34c96d9eb.tar.gz
paludis-5f182fcbdc18a66abf61733d2149c5b34c96d9eb.tar.xz
Do git switching the same way as for svn.
-rw-r--r--paludis/syncers/dogit.in16
-rw-r--r--paludis/syncers/dosvn.in1
2 files changed, 14 insertions, 3 deletions
diff --git a/paludis/syncers/dogit.in b/paludis/syncers/dogit.in
index 1fd14f1..909cda7 100644
--- a/paludis/syncers/dogit.in
+++ b/paludis/syncers/dogit.in
@@ -81,10 +81,20 @@ if [[ -d "${LOCAL}" && ! -d "${LOCAL}/.git" ]]; then
exit 1
fi
+if [[ -d "${LOCAL}" ]]; then
+ cd "${LOCAL}"
+ OLD_REMOTE="$(${GIT_WRAPPER} git config remote.origin.url)"
+ if [[ "${OLD_REMOTE}" != "${REMOTE}" ]]; then
+ if ! ${GIT_WRAPPER} git config remote.origin.url "${REMOTE}"; then
+ eerror "${0}: could not switch from '${OLD_REMOTE}' to '${REMOTE}'"
+ exit 1
+ fi
+ fi
+ cd - >/dev/null
+fi
+
if [[ -d "${LOCAL}/.git" ]]; then
- cd "${LOCAL}" \
- && ${GIT_WRAPPER} git config remote.origin.url "${REMOTE}" \
- && ${GIT_WRAPPER} git pull "${GIT_PULL_OPTIONS[@]}"
+ cd "${LOCAL}" && ${GIT_WRAPPER} git pull "${GIT_PULL_OPTIONS[@]}" origin
else
${GIT_WRAPPER} git clone "${GIT_CLONE_OPTIONS[@]}" "${REMOTE}" "${LOCAL}"
fi
diff --git a/paludis/syncers/dosvn.in b/paludis/syncers/dosvn.in
index 815b79b..c88e552 100644
--- a/paludis/syncers/dosvn.in
+++ b/paludis/syncers/dosvn.in
@@ -77,6 +77,7 @@ if [[ -d "${LOCAL}/.svn" ]]; then
exit 1
fi
fi
+ cd - >/dev/null
fi
${SVN_WRAPPER} svn checkout "${SVN_CHECKOUT_OPTIONS[@]}" "${REMOTE}" "${LOCAL}/"