git-fetch-scripton commit Add first cut at "git protocol" connect logic. (2386d65)
   1#!/bin/sh
   2#
   3destination=FETCH_HEAD
   4
   5merge_repo=$1
   6merge_name=${2:-HEAD}
   7if [ "$2" = "tag" ]; then
   8        merge_name="refs/tags/$3"
   9        destination="$merge_name"
  10fi
  11
  12. git-sh-setup-script || die "Not a git archive"
  13
  14TMP_HEAD="$GIT_DIR/TMP_HEAD"
  15
  16case "$merge_repo" in
  17http://*)
  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/"
  21        ;;
  22rsync://*)
  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/"
  27        ;;
  28*)
  29        head=$(git-fetch-pack "$merge_repo" "$merge_name")
  30        ;;
  31esac || exit 1
  32git-rev-parse --verify "$head" > /dev/null || exit 1
  33echo "$head" > "$GIT_DIR/$destination"