Non-ASCII paths and git-cvsserver

2 messages, 2 authors, 2016-08-11 · open the first message on its own page

Non-ASCII paths and git-cvsserver

From: sf <hidden>
Date: 2016-08-11 20:12:37

Hello,

I want to access a git repository via git-cvsserver. The problem is that 
the repository contains paths with umlauts. These paths come out quoted 
and escaped when checked out with cvs.

Test case:

#! /bin/sh

set -e -u -x

WORK='/tmp/gittest'
FILE=$'\303\244'

mkdir "${WORK}"
mkdir "${WORK}/git"

#trap 'rm -r "${WORK}"' EXIT

cd "${WORK}/git"

git init-db
git repo-config gitcvs.enabled 1
git repo-config gitcvs.logfile "${WORK}/git/.git/cvslog.txt"

touch "${FILE}"
git add "${FILE}"
git commit -a -mx

cd "${WORK}"

CVS_SERVER='git-cvsserver'
export CVS_SERVER

cvs -d ":fork:${WORK}/git/.git" co master

ls master

### end


This is what I get:

+ WORK=/tmp/gittest
+ FILE=$'\303\244'
+ mkdir /tmp/gittest
+ mkdir /tmp/gittest/git
+ cd /tmp/gittest/git
+ git init-db
defaulting to local storage area
+ git repo-config gitcvs.enabled 1
+ git repo-config gitcvs.logfile /tmp/gittest/git/.git/cvslog.txt
+ touch $'\303\244'
+ git add $'\303\244'
+ git commit -a -mx
Committing initial tree 23d6145738bba135994775c19d6e8ae707d399ee
+ cd /tmp/gittest
+ CVS_SERVER=git-cvsserver
+ export CVS_SERVER
+ cvs -d :fork:/tmp/gittest/git/.git co master
cvs checkout: Updating master
U master/"\303\244"
+ ls master
"\303\244"  CVS


I do not speak perl so can anyone help?

Regards

Stephan

Re: Non-ASCII paths and git-cvsserver

From: Martin Langhoff <hidden>
Date: 2016-08-11 20:09:18

On 11/9/06, sf [off-list ref] wrote:
I want to access a git repository via git-cvsserver. The problem is that
the repository contains paths with umlauts. These paths come out quoted
and escaped when checked out with cvs.
Thanks for the detailed report! I am travelling right now, so with
"high latency" and on a machine that's missing sqlite libs :-/

But I'll give it a go anyway.

Does this mini-patch help? You'll need Perl 5.8.x and probably a
recent SQLite for this.
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 8817f8b..c534de5 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -22,6 +22,9 @@ use Fcntl;
 use File::Temp qw/tempdir tempfile/;
 use File::Basename;

+binmode(STDIN,  ':utf8');
+binmode(STDOUT, ':utf8');
+
 my $log = GITCVS::log->new();
 my $cfg;
@@ -2104,6 +2107,11 @@ sub new
         $self->{tables}{$table} = 1;
     }

+    # this will set the encoding for new DBs
+    # or return false for existing DBs that are not
+    # utf-8
+    $self->{dbh}->do('PRAGMA encoding = "UTF-8"');
+
     # Construct the revision table if required
     unless ( $self->{tables}{revision} )
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help