Linus Torvalds <torvalds@osdl.org> writes:As you said, pull inherently involve a merge which implies the existence of associated working tree, so I do not think there is any room for --bare to get in the picture. We already do the checkout when we recover from a fetch that is used incorrectly and updated the current branch head underneath us. To give the list a summary of the discussion so far, here is a consolidated patch. -- >8 -- From: Linus Torvalds <torvalds@osdl.org> Subject: git-pull: allow pulling into an empty repository We used to complain that we cannot merge anything we fetched with a local branch that does not exist yet. Just treat the case as a natural extension of fast forwarding and make the local branch'es tip point at the same commit we just fetched. After all an empty repository without an initial commit is an ancestor of any commit. Signed-off-by: Junio C Hamano <junkio@cox.net> --- diff --git a/git-pull.sh b/git-pull.sh index ed04e7d..e23beb6 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -44,10 +44,10 @@ do shift done -orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?" +orig_head=$(git-rev-parse --verify HEAD 2>/dev/null) git-fetch --update-head-ok --reflog-action=pull "$@" || exit 1 -curr_head=$(git-rev-parse --verify HEAD) +curr_head=$(git-rev-parse --verify HEAD 2>/dev/null) if test "$curr_head" != "$orig_head" then # The fetch involved updating the current branch. @@ -80,6 +80,11 @@ case "$merge_head" in exit 0 ;; ?*' '?*) + if test -z "$orig_head" + then + echo >&2 "Cannot merge multiple branches into empty head" + exit 1 + fi var=`git-repo-config --get pull.octopus` if test -n "$var" then @@ -95,6 +100,13 @@ case "$merge_head" in ;; esac +if test -z "$orig_head" +then + git-update-ref -m "initial pull" HEAD $merge_head "" && + git-read-tree --reset -u HEAD || exit 1 + exit +fi + case "$strategy_args" in '') strategy_args=$strategy_default_args - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Ondrej Zary | pata_it821x completely broken |
| Jeremy Fitzhardinge | [PATCH 02 of 36] x86: add memory clobber to save/loadsegment |
| Thomas Renninger | AMD Mobile Semprons (3500+, 3600+,...) break with nohz and highres enabled |
git: | |
| Linus Torvalds | People unaware of the importance of "git gc"? |
| Jakub Narebski | Octopus merge: unique (?) to git, but is it useful? |
| Junio C Hamano | [ANNOUNCE] GIT 1.5.3-rc4 |
| Theodore Tso | Re: git on MacOSX and files with decomposed utf-8 file names |
| qw er | OpenBSD sucks |
| Richard Stallman | Real men don't attack straw men |
| Henning Brauer | Re: About Xen: maybe a reiterative question but .. |
| Kevin Neff | Patching a SSH 'Weakness' |
| David Miller | [GIT]: Networking |
| Steve Wise | pktgen question |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Waskiewicz Jr, Peter P | RE: [PATCH 2/3][NET_BATCH] net core use batching |
