2005-05-22 20:03:24 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2005-07-08 19:57:21 +02:00
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
2005-07-16 09:16:24 +02:00
|
|
|
. git-parse-remote "$@"
|
|
|
|
merge_repo="$_remote_repo"
|
|
|
|
merge_head="$_remote_head"
|
|
|
|
merge_store="$_remote_store"
|
2005-07-08 19:57:21 +02:00
|
|
|
|
2005-07-05 20:38:37 +02:00
|
|
|
TMP_HEAD="$GIT_DIR/TMP_HEAD"
|
2005-05-22 20:03:24 +02:00
|
|
|
|
2005-07-05 20:38:37 +02:00
|
|
|
case "$merge_repo" in
|
2005-07-13 04:12:40 +02:00
|
|
|
http://* | https://*)
|
|
|
|
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
|
|
|
|
curl_extra_args="-k"
|
|
|
|
fi
|
2005-07-26 07:42:18 +02:00
|
|
|
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' &&
|
|
|
|
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" &&
|
|
|
|
head=$(curl -ns $curl_extra_args "$merge_repo/$merge_head") &&
|
|
|
|
expr "$head" : "$_x40\$" >/dev/null || {
|
|
|
|
echo >&2 "Failed to fetch $merge_head from $merge_repo"
|
|
|
|
exit 1
|
|
|
|
}
|
2005-07-16 09:16:24 +02:00
|
|
|
echo Fetching "$merge_head" using http
|
2005-08-01 09:41:49 +02:00
|
|
|
git-http-pull -v -a "$head" "$merge_repo/" || exit
|
2005-07-05 20:38:37 +02:00
|
|
|
;;
|
|
|
|
rsync://*)
|
2005-07-16 09:16:24 +02:00
|
|
|
rsync -L "$merge_repo/$merge_head" "$TMP_HEAD" || exit 1
|
2005-07-05 20:38:37 +02:00
|
|
|
head=$(git-rev-parse TMP_HEAD)
|
|
|
|
rm -f "$TMP_HEAD"
|
|
|
|
rsync -avz --ignore-existing "$merge_repo/objects/" "$GIT_OBJECT_DIRECTORY/"
|
|
|
|
;;
|
|
|
|
*)
|
2005-07-16 09:16:24 +02:00
|
|
|
head=$(git-fetch-pack "$merge_repo" "$merge_head")
|
2005-07-05 20:38:37 +02:00
|
|
|
;;
|
|
|
|
esac || exit 1
|
2005-07-16 09:16:24 +02:00
|
|
|
|
2005-07-05 20:38:37 +02:00
|
|
|
git-rev-parse --verify "$head" > /dev/null || exit 1
|
2005-07-16 09:16:24 +02:00
|
|
|
|
|
|
|
case "$merge_store" in
|
|
|
|
'')
|
2005-07-16 19:27:19 +02:00
|
|
|
;;
|
|
|
|
*)
|
2005-07-16 09:16:24 +02:00
|
|
|
echo "$head" > "$GIT_DIR/$merge_store"
|
|
|
|
esac &&
|
|
|
|
|
|
|
|
# FETCH_HEAD is fed to git-resolve-script which will eventually be
|
|
|
|
# passed to git-commit-tree as one of the parents. Make sure we do
|
|
|
|
# not give a tag object ID.
|
|
|
|
|
|
|
|
git-rev-parse "$head^0" >"$GIT_DIR/FETCH_HEAD"
|