git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Carlos Martín Nieto" <cmn@elego.de>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [RFC PATCH] push: start warning upcoming default change for push.default
Date: Fri, 09 Mar 2012 11:25:15 +0100	[thread overview]
Message-ID: <1331288715.21444.38.camel@beez.lab.cmartin.tk> (raw)
In-Reply-To: <1331281886-11667-1-git-send-email-Matthieu.Moy@imag.fr>

[-- Attachment #1: Type: text/plain, Size: 4687 bytes --]

On Fri, 2012-03-09 at 09:31 +0100, Matthieu Moy wrote:
> More inexperienced users will often push right after committing, and at
> that time they're still very much in the "working-on-one-branch" state of
> mind.  "upstream" would be a safer default mode of operation for 'git push'
> for them even when they have their personal publishing repository (also in
> a shared public repository settings, "matching" is rarely the right
> default mode).
> 
> In preparation for flipping the default to the "upstream" mode from the
> "matching" mode that is the upstream default, start warning users when they
> rely on unconfigured "git push" to default to the "matching" mode.
> 
> Original patch and commit message by: Junio C Hamano <gitster@pobox.com>
> 
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> 
> This patch prepares a transition to 'upstream', unlike the previous
> version which was advertizing 'current'. In most case, this would be
> the same, but 'upstream' is probably more sensible in case it points
> to a branch other than 'current'. I don't care much either way.
> 

For people using git as VCS that happens to have local history rather
than taking full advantage of the distributed nature (or who aren't
aware of it or don't get it), 'matching' is bound to be confusing.
However, IMO 'current' makes more sense. Consider

    git clone ../foo; cd foo;
    git checkout -b topic origin/develop
    ed main.c
    git push

With upstream I've just updated origin's dev branch, even though I might
have meant to create a new 'topic' branch. Alternatively, I might have
run

    git checkout -b topic

in which case I certainly want 'current'. I don't see that workflow
where the upstream branch is named differently from the local one should
be that big a consideration when trying to determine a default to help
people unfamiliar as they'd be certainly more likely to consider branch
names to be binding. Maybe you have seen this differently in your
students, but that's the impression I get from #git.

They also seem to expect 'git pull' to be magic, but that's a different
story.

> I've kept the wording from the original patch, which commits to a
> future change. We may instead relax this commitment and just say "the
> default is likely to change in a future version", or so.
> 
>  builtin/push.c |   22 ++++++++++++++++++++++
>  cache.h        |    1 +
>  environment.c  |    2 +-
>  3 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/builtin/push.c b/builtin/push.c
> index d315475..03545c0 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -91,10 +91,32 @@ static void setup_push_upstream(struct remote *remote)
>  	add_refspec(refspec.buf);
>  }
>  
> +static void warn_unspecified_push_default_configuration(void)
> +{
> +	static int warn_once;
> +
> +	if (warn_once++)
> +		return;
> +	warning(_("push.default is unset; its implicit value is changing in 1.8.0 from\n"
> +		  "'matching' to 'upstream'. To squelch this message and maintain the current\n"
> +		  "behavior post-1.8.0, use:\n"
> +		  "\n"
> +		  "  git config --global push.default matching\n"
> +		  "\n"
> +		  "To squelch this message and adopt the 1.8.0 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.\n"));
> +}
> +
>  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;
> diff --git a/cache.h b/cache.h
> index e12b15f..e5c3f26 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -622,6 +622,7 @@ enum rebase_setup_type {
>  };
>  
>  enum push_default_type {
> +	PUSH_DEFAULT_UNSPECIFIED = -1,
>  	PUSH_DEFAULT_NOTHING = 0,
>  	PUSH_DEFAULT_MATCHING,
>  	PUSH_DEFAULT_UPSTREAM,
> diff --git a/environment.c b/environment.c
> index c93b8f4..d7e6c65 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -52,7 +52,7 @@ enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
>  unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
>  enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
>  enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
> -enum push_default_type push_default = PUSH_DEFAULT_MATCHING;
> +enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
>  #ifndef OBJECT_CREATION_MODE
>  #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
>  #endif



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  parent reply	other threads:[~2012-03-09 10:25 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 10:01 git push default behaviour? Jeremy Morton
2012-03-08 10:11 ` Thomas Rast
2012-03-08 10:13   ` Jeremy Morton
2012-03-08 10:28     ` Carlos Martín Nieto
2012-03-08 10:38       ` Jeremy Morton
2012-03-08 10:42         ` Carlos Martín Nieto
2012-03-08 10:43           ` Jeremy Morton
2012-03-08 18:22             ` Junio C Hamano
2012-03-08 18:35               ` Matthieu Moy
2012-03-08 19:03                 ` Andreas Krey
2012-03-08 19:29                 ` Junio C Hamano
2012-03-09  8:05                   ` Matthieu Moy
2012-03-09  9:50                     ` Junio C Hamano
2012-03-09 11:28                       ` Jeremy Morton
2012-03-09 11:54                       ` Matthieu Moy
2012-03-09 14:42                       ` Jakub Narebski
2012-03-19  6:02             ` Miles Bader
2012-03-19 16:12               ` Philippe Vaucher
2012-03-08 15:00           ` Marc Branchaud
2012-03-08 15:26             ` Matthieu Moy
2012-03-08 17:49               ` Dmitry Potapov
2012-03-08 18:04                 ` Matthieu Moy
2012-03-09  3:38                   ` Jeff King
2012-03-09  5:23                     ` Junio C Hamano
2012-03-09  5:38                       ` Junio C Hamano
2012-03-09  8:06                         ` demerphq
2012-03-09  8:48                           ` Thomas Rast
2012-03-09  9:50                             ` Junio C Hamano
2012-03-16  9:38                             ` Gelonida N
2012-03-09  8:25                       ` Matthieu Moy
2012-03-09  8:31                         ` [RFC PATCH] push: start warning upcoming default change for push.default Matthieu Moy
2012-03-09 10:01                           ` Junio C Hamano
2012-03-09 20:21                             ` Junio C Hamano
2012-03-09 10:25                           ` Carlos Martín Nieto [this message]
2012-03-09 18:30                             ` Marc Branchaud
2012-03-09 21:08                               ` Stefan Haller
2012-03-10 21:05                                 ` Junio C Hamano
2012-03-11 20:26                                   ` Stefan Haller
2012-03-12  8:47                                     ` Matthieu Moy
2012-03-12 11:22                                       ` Stefan Haller
2012-03-12 12:46                                         ` Matthieu Moy
2012-03-12 16:11                                           ` Junio C Hamano
2012-03-12 15:10                                 ` Marc Branchaud
2012-03-10  6:16                               ` Michael Haggerty
2012-03-12 15:13                                 ` Marc Branchaud
2012-03-12 16:37                                   ` Matthieu Moy
2012-03-12 17:53                                     ` Junio C Hamano
2012-03-12 18:37                                     ` Jeff King
2012-03-12 19:06                                       ` Junio C Hamano
2012-03-12 19:33                                         ` Junio C Hamano
2012-03-12 20:16                                         ` Marc Branchaud
2012-03-13  9:40                                           ` Matthieu Moy
2012-03-13  9:36                                         ` Matthieu Moy
2012-03-13 21:30                                         ` Jeff King
2012-03-13 22:54                                           ` Junio C Hamano
2012-03-14 13:50                                             ` Jeff King
2012-03-14 20:59                                               ` Junio C Hamano
2012-03-13  9:34                                       ` Matthieu Moy
2012-03-13 13:17                                         ` Junio C Hamano
2012-03-13 13:35                                           ` Matthieu Moy
2012-03-13 20:01                                             ` Auto-matching upstream branches by name (was: [RFC PATCH] push: start warning upcoming default change for push.default) Stefan Haller
2012-03-14  9:10                                               ` Auto-matching upstream branches by name Matthieu Moy
2012-03-13 14:31                                           ` [RFC PATCH] push: start warning upcoming default change for push.default Marc Branchaud
2012-03-13 14:59                                           ` Holger Hellmuth
2012-03-13 17:41                                             ` Junio C Hamano
2012-03-14 19:15                                               ` Holger Hellmuth
2012-03-15  8:02                                                 ` Matthieu Moy
2012-03-15 10:43                                                   ` Holger Hellmuth
2012-03-13 15:02                                           ` Andreas Ericsson
2012-03-13 21:35                                           ` Jeff King
2012-03-13 18:08                                         ` Dmitry Potapov
2012-03-14  4:46                                           ` Junio C Hamano
2012-03-14 12:47                                             ` Dmitry Potapov
2012-03-14 17:29                                               ` Junio C Hamano
2012-03-14 17:49                                                 ` Dmitry Potapov
2012-03-14 20:44                                                   ` Junio C Hamano
2012-03-14  9:07                                           ` Matthieu Moy
2012-03-14 13:23                                             ` Dmitry Potapov
2012-03-14 14:47                                               ` Matthieu Moy
2012-03-14 17:47                                                 ` Dmitry Potapov
2012-03-15  8:05                                                   ` Matthieu Moy
2012-03-14  8:59                                       ` Michael Haggerty
2012-03-14 14:00                                         ` Jeff King
2012-03-09 11:26                           ` Ævar Arnfjörð Bjarmason
2012-03-16  8:51                           ` Clemens Buchacher
2012-03-16  9:43                             ` Matthieu Moy
2012-03-16 12:05                               ` Junio C Hamano
2012-03-16 12:42                                 ` Matthieu Moy
2012-03-16 21:48                                   ` Clemens Buchacher
2012-03-17 20:46                                     ` Matthieu Moy
2012-03-19 16:11                           ` Andrew Myers
2012-03-09  9:57                         ` git push default behaviour? Junio C Hamano
2012-03-09 12:11                           ` Matthieu Moy
2012-03-09 16:22                             ` Junio C Hamano
2012-03-09 17:44                               ` Junio C Hamano
2012-03-09 14:56                           ` Jakub Narebski
2012-03-09 16:23                             ` Junio C Hamano
2012-03-13 15:18                               ` Jakub Narebski
2012-03-12  9:34                           ` Matthieu Moy
2012-03-12 16:29                             ` Junio C Hamano
2012-03-13  9:47                               ` Matthieu Moy
2012-03-13 12:34                                 ` Junio C Hamano
2012-03-16 19:35                                   ` Junio C Hamano
2012-03-17 15:49                           ` Eric Hanchrow
2012-03-08 17:37             ` Dmitry Potapov
2012-03-08 11:33         ` Jakub Narebski
2012-03-08 11:34           ` Jeremy Morton
2012-03-13 15:27             ` Jakub Narebski
2012-03-14 12:12               ` Jeremy Morton
2012-03-14 17:16                 ` Jakub Narebski
2012-03-08 11:54       ` Matthieu Moy
2012-03-08 12:12         ` demerphq
2012-03-17  9:36 ` Sebastien Douche
2012-03-17  9:38   ` Jeremy Morton
2012-03-17  9:51     ` Sebastien Douche
2012-03-18 10:26       ` Pavel Pospíšil

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331288715.21444.38.camel@beez.lab.cmartin.tk \
    --to=cmn@elego.de \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).