Question

We have about 100 CVS repositories which we like to convert to git. We tried using git cvsimport which works fine.

But we have some files with special characters in their filename. The special characters end up as non printable characters in the file name in the new git repository.

Both CVS clients and CVS server are running on windows. The windows clients are using the cp1252 character set for all files. git cvsimport is invoked using cygwin, since it's not available for windows.

Any ideas to get proper filenames in git after running git cvsimport?

Was it helpful?

Solution

We ended up writint two scripts for fixing file and directory names in all commits.

For files:

#!/bin/bash
echo "$1 --> $2"

cmd="if [ -f '$1' ]
then
mv '$1' '$2'
fi"

git filter-branch --tree-filter "$cmd" --force -- --all

For directories:

#!/bin/bash
echo "$1 --> $2"

cmd="if [ -d '$1' ]
then
mv '$1' '$2'
fi"

git filter-branch --tree-filter "$cmd" --force -- --all

Depending on the OS and terminal you cannot enter some characters. Most of the time you can just type a ? in the first pattern. The scripts assume that a file/directory is visible in the currently checkout out branch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top