git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org, gitster@pobox.com,
	Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: [PATCH 2/4] push: introduce new push.default mode "simple"
Date: Fri, 20 Apr 2012 13:33:25 -0700	[thread overview]
Message-ID: <20120420203324.GB13103@sigill.intra.peff.net> (raw)
In-Reply-To: <1334933944-13446-3-git-send-email-Matthieu.Moy@imag.fr>

On Fri, Apr 20, 2012 at 04:59:02PM +0200, Matthieu Moy wrote:

> it has the same name remotely. If not, give an error that suggest the
> right command to push explicitely to 'upstream' or 'current'.

s/suggest/&s/

> beneficial on the next pull. Lacking better argument, we chose to deny
> the push, because it will be easier to change in the future is someone
> shows us wrong.

s/is/if/

> Original-patch-by: Jeff King <peff@peff.net>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> Except for the broken-ness, this adds the last line in the warning message:
> 
> "To chose either option permanently, read about push.default in git-config(1)"

I don't think that makes sense if I have set "push.default" to "simple"
myself. IOW, shouldn't that get added later, when it eventually becomes
the default (and then, only when it was chosen because it is the
default, not because somebody explicitly said they wanted it)?

> @@ -837,7 +839,7 @@ static int git_default_push_config(const char *var, const char *value)
>  			push_default = PUSH_DEFAULT_CURRENT;
>  		else {
>  			error("Malformed value for %s: %s", var, value);
> -			return error("Must be one of nothing, matching, "
> +			return error("Must be one of simple, nothing, matching, "
>  				     "tracking or current.");

Not your fault, but should this be s/tracking/upstream/ in the context
line?

> diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
> index c334c51..949dbdf 100755
> --- a/t/t5528-push-default.sh
> +++ b/t/t5528-push-default.sh
> @@ -13,6 +13,22 @@ test_expect_success 'setup bare remotes' '
>  	git push parent2 HEAD
>  '
>  
> +# $1 = local revision
> +# $2 = remote repository
> +# $3 = remote revision (tested to be equal to the local one)
> +check_pushed_commit () {
> +	git rev-parse "$1" > expect &&
> +	git --git-dir="$2" rev-parse "$3" > actual &&
> +	test_cmp expect actual
> +}

This is an extremely minor nit, but a test failure is often easier to
read if you use "log -1 --format=%s" here, assuming that the commits are
given reasonable subjects (so you get "-two\n+one" or similar instead of
some commit ids which aren't meaningful).

Also, I notice you take a repo argument here, but then all of the
callers just pass "repo1" (and the test_push_success function hardcodes
repo1).

> +test_expect_success 'push to existing branch, upstream configured with different name' '
> +	test_config branch.master.remote repo1 &&
> +	test_config branch.master.merge refs/heads/other-name &&
> +	git checkout master &&
> +	test_commit eight &&
> +	test_push_success upstream other-name &&
> +	test_commit nine &&
> +	test_must_fail git -c push.default=simple push &&
> +	test_push_success current master &&
> +	test_must_fail check_pushed_commit HEAD repo1 other-name
> +'

In the final must_fail, wouldn't it be more robust to use an affirmative
check that it was not touched, instead of checking that we failed to
find it to be equal (which could fail for other, unrelated reasons)?
Like this:

  check_pushed_commit HEAD^ repo1 other-name

I also wonder if it would make sense to wrap the whole "failed push"
thing in a function like this:

  test_push_failure() {
          git --git-dir=repo1 log -1 --format=%s "$2" >expect &&
          test_must_fail git -c push.default="$1" &&
          git --git-dir=repo1 log -1 --format=%s "$2" >actual &&
          test_cmp expect actual
  }

and then the earlier failures could also get this extra double-check for
free (that push not only reported failure, but that it failed without
actually touching the remote end, not for some unrelated reason).

That's all minor stuff; the bulk of the patch looks good to me.

-Peff

  reply	other threads:[~2012-04-20 20:33 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28 19:47 [ANNOUNCE] Git 1.7.10-rc3 Junio C Hamano
2012-03-29  9:52 ` Jeff King
2012-03-29 21:22   ` Junio C Hamano
2012-03-29 22:11     ` Jeff King
2012-03-30  1:54       ` Junio C Hamano
2012-03-30  7:13         ` push.default: current vs upstream Jeff King
2012-03-30 20:25           ` Junio C Hamano
2012-03-30 21:01             ` Jeff King
2012-03-30 21:28               ` Junio C Hamano
2012-03-30 21:53                 ` Jeff King
2012-03-30 22:15                   ` Junio C Hamano
2012-03-30 22:20                     ` Jeff King
2012-03-30 23:12                       ` Junio C Hamano
2012-03-31 22:49               ` Nathan Gray
2012-03-31 23:48                 ` Seth Robertson
2012-04-01  2:22                   ` Junio C Hamano
2012-04-01  5:58                   ` Nathan Gray
2012-04-02  7:40             ` Matthieu Moy
2012-04-02 16:48               ` Junio C Hamano
2012-04-02 17:20                 ` Matthieu Moy
2012-04-02 18:40                   ` Junio C Hamano
2012-04-02 18:58                     ` Matthieu Moy
2012-04-02 19:47                       ` Junio C Hamano
2012-04-02 20:40                         ` Matthieu Moy
2012-04-02 20:50                           ` Junio C Hamano
2012-04-02 21:02                           ` demerphq
2012-04-02 21:16                             ` Matthieu Moy
2012-04-04  7:57                               ` demerphq
2012-04-05 13:13               ` Jeff King
2012-04-05 16:46                 ` Matthieu Moy
2012-04-06  7:15                   ` Jeff King
2012-04-06  7:44                     ` Matthieu Moy
2012-04-06  8:00                       ` Jeff King
2012-04-06 17:41                         ` Junio C Hamano
2012-04-06 18:01                         ` Jehan Bing
2012-04-07  7:49                         ` Michael Haggerty
2012-04-07  7:51                           ` Jeff King
2012-04-07  8:40                             ` Andrew Sayers
2012-04-12  7:11                               ` Jeff King
2012-04-12 15:04                                 ` Junio C Hamano
2012-04-12 21:16                                 ` Andrew Sayers
2012-04-12 21:33                                   ` Junio C Hamano
2012-04-12 22:11                                     ` Jeff King
2012-04-12 22:59                                       ` Philip Oakley
2012-04-13 19:31                                         ` Junio C Hamano
2012-04-17 20:13                                     ` Andrew Sayers
2012-04-08  4:43                             ` Junio C Hamano
2012-04-11 16:17                               ` Matthieu Moy
2012-04-11 16:44                                 ` Junio C Hamano
2012-04-12  7:55                                 ` Jeff King
2012-04-12  8:09                                   ` Matthieu Moy
2012-04-12  8:14                                     ` Jeff King
2012-04-12  8:59                                       ` Matthieu Moy
2012-04-12 15:56                                         ` Junio C Hamano
2012-04-19 16:06                                           ` Junio C Hamano
2012-04-19 20:38                                             ` Matthieu Moy
2012-04-19 21:02                                               ` Junio C Hamano
2012-04-19 22:57                                               ` [RFC/PATCH 0/3] push.default upcomming change Matthieu Moy
2012-04-19 22:57                                                 ` [PATCH 1/3] push: introduce new push.default mode "simple" Matthieu Moy
2012-04-19 23:46                                                   ` Jeff King
2012-04-20 14:52                                                     ` Matthieu Moy
2012-04-20 14:59                                                       ` [PATCH 0/4 v2] push.default upcomming change Matthieu Moy
2012-04-20 14:59                                                         ` [PATCH 1/4] Documentation: explain push.default option a bit more Matthieu Moy
2012-04-20 20:13                                                           ` Jeff King
2012-04-20 21:28                                                             ` Junio C Hamano
2012-04-21  3:51                                                               ` Michael Haggerty
2012-04-21  4:08                                                                 ` Junio C Hamano
2012-04-21  5:01                                                                   ` Michael Haggerty
2012-04-21  5:42                                                                     ` Junio C Hamano
2012-04-20 14:59                                                         ` [PATCH 2/4] push: introduce new push.default mode "simple" Matthieu Moy
2012-04-20 20:33                                                           ` Jeff King [this message]
2012-04-22 16:24                                                             ` Zbigniew Jędrzejewski-Szmek
2012-04-20 21:42                                                           ` Junio C Hamano
2012-04-23  8:38                                                             ` Matthieu Moy
2012-04-20 14:59                                                         ` [PATCH 3/4] t5570: use explicit push refspec Matthieu Moy
2012-04-20 14:59                                                         ` [PATCH 4/4] push: start warning upcoming default change for push.default Matthieu Moy
2012-04-20 20:35                                                         ` [PATCH 0/4 v2] push.default upcomming change Jeff King
2012-04-22 11:05                                                           ` Matthieu Moy
2012-04-23  2:50                                                             ` Junio C Hamano
2012-04-23  8:37                                                         ` [PATCH 0/7 v3] " Matthieu Moy
2012-04-23  8:37                                                           ` [PATCH 1/7] Documentation: explain push.default option a bit more Matthieu Moy
2012-04-23 15:20                                                             ` Junio C Hamano
2012-04-23 19:00                                                             ` Philip Oakley
2012-04-23 19:11                                                               ` Junio C Hamano
2012-04-23 21:01                                                                 ` Philip Oakley
2012-04-23  8:37                                                           ` [PATCH 2/7] Undocument deprecated alias 'push.default=tracking' Matthieu Moy
2012-04-23 15:21                                                             ` Junio C Hamano
2013-01-31 17:10                                                             ` Ævar Arnfjörð Bjarmason
2013-01-31 17:35                                                               ` Junio C Hamano
2013-01-31 19:07                                                                 ` Jonathan Nieder
2013-01-31 19:11                                                                   ` Jonathan Nieder
2013-01-31 19:58                                                                     ` Junio C Hamano
2013-01-31 19:41                                                                   ` Junio C Hamano
2013-01-31 19:57                                                                     ` Jonathan Nieder
2013-01-31 20:01                                                                       ` Junio C Hamano
2013-01-31 20:11                                                                         ` Jonathan Nieder
2013-01-31 20:42                                                                           ` Junio C Hamano
2013-01-31 20:44                                                                             ` Junio C Hamano
2013-01-31 20:04                                                                     ` Jonathan Nieder
2013-01-31 20:08                                                                       ` Matthieu Moy
2013-01-31 20:21                                                                       ` Junio C Hamano
2013-01-31 20:50                                                                         ` Junio C Hamano
2013-01-31 21:00                                                                           ` Jonathan Nieder
2013-02-01  1:15                                                                             ` Junio C Hamano
2013-01-31 21:08                                                                         ` Jonathan Nieder
2013-01-31 20:41                                                                       ` Philip Oakley
2012-04-23  8:38                                                           ` [PATCH 3/7] t5528-push-default.sh: add helper functions Matthieu Moy
2012-04-23 15:36                                                             ` Junio C Hamano
2012-04-23 16:02                                                               ` Matthieu Moy
2012-04-23 16:16                                                                 ` Junio C Hamano
2012-04-23 16:20                                                                   ` Matthieu Moy
2012-04-23 16:57                                                                     ` Matthieu Moy
2012-04-23 17:09                                                                       ` Junio C Hamano
2012-04-23 16:42                                                                   ` Junio C Hamano
2012-04-23 16:45                                                                     ` [PATCH 2/3] fixup! " Junio C Hamano
2012-04-23 16:48                                                                     ` [PATCH 3/3] push: suggested updates to push configuration documentation Junio C Hamano
2012-04-23  8:38                                                           ` [PATCH 4/7] push: introduce new push.default mode "simple" Matthieu Moy
2012-04-23 10:32                                                             ` Michael Haggerty
2012-04-23 11:20                                                               ` Matthieu Moy
2012-04-23 15:52                                                             ` Junio C Hamano
2012-04-23 16:09                                                               ` Matthieu Moy
2012-04-23  8:38                                                           ` [PATCH 5/7] t5570: use explicit push refspec Matthieu Moy
2012-04-23  8:38                                                           ` [PATCH 6/7] push: document the future default change for push.default (matching -> simple) Matthieu Moy
2012-04-23  8:38                                                           ` [PATCH 7/7] push: start warning upcoming default change for push.default Matthieu Moy
2012-04-24  7:49                                                           ` [PATCH 0/7 v4] push.default upcomming change Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 1/7] Documentation: explain push.default option a bit more Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 2/7] Undocument deprecated alias 'push.default=tracking' Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 3/7] t5528-push-default.sh: add helper functions Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 4/7] push: introduce new push.default mode "simple" Matthieu Moy
2012-04-25  1:53                                                               ` Junio C Hamano
2012-04-25 11:01                                                                 ` Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 5/7] t5570: use explicit push refspec Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 6/7] push: document the future default change for push.default (matching -> simple) Matthieu Moy
2012-04-24  7:50                                                             ` [PATCH 7/7] push: start warning upcoming default change for push.default Matthieu Moy
2012-04-24 19:28                                                             ` [PATCH 0/7 v4] push.default upcomming change Junio C Hamano
2012-04-19 22:57                                                 ` [PATCH 2/3] t5570: use explicit push refspec Matthieu Moy
2012-04-19 22:57                                                 ` [PATCH 3/3] push: start warning upcoming default change for push.default Matthieu Moy
2012-04-26  5:44                                                   ` [PATCH] t5541: warning message is given even with --quiet Junio C Hamano
2012-04-26  6:31                                                     ` Matthieu Moy
2012-04-11  2:08                     ` [RFC/PATCH] Give better 'pull' advice when pushing non-ff updates to current branch Christopher Tiwald
2012-04-06 11:38                   ` push.default: current vs upstream Dmitry Potapov
2012-04-06 13:36                     ` demerphq
2012-04-06 18:03                       ` Dmitry Potapov
2012-04-06 18:48                         ` demerphq
2012-04-06 19:38                           ` Dmitry Potapov
2012-03-30 23:07           ` Junio C Hamano
2012-04-03 20:59             ` Jeff King
2012-04-03 21:04               ` Jeff King
2012-04-03 22:29               ` Junio C Hamano
2012-04-03 23:23                 ` Junio C Hamano
2012-04-05 12:45                 ` Jeff King
2012-04-08 12:52           ` Felipe Contreras

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=20120420203324.GB13103@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    /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).