[PATCH] Pull misc objects
[git.git] / git-fetch-script
blob2e62f001b189249243ad27b88bf8357526095f14
1 #!/bin/sh
3 merge_repo=$1
4 merge_name=${2:-HEAD}
6 : ${GIT_DIR=.git}
7 : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
9 download_one () {
10 # remote_path="$1" local_file="$2"
11 case "$1" in
12 http://*)
13 wget -q -O "$2" "$1" ;;
14 /*)
15 test -f "$1" && cat >"$2" "$1" ;;
17 rsync -L "$1" "$2" ;;
18 esac
21 download_objects () {
22 # remote_repo="$1" head_sha1="$2"
23 case "$1" in
24 http://*)
25 git-http-pull -a "$2" "$1/"
27 /*)
28 git-local-pull -l -a "$2" "$1/"
31 rsync -avz --ignore-existing \
32 "$1/objects/." "$GIT_OBJECT_DIRECTORY"/.
34 esac
37 echo "Getting remote $merge_name"
38 download_one "$merge_repo/$merge_name" "$GIT_DIR"/FETCH_HEAD || exit 1
40 echo "Getting object database"
41 download_objects "$merge_repo" "$(cat "$GIT_DIR"/FETCH_HEAD)" || exit 1