[PATCH] git-cvsimport-script: parse multidigit revisions.
[git/jrn.git] / git-fetch-script
blobacb1e56e70a974d276eb915a51fc5351801b24a5
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-sh-setup-script || die "Not a git archive"
14 TMP_HEAD="$GIT_DIR/TMP_HEAD"
16 case "$merge_repo" in
17 http://*)
18 head=$(wget -q -O - "$merge_repo/$merge_name") || exit 1
19 echo Fetching $head using http
20 git-http-pull -v -a "$head" "$merge_repo/"
22 rsync://*)
23 rsync -L "$merge_repo/$merge_name" "$TMP_HEAD" || exit 1
24 head=$(git-rev-parse TMP_HEAD)
25 rm -f "$TMP_HEAD"
26 rsync -avz --ignore-existing "$merge_repo/objects/" "$GIT_OBJECT_DIRECTORY/"
29 head=$(git-fetch-pack "$merge_repo" "$merge_name")
31 esac || exit 1
32 git-rev-parse --verify "$head" > /dev/null || exit 1
33 echo "$head" > "$GIT_DIR/$destination"