Is there any provision for converting .cvsignore files to .gitignore file?
Asked Answered
K

5

10

I am using cvs2svn-2.4.0 for CVS to Git migration. This does not include the .cvsignore to .gitignore conversion. How do I convert .cvsignore files to .gitignore file?

Kolodgie answered 3/6, 2014 at 7:58 Comment(0)
C
8

Here's a Bash script which will look at the .cvsignore files in the directory tree and add their patterns to the top-level .gitignore file. It expects that the .cvsignore files contain only one pattern per line (apparently .cvsignore files allow multiple patterns in one line):

for f in `find . -name .cvsignore | sort `; do
    dir=`dirname $f | sed -r 's:^\.::'`
    cat $f | awk '{print "'$dir'/"$1}' >> .gitignore
done

In addition you have to add the default CVS ignore patterns from http://ximbiot.com/cvs/manual/cvs-1.11.23/cvs_18.html#SEC191.

Collinsworth answered 3/6, 2014 at 13:31 Comment(1)
Improved your nice script a bit: gist.github.com/xkr47/8bc17d69f5b8733250c0Faythe
H
3

You can't just copy .cvsignore to .gitignore - the formats aren't identical (unless it's a simple list of files in the top directory.

E.g., take a look at Eclipse's guide for migrating to Git:

There are subtle differences in semantics between .cvsignore and .gitignore, so you shouldn't just rename these files when moving to Git. At least prepend a "/" to each line in .gitignore, to ensure a pattern doesn't match in all subfolders.

Good practice is to create a .gitignore directly in the top-level folder of the Git repository and add //bin/ or //*/bin/ (depending on repo layout). Then, you can remove the bin entry from project-level ignore files (and also remove the ignore file if that was the only entry).

Hedley answered 3/6, 2014 at 11:7 Comment(0)
O
1

The find command should do a straight rename, and although the formats are somewhat the same there are some subtle differences, which you'll want to change later

By and large this was a good start when moving from CVS to GIT at least to begin with. I had hundreds of these .cvsignore files, and I performed this action after the cvs2git conversion

find . -name '*.cvsignore' -print -exec rename ".cvsignore" ".gitignore" {}  \;

Don't forget that CVS has an global ignore file in the CVSROOT module, so you may miss some of them that you had in CVS by just converting the local .cvsignore

You can get to those global one by doing

cvs checkout CVSROOT where you will find, those in the "cvsignore" file

checkoutlist  config  cvsignore    editinfo  modules  rcsinfo  verifymsg
commitinfo    CVS     cvswrappers  loginfo   notify   taginfo

I then recommend putting those global ones into the root folders .gitignore

Note: there are different versions of rename (kernel,perl) the command wouold fail if rename is the perl based regular expression version, ensure you are using the correct rename

Outflank answered 9/9, 2017 at 7:43 Comment(1)
Probably don't need that wildcard in the first *.cvsignorePalmira
D
0

you might have a look at a small python script I've written to convert cvsignore,v RCSFiles. So the commit history is not modified and no additional commits are created. It has it's limitations but done the Job well at our company. I placed it at github:

https://github.com/stroeter/cvsignore2gitignore

Djerba answered 15/3, 2017 at 7:43 Comment(0)
I
-3

Just use the command below in your terminal console:

find . -name .cvsignore -prune -exec mv {} .gitignore \;

Ilarrold answered 14/1, 2015 at 13:44 Comment(1)
find . -name .cvsignore -prune -exec mv {} .gitignore \; # OUCH: For me, that command apparently moved every .cvsignore to the root ./.gitignore (thus, I lost all but the last file found, which it moved to ./)Kilometer

© 2022 - 2024 — McMap. All rights reserved.