git/git-pull-script
Linus Torvalds 6b38a402e9 Clean up different special *HEAD handling
We codify the following different heads (in addition to the main "HEAD",
which points to the current branch, of course):

 - FETCH_HEAD

   Populated by "git fetch"

 - ORIG_HEAD

   The old HEAD before a "git pull/resolve" (successful or not)

 - LAST_MERGE

   The HEAD we're currently merging in "git pull/resolve"

 - MERGE_HEAD

   The previous head of a unresolved "git pull", which gets committed by
   a "git commit" after manually resolving the result

We used to have "MERGE_HEAD" be populated directly by the fetch, and we
removed ORIG_HEAD and LAST_MERGE too aggressively.
2005-06-21 14:04:13 -07:00

22 lines
425 B
Bash
Executable file

#!/bin/sh
#
merge_repo=$1
merge_name=$(echo "$1" | sed 's:\.git/*$::')
merge_head=HEAD
if [ "$2" ]
then
merge_name="'$2' branch of $merge_name"
merge_head="refs/heads/$2"
fi
: ${GIT_DIR=.git}
: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
git-fetch-script "$merge_repo" "$merge_head" || exit 1
git-resolve-script \
"$(cat "$GIT_DIR"/HEAD)" \
"$(cat "$GIT_DIR"/FETCH_HEAD)" \
"$merge_name"