[PATCH] Diff-helper update
[git/haiku.git] / git-pull-script
blobbd892c7bbc8b236d46b19444d94e2c023410f4d5
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"/MERGE_HEAD
40 echo "Getting object database"
41 download_objects "$merge_repo" "$(cat "$GIT_DIR"/MERGE_HEAD)"
43 git-resolve-script \
44 "$(cat "$GIT_DIR"/HEAD)" \
45 "$(cat "$GIT_DIR"/MERGE_HEAD)" \
46 "$merge_repo"