From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH 3/3] git-remote-mediawiki: obey advice.pushNonFastForward
Date: Tue, 27 Sep 2011 19:55:00 +0200 [thread overview]
Message-ID: <1317146100-22938-3-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1317146100-22938-1-git-send-email-Matthieu.Moy@imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
contrib/mw-to-git/git-remote-mediawiki | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki
index 9bb58ab..b809792 100755
--- a/contrib/mw-to-git/git-remote-mediawiki
+++ b/contrib/mw-to-git/git-remote-mediawiki
@@ -603,13 +603,16 @@ sub mw_import_ref {
}
sub error_non_fast_forward {
- # Native git-push would show this after the summary.
- # We can't ask it to display it cleanly, so print it
- # ourselves before.
- print STDERR "To prevent you from losing history, non-fast-forward updates were rejected\n";
- print STDERR "Merge the remote changes (e.g. 'git pull') before pushing again. See the\n";
- print STDERR "'Note about fast-forwards' section of 'git push --help' for details.\n";
-
+ my $advice = run_git("config --bool advice.pushNonFastForward");
+ chomp($advice);
+ if ($advice ne "false") {
+ # Native git-push would show this after the summary.
+ # We can't ask it to display it cleanly, so print it
+ # ourselves before.
+ print STDERR "To prevent you from losing history, non-fast-forward updates were rejected\n";
+ print STDERR "Merge the remote changes (e.g. 'git pull') before pushing again. See the\n";
+ print STDERR "'Note about fast-forwards' section of 'git push --help' for details.\n";
+ }
print STDOUT "error $_[0] \"non-fast-forward\"\n";
return 0;
}
--
1.7.7.rc0.75.g56f27
next prev parent reply other threads:[~2011-09-27 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 17:54 [PATCH 1/3] git-remote-mediawiki: trivial fixes Matthieu Moy
2011-09-27 17:54 ` [PATCH 2/3] git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts Matthieu Moy
2011-09-27 17:55 ` Matthieu Moy [this message]
2011-09-28 13:48 ` [PATCH] git-remote-mediawiki: allow a domain to be set for authentication Matthieu Moy
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=1317146100-22938-3-git-send-email-Matthieu.Moy@imag.fr \
--to=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.
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).