remote: handle pushremote config in any order
authorJeff King <peff@peff.net>
Mon, 24 Feb 2014 08:59:03 +0000 (03:59 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Feb 2014 20:53:28 +0000 (12:53 -0800)
The remote we push can be defined either by
remote.pushdefault or by branch.*.pushremote for the current
branch. The order in which they appear in the config file
should not matter to precedence (which should be to prefer
the branch-specific config).

The current code parses the config linearly and uses a
single string to store both values, overwriting any
previous value. Thus, config like:

[branch "master"]
pushremote = foo
[remote]
pushdefault = bar

erroneously ends up pushing to "bar" from the master branch.

We can fix this by storing both values and resolving the
correct value after all config is read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found