Thread (16 messages) flat view 16 messages, 1 author, 2016-06-15
DORMANTno replies

Revision v3 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v3 current

[PATCH v3 06/14] remote.c: hoist read_config into remote_get_1

From: Jeff King <hidden>
Date: 2016-06-15 23:04:51
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 remote.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/remote.c b/remote.c
index a91d063..e6b29b3 100644
--- a/remote.c
+++ b/remote.c
@@ -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
@@ -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);
 }
 
-- 
2.4.1.528.g00591e3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help