[PATCH] Use git-octopus when pulling more than one heads.
[git.git] / git-pull-script
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5 # Fetch one or more remote refs and merge it/them into the current HEAD.
6
7 . git-sh-setup-script || die "Not a git archive"
8 git-fetch-script "$@" || exit 1
9 merge_head=$(sed -e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | tr '\012' ' ')
10 merge_name=$(sed -e 's/^[0-9a-f]*       //' "$GIT_DIR"/FETCH_HEAD |
11          tr '\012' ' ')
12
13 case "$merge_head" in
14 '')
15         echo >&2 "No changes."
16         exit 0
17         ;;
18 *' '?*)
19         echo >&2 "Pulling more than one heads; making an Octopus."
20         exec git-octopus-script
21         ;;
22 esac
23
24 git-resolve-script \
25         "$(cat "$GIT_DIR"/HEAD)" \
26         $merge_head "Merge $merge_name"