Skip to contentSkip to conversation

push: always load default config

PATCH New Jeff King 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 push: always load default config

This is needed because we want to use the
advice.pushnonfastforward variable.

Previously, we would load the config on demand only when we needed to look at push.default. Which meant that "git push" would load it, but "git push remote" would not, leading to differing behavior.

---
 builtin-push.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
builtin-push.c +2 -1
index b5cd2cd..7338176 100644
@@ -66,7 +66,6 @@ static void setup_push_tracking(void)
 
 static void setup_default_push_refspecs(void)
 {
-	git_config(git_default_config, NULL);
 	switch (push_default) {
 	default:
 	case PUSH_DEFAULT_MATCHING:
@@ -174,6 +173,8 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 	int rc;
 	const char *repo = NULL;	/* default repository */
 
+	git_config(git_default_config, NULL);
+
 	struct option options[] = {
 		OPT_BIT('q', "quiet", &flags, "be quiet", TRANSPORT_PUSH_QUIET),
 		OPT_BIT('v', "verbose", &flags, "be verbose", TRANSPORT_PUSH_VERBOSE),
Signature · 1 line
1.6.4.2.269.g75194.dirty