Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter Deletes during git svn clone?

Tags:

git

git-svn

Problem: Legacy svn repo has a directory that is synced from user config on a prod server.

The sync effectively:

  • deletes all files
  • commits
  • copies all files
  • commits

Is it possible to filter out all of the file deletes during a git svn clone of this repo?

And subsequent git svn fetches as well?

I don't necessarily want to filter the entire commit just the parts that delete files.

This would mean changing the subsequent add files to become modify files.

like image 963
Gabriel Avatar asked Jul 31 '15 15:07

Gabriel


1 Answers

First off, if you want more control over your repo conversion, you may want to consider using Reposurgeon rather than git-svn


Owing to the way that Git works, the impact of these evil practices in SVN are less severe than you think though.

Firstly, Git itself has no notion of "file history". There is no such thing as a "file modify" like there is in SVN or other VCS systems. Git only remembers a tree of files. And then another tree of files. Etc.

If you compare HEAD to HEAD^^ (where HEAD^ is the intervening "deleted" commit), you will get results no different to those you'd get if you managed to leave the "deleted" revision out altogether.

In addition, the storage requirements will not be very much greater - Git stores whole objects and compares them for similarity when making packs, unlike SVN which uses delta compression (and thus depends on that file history). Tree A + empty tree + Tree B (composed of mostly the same files) will take a very tiny extra bit of space compared to missing out the empty tree revisions.

like image 128
Adrian Avatar answered Oct 13 '22 10:10

Adrian