diff options
author | Matthieu Moy <Matthieu.Moy@imag.fr> | 2011-09-27 19:55:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-09-27 11:25:03 -0700 |
commit | fd47d7b94dba1a6f3e38815d364200907ebd68f3 (patch) | |
tree | 1a86fd51ce26af95e13b650b671cbd020d9697a5 /contrib | |
parent | 3c1ed90ec3973404ffcff99103faa5b863889f98 (diff) | |
download | git-fd47d7b94dba1a6f3e38815d364200907ebd68f3.tar.gz git-fd47d7b94dba1a6f3e38815d364200907ebd68f3.tar.xz |
git-remote-mediawiki: obey advice.pushNonFastForward
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-x | 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 9bb58ab65..b80979285 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; } |