From: Finn Arne Gangstad <finnag@pvv.org>
To: git@vger.kernel.org
Subject: [PATCH 4/7] git push: Display warning on unconfigured default push
Date: Mon, 9 Mar 2009 23:35:48 +0100 [thread overview]
Message-ID: <1236638151-6465-5-git-send-email-finnag@pvv.org> (raw)
In-Reply-To: <1236638151-6465-1-git-send-email-finnag@pvv.org>
As a preparation for a possible future "git push" default behaviour change,
display a prominent warning for operations that may change behaviour
in the future. The warning explains for the user how to configure this
permanently so the warning will not be seen again after proper configuration.
Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
---
builtin-push.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/builtin-push.c b/builtin-push.c
index 5706c99..b9fe206 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -74,11 +74,34 @@ static void setup_push_current(struct remote *remote)
branch->merge[n]->src));
}
+static const char *warn_unconfigured_push_msg[] = {
+ "You did not specify any refspecs to push, and the current remote",
+ "has not configured any push refspecs. The default action in this",
+ "case has been to push all matching refspecs, that is, all branches",
+ "that exist both locally and remotely will be updated.",
+ "This default may change in the future.",
+ "",
+ "You can specify what action you want to take in this case, and",
+ "avoid seeing this message again, by configuring 'push.default' to:",
+ " 'nothing' : Do not push anythig",
+ " 'matching' : Push all matching branches (the current default)",
+ " 'current' : Push the current branch to whatever it is tracking",
+ ""
+};
+
+static void warn_unconfigured_push()
+{
+ int i;
+ for (i = 0; i < ARRAY_SIZE(warn_unconfigured_push_msg); i++)
+ warning("%s", warn_unconfigured_push_msg[i]);
+}
+
static void handle_default_push(struct remote *remote, int *flags)
{
git_config(git_default_config, NULL);
switch (push_default) {
case PUSH_DEFAULT_UNSPECIFIED:
+ warn_unconfigured_push();
/* fallthrough */
case PUSH_DEFAULT_MATCHING:
--
1.6.2.105.g6ff1f.dirty
next prev parent reply other threads:[~2009-03-09 23:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-09 22:35 [RFC/PATCH] git push usability improvements and default change Finn Arne Gangstad
2009-03-09 22:35 ` [PATCH 1/7] remote: Make "-" an alias for the current remote Finn Arne Gangstad
2009-03-09 22:35 ` [PATCH 2/7] New config option push.default Finn Arne Gangstad
2009-03-09 22:35 ` [PATCH 3/7] git push: New options --matching and --current Finn Arne Gangstad
2009-03-09 23:49 ` Daniel Barkalow
2009-03-10 8:54 ` Finn Arne Gangstad
2009-03-09 22:35 ` Finn Arne Gangstad [this message]
2009-03-10 0:25 ` [PATCH 4/7] git push: Display warning on unconfigured default push Jay Soffian
2009-03-09 22:35 ` [PATCH 5/7] git push: Document that "nothing" is the future push default Finn Arne Gangstad
2009-03-09 22:35 ` [PATCH 6/7] git push: Change default for "git push" to nothing Finn Arne Gangstad
2009-03-09 22:35 ` [PATCH 7/7] git push: Remove warning for "git push" default change Finn Arne Gangstad
2009-03-09 23:35 ` [RFC/PATCH] git push usability improvements and " Johannes Schindelin
2009-03-10 0:12 ` Junio C Hamano
2009-03-10 8:46 ` Finn Arne Gangstad
2009-03-10 11:01 ` Johannes Schindelin
2009-03-10 11:12 ` Finn Arne Gangstad
2009-03-10 0:07 ` Junio C Hamano
2009-03-10 0:19 ` Junio C Hamano
2009-03-10 10:04 ` Finn Arne Gangstad
2009-03-10 16:20 ` Jay Soffian
2009-03-11 20:35 ` Junio C Hamano
2009-03-12 3:01 ` Nanako Shiraishi
2009-03-12 10:22 ` Finn Arne Gangstad
2009-03-12 10:52 ` Miles Bader
2009-03-12 12:20 ` Finn Arne Gangstad
2009-03-13 8:28 ` Miles Bader
2009-03-13 10:07 ` John Tapsell
2009-03-10 17:52 ` Jeff King
2009-03-10 22:04 ` Finn Arne Gangstad
2009-03-10 22:10 ` Jeff King
2009-03-11 1:57 ` Jay Soffian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1236638151-6465-5-git-send-email-finnag@pvv.org \
--to=finnag@pvv.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).