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

[PATCH] git-remote-mediawiki: Fix a bug in a regexp

From
Célestin Matte <celestin.matte@ensimag.fr>
Date
Jun 8, 2013, 13:35 UTC
Message-ID
<1370698510-11649-1-git-send-email-celestin.matte@ensimag.fr>

In Perl, '\n' is not a newline, but instead a literal backslash followed by an "n". As the output of "rev-list --first-parent" is line-oriented, what we want here is a newline.

Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
---
 contrib/mw-to-git/git-remote-mediawiki.perl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 7af202f..a06bc31 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -1190,7 +1190,7 @@ sub mw_push_revision {
 		# history (linearized with --first-parent)
 		print STDERR "Warning: no common ancestor, pushing complete history\n";
 		my $history = run_git("rev-list --first-parent --children $local");
-		my @history = split('\n', $history);
+		my @history = split(/\n/, $history);
 		@history = @history[1..$#history];
 		foreach my $line (reverse @history) {
 			my @commit_info_split = split(/ |\n/, $line);
-- 
1.7.9.5
Next: Matthieu Moy
Message 1 of 6 in “git-remote-mediawiki: Fix a bug in a regexp”
  1. git-remote-mediawiki: Fix a bug in a regexpCélestin Matte, Jun 8, 2013
  2. Matthieu MoyJun 8, 2013
  3. Célestin MatteJun 8, 2013
  4. Jeff KingJun 9, 2013
  5. Eric SunshineJun 9, 2013
  6. Eric SunshineJun 9, 2013

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.