0

I'm doing a migration of SVN to GIT and cloning my SVN repo to my local machine (with history). The result of this clone removes the keyword data from both the current revision as well as every historical revision for every file in the repo. Example:

In SVN:

--  $Date: 2020-02-27 13:54:28 -0800 (Thu, 27 Feb 2020) $
--  $Rev: 65875 $

After, it looks like this:

--  $Date$
--  $Rev$

Are the keywords supposed to be removed like this or am I doing something wrong to remove that information? Is there any kind of workaround to keep this, while also keeping the history as well?

The command I'm using to clone is this:

git svn clone "MY SVN URL" --prefix=svn/  --no-minimize-url --authors-file "authors-transform.txt"
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
bbeck
  • 13
  • 3
  • 1
    [Keyword expansion is not recommended — Git FAQ](https://git.wiki.kernel.org/index.php/Git_FAQ#Does_Git_have_keyword_expansion.3F). But you still can [configure](https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_keyword_expansion) it yourself. – phd Nov 22 '22 at 10:03
  • 3
    1. Keywords not removed, but just **not expanded** in SVN-style 2. Yes, it's expected behavior, as @phd noted – Lazy Badger Nov 22 '22 at 14:16
  • To clarify, if this helps at all, I'm not interested in continuing to have have my keywords updated in future versions of the files under GIT. I am just interested in preserving the keyword data in the historical versions. I am also curious how the keyword data is supplied under SVN. Do the revisions, authors, date keywords get updated every time I open the file? Or are they baked into the file itself? Does the git clone actually remove that text in the file, or does it simply not do a lookup? If I copy a file to my local machine, not under source control, the keyword data is still there. – bbeck Nov 22 '22 at 17:26
  • @bbeck In SVN database (in `.svn/` dirs) the keywords are stored unexpanded (`$Id$`). SVN expands keywords on `svn update` and shrinks them back on `svn commit`, `svn diff`, etc. To preserve the last expanded keywords my advice is: convert SVN repo to Git (done, AFAIK) then do the last `svn update`, copy files from the SVN checkout to Git worktree and commit. – phd Nov 22 '22 at 17:47

0 Answers0