summaryrefslogtreecommitdiff
path: root/builtin/push.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2012-03-09 09:31:26 +0100
committerJunio C Hamano <gitster@pobox.com>2012-03-09 17:07:36 -0800
commit5293b54a218cc9ec7c667f64d4b10cd0d985203f (patch)
tree64b10812c54c442a182c525c2dd88d5ba234078b /builtin/push.c
parent42e52e358be1da6e3500a8d0d930ed08a8dd3715 (diff)
downloadgit-mm/push-default-switch-warning.tar.gz
push: start warning upcoming default change for push.defaultmm/push-default-switch-warning
In preparation for flipping the default to the "upstream" mode from the "matching" mode that is the historical default, start warning users when they rely on unconfigured "git push" to default to the "matching" mode. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/builtin/push.c b/builtin/push.c
index d315475f16..7f933d193d 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -91,10 +91,35 @@ static void setup_push_upstream(struct remote *remote)
add_refspec(refspec.buf);
}
+static char warn_unspecified_push_default_msg[] =
+N_("push.default is unset; its implicit value is changing in\n"
+ "Git 2.0 from 'matching' to 'upstream'. To squelch this message\n"
+ "and maintain the current behavior after the default changes, use:\n"
+ "\n"
+ " git config --global push.default matching\n"
+ "\n"
+ "To squelch this message and adopt the new behavior now, use:\n"
+ "\n"
+ " git config --global push.default upstream\n"
+ "\n"
+ "See 'git help config' and search for 'push.default' for further information.");
+
+static void warn_unspecified_push_default_configuration(void)
+{
+ static int warn_once;
+
+ if (warn_once++)
+ return;
+ warning("%s\n", _(warn_unspecified_push_default_msg));
+}
+
static void setup_default_push_refspecs(struct remote *remote)
{
switch (push_default) {
default:
+ case PUSH_DEFAULT_UNSPECIFIED:
+ warn_unspecified_push_default_configuration();
+ /* fallthru */
case PUSH_DEFAULT_MATCHING:
add_refspec(":");
break;