Skip to content

CVS: implement support for replicating tags in Git

Created by: LawnGnome

This is split from #23757 (closed).

We need to be able to create tags in Git based on tags in CVS. The major problem here is that tags can (and often are) applied on a per-file basis in CVS, whereas Git only handles tags at a per-repo level.

For now, let's fake this as best we can with the following heuristic:

  • Assume that a single CVS tag in a repository represents a single logical tag. (This probably isn't always true in practice, but it keeps the scope manageable while providing reasonable value.)
  • For each CVS tag, create a branch in Git to represent the content of the tag, then use filedeleteall to reconstruct the contents of the CVS repository at that tag in a fake commit.
  • Base the fake commit on HEAD at the time of the last CVS tag (as measured by the CVS commit time the tag is attached to). This allows Git to stitch the history together: generally, if the file content in the tag doesn't change from HEAD, the fake commit will be transparent from a blame perspective.
  • Tag the fake commit in Git.

This should minimise the churn in the history (since, in most cases, the base will actually be correct or nearly correct if tags are being applied mostly as a single logical operation in CVS), and only injects one fake commit while hopefully maintaining history in a reasonable way.