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
|
|
|
|
http://*)
|
2005-07-16 11:16:24 +04:00
|
|
|
head=$(wget -q -O - "$merge_repo/$merge_head") || exit 1
|
|
|
|
echo Fetching "$merge_head" using http
|
2005-07-16 21:31:38 +04:00
|
|
|
git-http-pull -v -a "$head" "$merge_repo/"
|
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-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"
|