git-fetch-scripton commit [PATCH] git-branch: avoid getting confused by empty or nonexisting branches. (a38e727)
   1#!/bin/sh
   2#
   3. git-sh-setup-script || die "Not a git archive"
   4. git-parse-remote "$@"
   5merge_repo="$_remote_repo"
   6merge_head="$_remote_head"
   7merge_store="$_remote_store"
   8
   9TMP_HEAD="$GIT_DIR/TMP_HEAD"
  10
  11case "$merge_repo" in
  12http://* | https://*)
  13        if [ -n "$GIT_SSL_NO_VERIFY" ]; then
  14            curl_extra_args="-k"
  15        fi
  16        head=$(curl -ns $curl_extra_args "$merge_repo/$merge_head") || exit 1
  17        echo Fetching "$merge_head" using http
  18        git-http-pull -v -a "$head" "$merge_repo/"
  19        ;;
  20rsync://*)
  21        rsync -L "$merge_repo/$merge_head" "$TMP_HEAD" || exit 1
  22        head=$(git-rev-parse TMP_HEAD)
  23        rm -f "$TMP_HEAD"
  24        rsync -avz --ignore-existing "$merge_repo/objects/" "$GIT_OBJECT_DIRECTORY/"
  25        ;;
  26*)
  27        head=$(git-fetch-pack "$merge_repo" "$merge_head")
  28        ;;
  29esac || exit 1
  30
  31git-rev-parse --verify "$head" > /dev/null || exit 1
  32
  33case "$merge_store" in
  34'')
  35        ;;
  36*)
  37        echo "$head" > "$GIT_DIR/$merge_store"
  38esac &&
  39
  40# FETCH_HEAD is fed to git-resolve-script which will eventually be
  41# passed to git-commit-tree as one of the parents.  Make sure we do
  42# not give a tag object ID.
  43
  44git-rev-parse "$head^0" >"$GIT_DIR/FETCH_HEAD"