Skip to content

Commit

Permalink
git-remote-mediawiki: obey advice.pushNonFastForward
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Matthieu Moy authored and Junio C Hamano committed Sep 27, 2011
1 parent 3c1ed90 commit fd47d7b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions contrib/mw-to-git/git-remote-mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fd47d7b

Please sign in to comment.