aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-08-27 11:54:04 -0700
committerJunio C Hamano <gitster@pobox.com>2012-08-27 11:54:04 -0700
commitb9148c37637347cea7b448b57caeb2c58fe64979 (patch)
tree7c56aa0659579c762f86fbc43ff2e7270b1170f5
parentefa646213a7d65955fbf897f57139ec3737d62f8 (diff)
parentf2c2c90103eaff6f39a289c15b9dbc06efaaf2a8 (diff)
downloadgit-b9148c37637347cea7b448b57caeb2c58fe64979.tar.gz
git-b9148c37637347cea7b448b57caeb2c58fe64979.tar.xz
Merge branch 'mm/push-default-switch-warning'
In the next major release, we will switch "git push [$there]" that does not say what to push from the traditional "matching" to the updated "simple" semantics, that pushes the current branch to the branch with the same name only when the current branch is set to integrate with that remote branch (all other cases will error out). * mm/push-default-switch-warning: push: start warning upcoming default change for push.default
-rw-r--r--builtin/push.c29
-rwxr-xr-xt/t5541-http-push.sh5
2 files changed, 31 insertions, 3 deletions
diff --git a/builtin/push.c b/builtin/push.c
index fdfcc6c71..9ed558485 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -147,12 +147,37 @@ static void setup_push_upstream(struct remote *remote, int simple)
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 'simple'. 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 simple\n"
+ "\n"
+ "See 'git help config' and search for 'push.default' for further information.\n"
+ "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
+ "'current' instead of 'simple' if you sometimes use older versions of Git)");
+
+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:
default_matching_used = 1;
+ warn_unspecified_push_default_configuration();
/* fallthru */
case PUSH_DEFAULT_MATCHING:
add_refspec(":");
@@ -186,8 +211,8 @@ static const char message_advice_pull_before_push[] =
static const char message_advice_use_upstream[] =
N_("Updates were rejected because a pushed branch tip is behind its remote\n"
"counterpart. If you did not intend to push that branch, you may want to\n"
- "specify branches to push or set the 'push.default' configuration\n"
- "variable to 'current' or 'upstream' to push only the current branch.");
+ "specify branches to push or set the 'push.default' configuration variable\n"
+ "to 'simple', 'current' or 'upstream' to push only the current branch.");
static const char message_advice_checkout_pull_push[] =
N_("Updates were rejected because a pushed branch tip is behind its remote\n"
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index 312e48409..624633ace 100755
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
@@ -64,7 +64,10 @@ test_expect_success 'no empty path components' '
test_expect_success 'clone remote repository' '
rm -rf test_repo_clone &&
- git clone $HTTPD_URL/smart/test_repo.git test_repo_clone
+ git clone $HTTPD_URL/smart/test_repo.git test_repo_clone &&
+ (
+ cd test_repo_clone && git config push.default matching
+ )
'
test_expect_success 'push to remote repository (standard)' '