Git blame on reorganized SVN repository

末鹿安然 提交于 2019-12-08 02:22:25

问题


git blame isn't showing me the all history of a SVN repository which had its layout reorganized.

I'm using git-svn to access a SVN repository. The SVN repository used to have a structure with a vast tree of folders to hold the many projects. Last year I reorganized and flattened the layout into a more standard trunk/tags/branches layout. The result of which is that all the files in the repository were moved on 17th May 2010.

Using the subclipse SVN client from Eclipse, I can do Team->Show Annotation and it shows the history of a file as I expect - lines of code changed in 2009 are correctly annoted with the author / date / checkin comment.

However, git blame on the git repository I've cloned using git-svn isn't so useful. For all lines of code modified before 17th May 2010, the annotation is: me / date 17th May 2010 / comment "reorganizing repository...".

I'm presuming the information is still there, is there way to get git blame to display it? I very speculatively tried git blame -C -C -C... without success.


回答1:


Are you sure the older commits appear in the git repo at all? Perhaps your svn reorganization was too big for git-svn to follow. Find the svn revision before the 17th May move, then git svn find-rev r12345 with that number to find the corresponding git hash, if there is one. Then git checkout that hash and see if the files you're interested in are in it.

If you told git-svn that your repo used the 'standard' trunk/branches/tags layout, it probably can't understand the other layout. You might need to redo the git-svn import in two stages: one for your old layout, and then again for your new layout. You can achieve this using the -r argument to git svn fetch to only fetch a given range of revisions.



来源:https://stackoverflow.com/questions/6986090/git-blame-on-reorganized-svn-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!