Page tree

Versions Compared

Key

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

...

Info
titleAuthors mapping affects licensing

Note, that SubGit uses authors names to count licensed users, see Licensing manual for details.

Configuration options

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

Code Block
languagetext
themeFadeToGrey
titleSubGit confiuration file
GIT_REPOS_PATH/subgit/config

There are two configuration options that relate to authors:

  • core.authorsFile<a name="
    Anchor
    core.authorsFile
    ">
    core.authorsFile

    this option represents a path to the authors mapping file or authors mapping helper program. The path can be is either relative to the Git repository or absolute. The authors mapping file is a text file that lists SVN and Git usernames pairs, see more detail below. The authors mapping helper program is either script or binary executable file that provides authors related data in a certain form, find details below in helpers chapter. Note, there may be more that one authorsFile option set in the file, e.g.: [core] authorsFile = 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 contents will be content is being merged into full list, but there's some specific: if some SVN username appears twice (or more) - only its first occurence 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 in subgit/authors.txt authors files:

    No Format
    subgit/authors.txt    
          johndoe = John Doe
    EMAIL: johndoe@example.com and in
     <johndoe@example.com>
    …
    /etc/authors.txt
    : /etc/authors.txt johndoe = John M. Doe EMAIL: john_doe@example.com then mapping from subgit/authors.txt will be applied since that file appears before /etc/authors.txt in the list.core.defaultDomain<a name="core.defaultDomain">this option provides a domain name to be added to the username to form an email address in Git when automatic authors mapping is used. SubGit
        
          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 hostname when subgit configure command is  command is invoked. If  If the option is not set or omitted in the configuration file, SubGit will not generate the email address for Git commits and author's email will appears empty (just a Git user email appears empty in commits – a pair of angle brackets with nothing in between) in the commit:$ git log -v commit d5d46afc3aa33240de8b5200e72611d4e0d72a99

    No Format
    Author: john_doe
    <> Date: Thu Jun 6 10:25:02 2017 +0200

    minor changes

Those are two authors-related SubGit options, but those are not all the configurations that may be needed authors mapping to work correctly: an additional setting may be needed on SVN side depending on how SubGit logs in the SVN repository.

Actually, there are two possible alternatives: SubGit can use one dedicated SVN account to log in SVN repository and it can use several different accounts for that. There's sugit/passwd file that's intended to store SVN accounts list that SubGit can use to get authenticated. When SubGit performs a Git commit translation into SVN revision (in case the mirror is established), it searches for the commit author in the authors file. If there's a match, SubGit then searches the passwd file for that exact SVN username. If the password for that account is found - SubGit uses that username to log in SVN and create a new revision. In this case, correct revision author is being set automatically since SubGit is logged using the correct account.

If SubGit uses one dedicated SVN account (in cases of cached SVN credentials, only one provided SVN account or if no matching SVN accounts found in sugit/passwd) it works a little different. It connects to SVN, creates a new revision and sets the revision's author equal to the SVN username it uses to log in. The problem is that this username usually is not correct author name - it might be, but commonly it differs. So SubGit then connects the SVN server second time and changes the newly created revision svn:author property to the correct author name.

And some additional configuration may be needed here, namely:

  • if SVN server 1.7.20, 1.8.12 or 1.9.0 or later is used and it's being accessed over http(s):// protocol
  • or if the SVN server is being accessed over svn:// protocol

then pre-revprop-change hook has to be enabled in the SVN repository. That requirement is introduced by SVN and that's why we need to make some changes on SVN side.

The hook per se is pretty simple: it just an executable file, script or binary, that may even do nothing, just start and exit. So you can just create as simple script as

  • Linux and OS X:

    #!/bin/sh exit 0;

  • Windows:

    @echo off exit 0

place it into SVN repository hooks directory:

SVN_REPOSITORY/
            hooks/
                pre-revprop-change     # for Linux and OS X
                pre-revprop-change.bat # for Windows

make the file executable in Linux/MacOS

chmod +x pre_revprop_change

and that's it!

  •  <>
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.


Automatic Authors Mapping

When SubGit starts translation beween 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:

...