tags:

views:

25

answers:

2

In short: Is there a way to disable storing full history for specific folders in git-svn repo?

We have pretty large SVN repo with big checkout. I would like to migrate it to Git for my local development, because Git speeds up update and status commands orders of magnitude.

When I simply do git svn clone it creates very big repo. Big enough to be bigger then my whole HDD. The problem lies in binary directories for which history is too large.
Latest binaries are required for proper local build, but history is not required at all for my development process. I will never change them myself.
I would like to store only latest versions for specific folders, or may be a history, but for no more than a week.

I could only found filter for git svn fetch, which excludes specific folders at all. This is not exactly what I need.

It's OK with me to have Cron task which deletes history from specific folders, but I do not know how to make one. Also Cron does not solve problem of first git svn clone.

P.S. SVN repository structure could not be changed by any means.

A: 

you can do a shallow copy by specifying how much svn history to clone. for example:

$ git svn clone -s -r534:HEAD http://some/svn/repo

this will clone only the history since revision 534. You just have to figure out the right number for your repository and pull, for example, the last 6 revisions. Just specify a number 6 less than the current revision.

Update:

After thinking about your problem a bit more, I think that shallow clones are not really the right way to go because you cannot push/merge them - they are designed just for you to send patches to them in via email.

Have you tried marking the relevant files as binary before you do a git-svn clone? You can do this by adding the following line to your .gitattributes file (in repository root) after running git init:

*.jpg binary

Obviously, replace the extension with that of your binary files (or name them specifically I guess). Git tries to recognise binary files automatically, but it doesn't always get it right.

scomar
As far as I can unserstand this will not help me. I would like to have full history for src files and shallow history for binaries. Even more, I would like to fetch from repository regularly and still do not save too much history.
Timofey Basanov
what happens when you try marking the files as binary?
scomar
As far as I understand Git always store whole history for all files in local repository. Binary/text flag does not change this thing.Looks like http://stackoverflow.com/questions/540535/managing-large-binary-files-with-git is an answer.
Timofey Basanov
+1  A: 

I ended up with the next solution:

  1. There are three folders with binaries, so I added them to git-svn ignored folders so they will not be stored by git at all
  2. Manually add these folders to git working space with svn version control
  3. Made up script, which updates these folders at once by cron

Now I have pretty strange workspace where some folders are managed by svn and others by git, but looks like it is working solution for now.

Timofey Basanov