blob: 7016fbf943406d8e647e7a02f283fa10ab134905 [file] [log] [blame]
Linus Torvalds839a7a02005-04-18 12:15:10 -07001#!/bin/sh
2#
Junio C Hamano521003f2005-08-22 21:57:59 -07003# Copyright (c) 2005 Junio C Hamano
4#
5# Fetch one or more remote refs and merge it/them into the current HEAD.
6
Linus Torvaldsb33e9662005-07-08 10:57:21 -07007. git-sh-setup-script || die "Not a git archive"
Junio C Hamanof170e4b2005-07-16 00:16:24 -07008git-fetch-script "$@" || exit 1
Junio C Hamanoe0bfc812005-08-20 02:57:26 -07009merge_head=$(sed -e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | tr '\012' ' ')
10merge_name=$(sed -e 's/^[0-9a-f]* //' "$GIT_DIR"/FETCH_HEAD |
11 tr '\012' ' ')
12
13case "$merge_head" in
Junio C Hamano521003f2005-08-22 21:57:59 -070014'')
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 ;;
Junio C Hamanoe0bfc812005-08-20 02:57:26 -070022esac
23
Junio C Hamano8ac069a2005-05-09 22:57:58 -070024git-resolve-script \
25 "$(cat "$GIT_DIR"/HEAD)" \
Junio C Hamanoe0bfc812005-08-20 02:57:26 -070026 $merge_head "Merge $merge_name"