remote.c: drop default_remote_name variable
commite41bf352e3280e6990605a18ebbbd40c6f1c0d6d
authorJeff King <peff@peff.net>
Fri, 1 May 2015 22:44:41 +0000 (1 18:44 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 May 2015 18:42:28 +0000 (3 11:42 -0700)
tree4c32388bd1e305fe195a3f10d232a8f10735dabf
parent2dfb2e07cb0cb979f630643b57dca579a0359a9d
remote.c: drop default_remote_name variable

When we read the remote config from disk, we update a
default_remote_name variable if we see branch.*.remote
config for the current branch. This isn't wrong, or even all
that complicated, but it is a bit simpler (because it
reduces our overall state) to just lazily compute the
default when we need it.

The ulterior motive here is that the push config uses a
similar structure, and _is_ much more complicated as a
result. That will be simplified in a future patch, and it's
more readable if the logic for remotes and push-remotes
matches.

Note that we also used default_remote_name as a signal that
the remote config has been loaded; after this patch, we now
use an explicit flag.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c