[PATCH 3/3] git-remote-mediawiki: obey advice.pushNonFastForward

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]