git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Sep 27, 2011, 17:55 UTC
Message-ID
<1317146100-22938-3-git-send-email-Matthieu.Moy@imag.fr>
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
Previous: Matthieu MoyNext: Matthieu Moy
Message 3 of 4 in “git-remote-mediawiki: trivial fixes”
  1. 1/3 git-remote-mediawiki: trivial fixesMatthieu Moy, Sep 27, 2011
  2. 2/3 git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflictsMatthieu Moy, Sep 27, 2011
  3. 3/3 git-remote-mediawiki: obey advice.pushNonFastForwardMatthieu Moy, Sep 27, 2011
  4. git-remote-mediawiki: allow a domain to be set for authenticationMatthieu Moy, Sep 28, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.