Merge branch 'rs/patch-id-use-oid-to-hex'
[git] / t / t4100 / t-apply-6.patch
1 diff a/Makefile b/Makefile
2 --- a/Makefile
3 +++ b/Makefile
4 @@ -20,7 +20,7 @@ INSTALL=install
5  
6  SCRIPTS=git-apply-patch-script git-merge-one-file-script git-prune-script \
7         git-pull-script git-tag-script git-resolve-script git-whatchanged \
8 -       git-deltafy-script
9 +       git-deltafy-script git-fetch-script
10  
11  PROG=   git-update-index git-diff-files git-init-db git-write-tree \
12         git-read-tree git-commit-tree git-cat-file git-fsck-cache \
13 diff a/git-fetch-script b/git-fetch-script
14 --- /dev/null
15 +++ b/git-fetch-script
16 @@ -0,0 +1,41 @@
17 +#!/bin/sh
18 +#
19 +merge_repo=$1
20 +merge_name=${2:-HEAD}
21 +
22 +: ${GIT_DIR=.git}
23 +: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
24 +
25 +download_one () {
26 +       # remote_path="$1" local_file="$2"
27 +       case "$1" in
28 +       http://*)
29 +               wget -q -O "$2" "$1" ;;
30 +       /*)
31 +               test -f "$1" && cat >"$2" "$1" ;;
32 +       *)
33 +               rsync -L "$1" "$2" ;;
34 +       esac
35 +}
36 +
37 +download_objects () {
38 +       # remote_repo="$1" head_sha1="$2"
39 +       case "$1" in
40 +       http://*)
41 +               git-http-pull -a "$2" "$1/"
42 +               ;;
43 +       /*)
44 +               git-local-pull -l -a "$2" "$1/"
45 +               ;;
46 +       *)
47 +               rsync -avz --ignore-existing \
48 +                       "$1/objects/." "$GIT_OBJECT_DIRECTORY"/.
49 +               ;;
50 +       esac
51 +}
52 +
53 +echo "Getting remote $merge_name"
54 +download_one "$merge_repo/$merge_name" "$GIT_DIR"/MERGE_HEAD
55 +
56 +echo "Getting object database"
57 +download_objects "$merge_repo" "$(cat "$GIT_DIR"/MERGE_HEAD)"
58 diff a/git-pull-script b/git-pull-script
59 --- a/git-pull-script
60 +++ b/git-pull-script
61 @@ -6,39 +6,7 @@ merge_name=${2:-HEAD}
62  : ${GIT_DIR=.git}
63  : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
64  
65 -download_one () {
66 -       # remote_path="$1" local_file="$2"
67 -       case "$1" in
68 -       http://*)
69 -               wget -q -O "$2" "$1" ;;
70 -       /*)
71 -               test -f "$1" && cat >"$2" "$1" ;;
72 -       *)
73 -               rsync -L "$1" "$2" ;;
74 -       esac
75 -}
76 -
77 -download_objects () {
78 -       # remote_repo="$1" head_sha1="$2"
79 -       case "$1" in
80 -       http://*)
81 -               git-http-pull -a "$2" "$1/"
82 -               ;;
83 -       /*)
84 -               git-local-pull -l -a "$2" "$1/"
85 -               ;;
86 -       *)
87 -               rsync -avz --ignore-existing \
88 -                       "$1/objects/." "$GIT_OBJECT_DIRECTORY"/.
89 -               ;;
90 -       esac
91 -}
92 -
93 -echo "Getting remote $merge_name"
94 -download_one "$merge_repo/$merge_name" "$GIT_DIR"/MERGE_HEAD
95 -
96 -echo "Getting object database"
97 -download_objects "$merge_repo" "$(cat "$GIT_DIR"/MERGE_HEAD)"
98 +git-fetch-script "$merge_repo" "$merge_name"
99  
100  git-resolve-script \
101         "$(cat "$GIT_DIR"/HEAD)" \