[PATCH] Avoid unnecessarily inflating and interpreting delta
[alt-git.git] / git-fetch-script
blobfb4a53776ac0f3f5d95e4c4b6a68ab0b3913974c
1 #!/bin/sh
3 destination=FETCH_HEAD
5 merge_repo=$1
6 merge_name=${2:-HEAD}
7 if [ "$2" = "tag" ]; then
8 merge_name="refs/tags/$3"
9 destination="$merge_name"
12 : ${GIT_DIR=.git}
13 : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
15 download_one () {
16 # remote_path="$1" local_file="$2"
17 case "$1" in
18 http://*)
19 wget -q -O "$2" "$1" ;;
20 /*)
21 test -f "$1" && cat >"$2" "$1" ;;
23 rsync -L "$1" "$2" ;;
24 esac
27 download_objects () {
28 # remote_repo="$1" head_sha1="$2"
29 case "$1" in
30 http://*)
31 git-http-pull -a "$2" "$1/"
33 /*)
34 git-local-pull -l -a "$2" "$1/"
37 rsync -avz --ignore-existing \
38 "$1/objects/." "$GIT_OBJECT_DIRECTORY"/.
40 esac
43 echo "Getting remote $merge_name"
44 download_one "$merge_repo/$merge_name" "$GIT_DIR/$destination" || exit 1
46 echo "Getting object database"
47 download_objects "$merge_repo" "$(cat "$GIT_DIR/$destination")" || exit 1