Git migration

This is an old revision of Git migration, edited by Marcov at . The current revision is 124538.

/* Why not ? */

This page is about migrating FPC from SVN to git

Why?

Why not ?

Concerns/Questions

What part of SVN to migrate ?

Yes, it seems it does. See this StackOverflow topic --Graeme (talk) 14:42, 19 December 2017 (CET)

The SO topic does not help much, but after some experimenting I got git filter-branch --index-filter 'git merge-base --is-ancestor <hash> $GIT_COMMIT ; if [ $? -eq 1 ] ; then git rm --cached --ignore-unmatch <path in repo/file> ; fi' HEAD which removes all revisions of <path in repo/file> which are not ancestor of <hash>. So this removes old versions of files which were cleaned by the commit identified by <hash>. This is reasonable fast (~ 1 hour with my currently converted repository). Afterwards, the file appears to be committed by <hash>. Drawbacks: All history before of the file is lost, also of clean parts. All revisions afterwards get new hashes, so this means, all clones done before must be removed. --FPK (talk) 19:59, 19 December 2017 (CET)

Use git clone --depth 1 to get only the latest revision (with fetch, later on more revisions can be fetched if needed)

Is this really a problem? A git clone of FPC trunk with full history is 50% smaller (disk space usage) than a HEAD revision 'svn co' checkout using SubVersion. --Graeme (talk) 14:36, 19 December 2017 (CET)

It is not: my test respositry is around 500 MB on linux after gc, sources itself are around 350 MB

--FPK (talk) 20:18, 19 December 2017 (CET)

Just checked, only .svn directory of trunk checkout is 800MB If git clone is 500MB it is about 50% smaller. --AlexVinS (talk) 00:35, 20 December 2017 (CET)

But after svn cleanup it gets reduced to 327MB. --Nickysn (talk) 01:19, 20 December 2017 (CET)

With aggressive gc .git gets 425 MB --FPK (talk) 21:32, 21 December 2017 (CET)

And do not forget: using git worktrees, you need only one .git dir for "trunk" and "fixes" --FPK (talk) 21:35, 21 December 2017 (CET)

And I worry mainly about fpcbuild with its non differential history, since my most major disk constraints are VMs for release building Marcov (talk) 15:01, 21 December 2017 (CET)

--depth 1 works with submodules too--AlexVinS (talk) 15:55, 21 December 2017 (CET)

Don't worry too much: fpcbuild trunk .svn: 57.2 MB; full fpcbuild .git: 40.4 MB. So if you are still worried about disk space, we should switch to git asap --FPK (talk) 21:32, 21 December 2017 (CET)

That would resolve my scenario with the biggest (feared) size problems. Marcov (talk) 12:01, 22 December 2017 (CET)

Build repository

The fpc build repository uses svn:external references.

Git has modules, which is in essence the same. This needs to be properly set up.

Branching model ?

How to handle the fixes branch

FPC uses trunk for development. Release are generated from the fixes branch. The fixes branch consists of cherry picked commits from trunk. After a patch proved to be good in trunk, it is cherry picked and committed to the fixes branch. This is a development model which works very well with subversion and is used by FPC for almost 20 years. However, to make this development work well, it requires that the SCM supports cherry pick tracking, something git does not have. So this workflow does not work well with git. Changing the workflow of FPC is not an option at this point, it proved to work, furthermore there are good reasons to use it: When making a patch, it is often hard to know if it is good enough for fixes or not, normally, it is decided after some time or even short before the next release, if a patch is good and safe enough to make it into fixes. This might not happen because it required more changes and those changes got too invasive or because it e.g. turned out that caused incompatibilites which make the patch a candidate for the next minor release instead. So this is probably the key question for a full git migration: can git be used with the workflow fpc uses?

So far, various workflow models exist:

A successful Git branching model

Also known as "git-flow" model.

You do not see the problem: if it is in develop, it will never make it into master without merging whole develop into master (i.e. in terms of FPC releases this would mean a new minor release x.y+1.0). So each bug fix has to go into an own hotfixes branch (e.g. hotfix_bug12345) which is branched from master and merged first into develop. If it works, it will be merged back into master. --FPK (talk) 22:58, 17 December 2017 (CET)

