Skip to content

Commit

Permalink
remote.c: hoist read_config into remote_get_1
Browse files Browse the repository at this point in the history
Before the previous commit, we had to make sure that
read_config() was called before entering remote_get_1,
because we needed to pass pushremote_name by value. But now
that we pass a function, we can let remote_get_1 handle
loading the config itself, turning our wrappers into true
one-liners.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 21, 2015
1 parent da66b27 commit 8770e6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ static struct remote *remote_get_1(const char *name,
struct remote *ret;
int name_given = 0;

read_config();

if (name)
name_given = 1;
else
Expand All @@ -741,13 +743,11 @@ static struct remote *remote_get_1(const char *name,

struct remote *remote_get(const char *name)
{
read_config();
return remote_get_1(name, remote_for_branch);
}

struct remote *pushremote_get(const char *name)
{
read_config();
return remote_get_1(name, pushremote_for_branch);
}

Expand Down

0 comments on commit 8770e6f

Please sign in to comment.