From: Clemens Buchacher <drizzd@aon.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christopher Tiwald <christiwald@gmail.com>,
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH] push: Provide situational hints for non-fast-forward errors
Date: Fri, 16 Mar 2012 10:10:19 +0100 [thread overview]
Message-ID: <20120316091019.GB22273@ecki> (raw)
In-Reply-To: <7vlin1gl9l.fsf@alter.siamese.dyndns.org>
On Thu, Mar 15, 2012 at 10:36:22PM -0700, Junio C Hamano wrote:
>
> +static const char message_advice_pull_before_push[] =
> + N_("Update was rejected because the tip of your current branch is behind\n"
> + "the remote. Merge the remote changes (e.g. 'git pull') before\n"
> + "pushing again. See the 'Note about fast-forwards' section of\n"
> + "'git push --help' for details.");
> +
> +
> +static const char message_advice_use_upstream[] =
> + N_("Some of your local branches were stale with respect to their\n"
> + "remote counterparts. If you did not intend to push these branches,\n"
> + "you may want to set the 'push.default' configuration variable to\n"
> + "'current' or 'upstream' to push only the current branch.");
> +
> +static const char message_advice_checkout_pull_push[] =
> + N_("Updates were rejected because the tip of some of your branches are\n"
> + "behind the remote. Check out the branch and merge the remote\n"
> + "changes (e.g. 'git pull') before pushing again. See the\n"
> + "'Note about fast-forwards' section of 'git push --help'\n"
> + "for details.");
The first sentence of the above two warnings state the same thing, but
in different ways. Yet the difference does not reflect the different
situations. They should be the same, or maybe the first one should be
changed to the following variant of the second:
"Updates were rejected because the tip of some of your branches are
behind the remote branches with matching names."
I like that you changed the advice to 'current' _or_ 'upstream'. But
maybe the variable name should change from message_advice_use_upstream
to message_advice_push_default.
> - if (nonfastforward == NONFASTFORWARD_HEAD) {
> + switch (nonfastforward) {
> + default:
> + break;
> + case NON_FF_HEAD:
> advise_pull_before_push();
> - } else if (nonfastforward == NONFASTFORWARD_OTHER) {
> + break;
> + case NON_FF_OTHER:
> if (default_matching_used)
> advise_use_upstream();
> else
> advise_checkout_pull_push();
> + break;
> }
We should not give advise_use_upstream if the user specified git push
--all. The advice_checkout_pull_push would make more sense in that case.
Actually, if the user decides that matching branches is indeed the
default they want to use, advise_checkout_pull_push would still be
helpful. So I think advise_checkout_pull_push should be given in any
case, while advise_use_upstream should be added if push.default=matching
and the user did not say git push --all.
next prev parent reply other threads:[~2012-03-16 9:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 23:22 [PATCH] push: Provide situational hints for non-fast-forward errors Christopher Tiwald
2012-03-14 4:27 ` Junio C Hamano
2012-03-14 12:14 ` Zbigniew Jędrzejewski-Szmek
2012-03-14 13:00 ` Matthieu Moy
2012-03-14 14:27 ` Zbigniew Jędrzejewski-Szmek
2012-03-14 16:40 ` Christopher Tiwald
2012-03-15 8:54 ` Clemens Buchacher
2012-03-15 18:06 ` Junio C Hamano
2012-03-16 8:19 ` Matthieu Moy
2012-03-14 14:48 ` Christopher Tiwald
2012-03-14 14:53 ` Christopher Tiwald
2012-03-14 9:06 ` Matthieu Moy
2012-03-14 15:52 ` Christopher Tiwald
2012-03-14 17:26 ` Junio C Hamano
2012-03-16 5:36 ` Junio C Hamano
2012-03-16 9:10 ` Clemens Buchacher [this message]
2012-03-16 12:03 ` Junio C Hamano
2012-03-16 17:20 ` Christopher Tiwald
2012-03-16 18:07 ` Junio C Hamano
2012-03-16 22:00 ` Junio C Hamano
2012-03-16 21:41 ` Clemens Buchacher
2012-03-16 21:53 ` Junio C Hamano
2012-03-16 22:01 ` Clemens Buchacher
2012-03-16 22:10 ` Junio C Hamano
2012-03-17 17:10 ` [fixup PATCH] " Zbigniew Jędrzejewski-Szmek
2012-03-17 18:46 ` Christopher Tiwald
2012-03-17 19:42 ` Zbigniew Jędrzejewski-Szmek
2012-03-19 0:15 ` Junio C Hamano
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=20120316091019.GB22273@ecki \
--to=drizzd@aon.at \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=christiwald@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).