Skip to content

Commit fd47d7b

Browse files
moygitster
authored andcommitted
git-remote-mediawiki: obey advice.pushNonFastForward
Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c1ed90 commit fd47d7b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

contrib/mw-to-git/git-remote-mediawiki

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -603,13 +603,16 @@ sub mw_import_ref {
603603
}
604604

605605
sub error_non_fast_forward {
606-
# Native git-push would show this after the summary.
607-
# We can't ask it to display it cleanly, so print it
608-
# ourselves before.
609-
print STDERR "To prevent you from losing history, non-fast-forward updates were rejected\n";
610-
print STDERR "Merge the remote changes (e.g. 'git pull') before pushing again. See the\n";
611-
print STDERR "'Note about fast-forwards' section of 'git push --help' for details.\n";
612-
606+
my $advice = run_git("config --bool advice.pushNonFastForward");
607+
chomp($advice);
608+
if ($advice ne "false") {
609+
# Native git-push would show this after the summary.
610+
# We can't ask it to display it cleanly, so print it
611+
# ourselves before.
612+
print STDERR "To prevent you from losing history, non-fast-forward updates were rejected\n";
613+
print STDERR "Merge the remote changes (e.g. 'git pull') before pushing again. See the\n";
614+
print STDERR "'Note about fast-forwards' section of 'git push --help' for details.\n";
615+
}
613616
print STDOUT "error $_[0] \"non-fast-forward\"\n";
614617
return 0;
615618
}

0 commit comments

Comments
 (0)