2005-05-22 22:03:24 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2005-07-08 21:57:21 +04:00
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
2005-07-16 11:16:24 +04:00
|
|
|
. git-parse-remote "$@"
|
|
|
|
merge_repo="$_remote_repo"
|
|
|
|
merge_head="$_remote_head"
|
|
|
|
merge_store="$_remote_store"
|
2005-07-08 21:57:21 +04:00
|
|
|
|
2005-07-05 22:38:37 +04:00
|
|
|
TMP_HEAD="$GIT_DIR/TMP_HEAD"
|
2005-05-22 22:03:24 +04:00
|
|
|
|
2005-07-05 22:38:37 +04:00
|
|
|
case "$merge_repo" in
|
2005-07-13 06:12:40 +04:00
|
|
|
http://* | https://*)
|
|
|
|
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
|
|
|
|
curl_extra_args="-k"
|
|
|
|
fi
|
2005-07-26 09:42:18 +04: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" &&
|
2005-08-08 13:53:23 +04:00
|
|
|
head=$(curl -nsf $curl_extra_args "$merge_repo/$merge_head") &&
|
2005-07-26 09:42:18 +04:00
|
|
|
expr "$head" : "$_x40\$" >/dev/null || {
|
|
|
|
echo >&2 "Failed to fetch $merge_head from $merge_repo"
|
|
|
|
exit 1
|
|
|
|
}
|
2005-07-16 11:16:24 +04:00
|
|
|
echo Fetching "$merge_head" using http
|
2005-08-01 11:41:49 +04:00
|
|
|
git-http-pull -v -a "$head" "$merge_repo/" || exit
|
2005-07-05 22:38:37 +04:00
|
|
|
;;
|
|
|
|
rsync://*)
|
2005-07-16 11:16:24 +04:00
|
|
|
rsync -L "$merge_repo/$merge_head" "$TMP_HEAD" || exit 1
|
2005-07-05 22:38:37 +04:00
|
|
|
head=$(git-rev-parse TMP_HEAD)
|
|
|
|
rm -f "$TMP_HEAD"
|
|
|
|
rsync -avz --ignore-existing "$merge_repo/objects/" "$GIT_OBJECT_DIRECTORY/"
|
|
|
|
;;
|
|
|
|
*)
|
2005-07-16 11:16:24 +04:00
|
|
|
head=$(git-fetch-pack "$merge_repo" "$merge_head")
|
2005-08-12 13:08:29 +04:00
|
|
|
if h=`expr "$head" : '\([^ ][^ ]*\) '`
|
|
|
|
then
|
|
|
|
head=$h
|
|
|
|
fi
|
2005-07-05 22:38:37 +04:00
|
|
|
;;
|
|
|
|
esac || exit 1
|
2005-07-16 11:16:24 +04:00
|
|
|
|
2005-07-05 22:38:37 +04:00
|
|
|
git-rev-parse --verify "$head" > /dev/null || exit 1
|
2005-07-16 11:16:24 +04:00
|
|
|
|
|
|
|
case "$merge_store" in
|
|
|
|
'')
|
2005-07-16 21:27:19 +04:00
|
|
|
;;
|
|
|
|
*)
|
2005-07-16 11:16:24 +04: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"
|