We need to parse diffs with all manner of funky file names :<
--- /dev/null
+# Copyright (C) 2015 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ (https://www.gnu.org/licenses/agpl-3.0.txt)
+
+package PublicInbox::RepoBrowseGit;
+use strict;
+use warnings;
+use base qw(Exporter);
+our @EXPORT_OK = qw(git_unquote);
+
+my %GIT_ESC = (
+ a => "\a",
+ b => "\b",
+ f => "\f",
+ n => "\n",
+ r => "\r",
+ t => "\t",
+ v => "\013",
+);
+
+sub git_unquote {
+ my ($s) = @_;
+ return $s unless ($s =~ /\A"(.*)"\z/);
+ $s = $1;
+ $s =~ s/\\([abfnrtv])/$GIT_ESC{$1}/g;
+ $s =~ s/\\([0-7]{1,3})/chr(oct($1))/ge;
+ $s;
+}
+
+1;
--- /dev/null
+# Copyright (C) 2015 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ (https://www.gnu.org/licenses/agpl-3.0.txt)
+use strict;
+use warnings;
+use Test::More;
+use PublicInbox::RepoBrowseGit qw(git_unquote);
+
+is("foo\nbar", git_unquote('"foo\\nbar"'), 'unquoted newline');
+is("Eléanor", git_unquote('"El\\303\\251anor"'), 'unquoted octal');
+
+done_testing();