summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-11-15 03:14:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-15 03:14:26 (GMT)
commitfcaba621925bc6847000aa61a60c7b5fa22d892a (patch)
treec41d43700b0b20b665da04ccbe0d78701ad73e98
parentd8df70f2739af78cab6d7f9b942e890da6fbd01d (diff)
parentd1a7050f93768c10fa8c552ba62c3f86193d34c3 (diff)
downloadgit-fcaba621925bc6847000aa61a60c7b5fa22d892a.zip
git-fcaba621925bc6847000aa61a60c7b5fa22d892a.tar.gz
git-fcaba621925bc6847000aa61a60c7b5fa22d892a.tar.bz2
Merge branch 'ab/mediawiki-name-truncation'
The remote-helper for talking to MediaWiki has been updated to truncate an overlong pagename so that ".mw" suffix can still be added. * ab/mediawiki-name-truncation: remote-mediawiki: limit filenames to legal
-rw-r--r--contrib/mw-to-git/Git/Mediawiki.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/mw-to-git/Git/Mediawiki.pm b/contrib/mw-to-git/Git/Mediawiki.pm
index d13c4df..917d9e2 100644
--- a/contrib/mw-to-git/Git/Mediawiki.pm
+++ b/contrib/mw-to-git/Git/Mediawiki.pm
@@ -2,6 +2,7 @@ package Git::Mediawiki;
use 5.008;
use strict;
+use POSIX;
use Git;
BEGIN {
@@ -52,7 +53,7 @@ sub smudge_filename {
$filename =~ s/ /_/g;
# Decode forbidden characters encoded in clean_filename
$filename =~ s/_%_([0-9a-fA-F][0-9a-fA-F])/sprintf('%c', hex($1))/ge;
- return $filename;
+ return substr($filename, 0, NAME_MAX-length('.mw'));
}
sub connect_maybe {