Claus Witt dot com

webdeveloper

Recently I had to clone a lot of repositories from BitBucket into a FLOW3 installation. But since FLOW3 expects that packages are named with camelcase, and bitbucket insists on saving all names as lowercase, I need to set the name of the cloned repository manually (instead of just using the last part of the repo url).

This is off course as easy as:

git clone git@bitbucket.org:username/packagename.git PackageName

But since I am lazy, and like to have my software do most of my work, this is what I did.

Locally I created a list of all packages in the FLOW3/Packages/Application directory (which should all be cloned on the remote server).

ls files.txt

Then opened the file list in TextMate, and ran the follow search/replace (as a regular expression)

#Search
(.*)\n
#Replace
git clone git@bitbucket.org:USERNAME/\L$1\E.git $1\n

\L lowercases everything until \E, between those I just pass the directoryname, which is also the name of the repo.

Finally I pasted the lines to the console on the remote server, and presto! All repos were cloned with the correct naming.

blog comments powered by Disqus