The cactus model

Also known as the anti-"A successful Git branching Model".

See the Git project itself

User management ?

Git has no concept of users. To manage permissions on a server, a separate program is needed.

gitorious

gitea

Git differentiates between the person that does a commit, and the author of a change/patch. The latter is always available and doesn't need any repository permissions. Somebody with write permissions can commit patches (or merge pull requests) and keep both the Committer and Author information intact. SubVersion doesn't track the author of a change, only the person that did the commit.

What about Lazarus ?

Dependencies on Unix-world tools / ports ?

There seem to be dependencies on quite a few tools common on Unix platforms. Unfortunately, ports of these tools may not be up-to-date and/or working well on non-Unix platforms. As an example, port of GIT 2.13.3 to OS/2 lists dependencies on a Unix shell, Python, Perl and CURL among others. Using Unix shell for launching other programs on a non-Unix platform may have various unwanted effects (remember cygwin ports which we tried to avoid on MS Windows as much as possible for similar reasons). The list of dependencies seems to suggest that quite a few operations require external tools (similarly to merging with early SVN versions). It may be difficult to test all such cases potentially important for certain workflows in advance before the final switch.

OS/2 being the first commercial operating system to ship with Java built-in. So why not simply use the Java version of Git. The Eclipse and IntelliJ IDEA project do on a daily basis. --Graeme (talk) 14:39, 18 December 2017 (CET)

Misc.

Collected from mails of Marco which is not handled in other sections:

Answer from Chain|Q:

https://help.github.com/articles/github-terms-of-service/

Point "D" caused an uproar a while ago, because some thought that it implied that you're granting GitHub rights to use your content as they see fit. This has been clarified since, I think.

Scenarios to document

SVN scenarios that need an equivalent: (note that equivalency means that changes should be visible on the central server)

(new) git specific scenarios:

Tool for migration

subgit

Advantages

Disadvantages

git-svn

Advantages

Disadvantages

Work to do

Migrate SVN repo.

Branch mapping for subgit

Proposal for branch mapping

trunk = trunk:refs/heads/master
branches = branches/merged/*:refs/heads/merged/*
branches = branches/joost/*:refs/heads/joost/*
branches = branches/laksen/*:refs/heads/laksen/*
branches = branches/maciej/*:refs/heads/maciej/*
branches = branches/olivier/*:refs/heads/olivier/*
branches = branches/paul/*:refs/heads/paul/*
branches = branches/*:refs/heads/svn/*
branches = branches/svenbarth/*:refs/heads/svenbarth/*
branches = branches/tg74/*:refs/heads/tg74/*	
tags = tags/*:refs/tags/*
shelves = shelves/*:refs/shelves/*
excludeBranches = branches/aspect
excludeBranches = branches/avr32
excludeBranches = branches/blaise
excludeBranches = branches/cpstr
excludeBranches = branches/cpstrnew
excludeBranches = branches/ctypes
excludeBranches = branches/dodi
excludeBranches = branches/florian
excludeBranches = branches/foxsen
excludeBranches = branches/fcl-web_joost
excludeBranches = branches/generics
excludeBranches = branches/genfunc
excludeBranches = branches/janbruns
excludeBranches = branches/linker
excludeBranches = branches/merged/avr
excludeBranches = branches/merged/generics
excludeBranches = branches/merged/nodeopt
excludeBranches = branches/newthreading
excludeBranches = branches/peterjan
excludeBranches = branches/ssa
excludeBranches = branches/tg74/rtl
excludeBranches = branches/tg74/tests
excludeBranches = branches/tg74/utils
excludeBranches = branches/unitrw
excludeBranches = branches/wkrenn
excludeBranches = branches/FIXES_2_2
excludePath = /fixes_2_0
excludePath = /fixes_2_4
excludePath = /trunk

Set up user management and permissions.

Set up and automate github mirror