Re: [PATCH] Only warn about missing branch.<n>.merge in pull.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 18 Dec 2006, Junio C Hamano wrote:

> 	$ git pull second
> 
> [...]
> 
> I can see a few possibilities:
> 
>  (1) people do not interact with multiple remote repositories
>      regularly, so this is not a problem in practice.
> 
>  (2) people do, but "the first branch listed" rule is good
>      enough in practice.  Because they would always say "git
>      pull second which-branch" instead if they want something
>      different, this is a non-issue.
> 
>  (3) branch.$current.merge was a mistake.  It should have been
>      branch.$current.merge.$remote.  In other words, the
>      configuration should have been about the current branch and
>      the remote repository pair.
> 
>  (4) the current configuration mechanism is fine, but the code
>      is not.  We should forbid "the first branch listed" rule
>      from being applied for "git pull second", and require the
>      users to explicitly say which branch(es) to merge.
> 
> I am inclined to say that (1) is possible, (2) is implausible
> (otherwise we would not have done 62b339a5 for the same reason),
> (3) is confused, and probably (4) is what we need.

I fetch/merge criss-crossed over my machines, so this affects me. Until 
the recent changes, I _always_ fetched/merged with explicit remote and 
branch. This keeps me unconfused about what I actually do.

With the options you list, I'd say (3) with (4) as a fallback is the way 
to go. However, I would actually reuse our versatile (often hated?) config 
handling:

[branch "xyz"]
	remote = blabla # this is the default remote
	merge = master # this is the default branch for the default remote
	merge = pu for remote second # merge 'pu' if pulling from second

And then handling it like this:

	default_branch=$(git repo-config branch.$branch.merge \
		"for remote $remote$")
	test "$default_branch" || \
		die "Need a branch when pulling from non-default remote"

Just my 2 Eurocents, which soon will be worth a dollar.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]