From 06038cd7b7646333f15de663b7564cf390dcefbe Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 16 Feb 2015 00:46:30 -0500 Subject: git_push_config: drop cargo-culted wt_status pointer The push config callback does not expect any incoming data via the void pointer. And if it did, it would certainly not be a "struct wt_status". This probably got picked up accidentally in b945901 (push: heed user.signingkey for signed pushes, 2014-10-22), which copied the template for the config callback from builtin/commit.c. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/push.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'builtin/push.c') diff --git a/builtin/push.c b/builtin/push.c index fc771a9f6f..aa9334c9c4 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -473,13 +473,12 @@ static int option_parse_recurse_submodules(const struct option *opt, static int git_push_config(const char *k, const char *v, void *cb) { - struct wt_status *s = cb; int status; status = git_gpg_config(k, v, NULL); if (status) return status; - return git_default_config(k, v, s); + return git_default_config(k, v, NULL); } int cmd_push(int argc, const char **argv, const char *prefix) -- cgit v1.2.3 From d16c33b4c11cda583ca2b6f7b81da3ac2fdebfa4 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 16 Feb 2015 01:12:04 -0500 Subject: cmd_push: set "atomic" bit directly This makes the code shorter and more obvious by removing an unnecessary interim variable. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/push.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'builtin/push.c') diff --git a/builtin/push.c b/builtin/push.c index aa9334c9c4..1e7ac8db33 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -486,7 +486,6 @@ int cmd_push(int argc, const char **argv, const char *prefix) int flags = 0; int tags = 0; int rc; - int atomic = 0; const char *repo = NULL; /* default repository */ struct option options[] = { OPT__VERBOSITY(&verbosity), @@ -518,7 +517,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) OPT_BIT(0, "follow-tags", &flags, N_("push missing but relevant tags"), TRANSPORT_PUSH_FOLLOW_TAGS), OPT_BIT(0, "signed", &flags, N_("GPG sign the push"), TRANSPORT_PUSH_CERT), - OPT_BOOL(0, "atomic", &atomic, N_("request atomic transaction on remote side")), + OPT_BIT(0, "atomic", &flags, N_("request atomic transaction on remote side"), TRANSPORT_PUSH_ATOMIC), OPT_END() }; @@ -534,9 +533,6 @@ int cmd_push(int argc, const char **argv, const char *prefix) if (tags) add_refspec("refs/tags/*"); - if (atomic) - flags |= TRANSPORT_PUSH_ATOMIC; - if (argc > 0) { repo = argv[0]; set_refspecs(argv + 1, argc - 1, repo); -- cgit v1.2.3 From 06c21e18abc9ae4647c79449a9b0a1554553ad03 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 16 Feb 2015 01:13:25 -0500 Subject: cmd_push: pass "flags" pointer to config callback This will let us manipulate any transport flags which have matching config options (there are none yet, but we will add one in the next patch). We could also just make "flags" a static file-scope global, but the result is a little confusing. We end up passing it along through do_push and push_with_options, each of which further munge it. Having slightly-differing versions of the flags variable available to those functions would probably cause more confusion than it is worth. Let's just keep the original local to cmd_push, and it can continue to pass it through the call-stack. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/push.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/push.c') diff --git a/builtin/push.c b/builtin/push.c index 1e7ac8db33..bba22b86b9 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -522,7 +522,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) }; packet_trace_identity("push"); - git_config(git_push_config, NULL); + git_config(git_push_config, &flags); argc = parse_options(argc, argv, prefix, options, push_usage, 0); if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR)))) -- cgit v1.2.3 From a8bc269f11b34e60f5fdbd8e831a654dd6b6b67e Mon Sep 17 00:00:00 2001 From: Dave Olszewski Date: Mon, 16 Feb 2015 01:16:19 -0500 Subject: push: allow --follow-tags to be set by config push.followTags Signed-off-by: Dave Olszewski Helped-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/push.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'builtin/push.c') diff --git a/builtin/push.c b/builtin/push.c index bba22b86b9..57c138bd7b 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -473,11 +473,21 @@ static int option_parse_recurse_submodules(const struct option *opt, static int git_push_config(const char *k, const char *v, void *cb) { + int *flags = cb; int status; status = git_gpg_config(k, v, NULL); if (status) return status; + + if (!strcmp(k, "push.followtags")) { + if (git_config_bool(k, v)) + *flags |= TRANSPORT_PUSH_FOLLOW_TAGS; + else + *flags &= ~TRANSPORT_PUSH_FOLLOW_TAGS; + return 0; + } + return git_default_config(k, v, NULL); } -- cgit v1.2.3