Skip to content

Commit 8770e6f

Browse files
peffgitster
authored andcommitted
remote.c: hoist read_config into remote_get_1
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent da66b27 commit 8770e6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,8 @@ static struct remote *remote_get_1(const char *name,
718718
struct remote *ret;
719719
int name_given = 0;
720720

721+
read_config();
722+
721723
if (name)
722724
name_given = 1;
723725
else
@@ -741,13 +743,11 @@ static struct remote *remote_get_1(const char *name,
741743

742744
struct remote *remote_get(const char *name)
743745
{
744-
read_config();
745746
return remote_get_1(name, remote_for_branch);
746747
}
747748

748749
struct remote *pushremote_get(const char *name)
749750
{
750-
read_config();
751751
return remote_get_1(name, pushremote_for_branch);
752752
}
753753

0 commit comments

Comments
 (0)