Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All the configuration options reside in SubGit configuration file, that is situated in subgit subdirectory inside a newly created Git repository:

No Format
languagetext
themeFadeToGrey
titleSubGit confiuration file
GIT_REPOS_PATH/subgit/config

...

  • core.authorsFile
    Anchor
    core.authorsFile
    core.authorsFile

    this option represents a path to the authors mapping file or authors mapping helper program. The path is either relative to the Git repository or absolute. The default value is:

    No Format
    [core]
       authorsFile = subgit/authors.txt

    There may be more that one authorsFile option set in the file:

    No Format
    [core]
       authorsFile = subgit/authors.txt
       authorsFile = /etc/authors.txt

    All the mentioned files content is being merged into a full list. If an SVN username appears more than once – only its first occurrence will be applied. For example, if an SVN username johndoe appears in both authors files:

    No Format
    subgit/authors.txt    
          johndoe = John Doe <johndoe@example.com>
    …
    /etc/authors.txt    
          johndoe = John M. Doe <john_doe@example.com>
    
    

    In this case, the SVN name johndoe is being mapped to Git name John Doe <johndoe@example.com> as it appears first in the list.

  • core.defaultDomain
    Anchor
    core.defaultDomain
    core.defaultDomain

    this option represents a domain name that is being used to construct a Git user email address in case if no explicit authors mapping has been provided. SubGit automatically fills that option with a hostname when subgit configure command is invoked. If the option is not set, Git user email appears empty in commits – a pair of angle brackets with nothing in between:

    No Format
    Author: john_doe <>
Info
titleAuthors mapping for SVN server 1.7.20, 1.8.12 or 1.9.0

If you are using SVN server 1.7.20, 1.8.12 or 1.9.0 or later, and the SVN repository is being accessed over http(s):// protocol, then pre-revprop-change hook may need to be enabled in SVN repository, see SVN authors are not being set correctly article.

...

When SubGit starts translation between SVN and Git, it looks for authors mapping files or authors helper programs. If none of them present, it generates the mapping automatically, following these rules for the translation:

  • Subversion svn_user_name is being translated to svn_username &lt;svnusername@defaultDomain>> in _name <svn_user_name@defaultDomain> in Git
  • Git Author Name &lt;email@domain<email@domain.com> is translated to Author Name in Subversion

'defaultDomain' here stands for the core.defaultDomain SubGit configuration option. SubGit fills that setting with the hostname during subgit configure process, but it can be changed later 

During initial subgit configure call, this setting is being set to the hostname. Also, if  if subgit configure is invoked with  is invoked with --layout auto option, SubGit fills the authors file with automatically generated mapping - i.e. SubGit connects to the SVN, checks through the project history and records all the SVN users found in the history. Then SubGit generates Git names and emails from those SVN usernames according to the rules above and records resulting mapping to the authors file.

Say, a user makes commits using john_doe SVN user; a SVN revision he made may look like:

------------------------------------------------------------------------
    r167 | john_doe | 2017-06-06 10:25:02 +0200 (Tue, 06 Jun 2017) | 1 line
    Changed paths:
       M /project/trunk/foo.c

    minor changes
    ------------------------------------------------------------------------

at some point, the SVN project is being translated to Git. If no explicit authors mapping provided, SubGit will create automatic mapping according to the rules we've mentioned, so the revision 167 we showed above will look like this in Git:

...

 option, SubGit connects to specified SVN project, checks its history and generates authors mapping using found SVN usernames and given defaultDomain, then SubGit fills up the default authors file with the resulting mapping.

For example, suppose, the defaultDomain is set like follows:

No Format
[core]
   defaultDomain = example.com

A user made commits in SVN under john_doe SVN account. When SubGit translates these commits to Git, it sets author name in Git commits in the following way:

No Format
Author: john_doe <john_doe@git.example.com>

...

supposing Git machine has 'git.example.com' hostname.

And vise versa, if a user John Doe &lt;johndoe@example.com> will make commit to the Git repository:

commit 7faaf52c41a0325d4686f2a6f2851dc3e3739136
    Author: John Doe <johndoe@example.com>
    Date:   Thu Jun 8 20:06:31 2017 +0200

        minor changes to bar.c

being mirrored to SVN it will look like:

------------------------------------------------------------------------
    r173 | John Doe | 2017-06-08 20:06:31 +0200 (Thu, 08 Jun 2017) | 1 line
    Changed paths:
       M /project/trunk/bar.c

    minor changes to bar.c
    ------------------------------------------------------------------------

...

Similarly, Git commits that made by John Doe <johndoe@example.com> Git user appears in SVN with John Doe author name.


Authors File

The authors mapping file is actually just a text file filled with SVN username - Git author pairs. Each pair maps SVN username to Git author like:

...