6.1.4.6. Git

Integration with Git

Support for Git.

VCSIntegration Git supports line-by-line blame information.

Information like remote URL (including authentication information), branch, submodules, etc. should be reflected automatically from the analysis worktree, so that you do not have to manually set it.

Typically, the worktree should be already cloned using the same remote URL (e.g. HTTPS with token authentication or SSH) that can also be used from the dashboard.
In case this is not possible, you can overwrite username (or username and password) using the environment variables AXIVION_SOURCESERVER_GIT_USERNAME and AXIVION_SOURCESERVER_GIT_PASSWORD.
However, as this should be considered an exceptional case and not the normal case, do use with extreme care and only if you understand the implications.

Options

The following places define options that affect this rule: VCSIntegration, Project-GlobalOptions

author_format

author_format : str = '(.*)'

Regular expression with exactly one match group to apply to author_line in order to potentially select only specific parts, i.e. remove brackets around an email address with "<(.*)>".
 

author_line

author_line : str = 'author'

Line prefix of git blame -porcelain output that is to be used for determining author information of commits (usually author or committer).
 

author_time_line

author_time_line : str = 'author-time'

Line prefix of git blame -porcelain output that is to be used for determining timestamp information of commits (usually author-time or committer-time).
 

binary

binary : str = 'git'

Name of the VCS command-line binary.
 

blame_mode

blame_mode : BlameMode = 'all_authors'

If set to last_author_only, issues for code regions are only attributed to the author of the latest changes in that region. Otherwise, all authors of that code region are considered responsible.
 

branch

branch : str | None = None

The git branch to track. If configured to empty, no workspace update can being performed when running the analysis (which is not recommended any more anyway), and the sourceserver will fetch all branches by default.

Automatically detected from workspace when no value is entered.

If the workspace is in detached HEAD state, the branch cannot be reflected and you have to specify it, preferably by using some environment variable here (like e.g. AXIVION_BRANCH_NAME) which you can set in the calling environment of axivion_ci.

 

encoding

encoding : str = 'utf-8'

Encoding of files in the repository.
 

gitdir

gitdir : bauhaus.analysis.config.PlainPath | None = None

.git directory of the working repository. Either specified as absolute path, relative to rootpath or /Project/directory (if rootpath is empty).

Automatically detected from workspace when no value is entered.

 

remote

remote : str | None = None

The git-remote pointing to the central git repository. Often it is called origin.

Automatically detected from workspace when no value is entered.

 

rootpath

rootpath : bauhaus.analysis.config.ProjectRelativePath = '.'

Repository root for this VCS instance. If more than one VCS rule is activated, all their rootpath options have to be set differently. The value of rootpath must not be outside of /Project/directory for source code to be visible in the dashboard and for local_mode to work correctly.
 

skip_blame

skip_blame : bool = False

Does not run blame operations with this VCS if this option is set to true.
 

sourceserver_gitdir

sourceserver_gitdir : str | None = None

Path of the git mirror repository of the project on the dashboard server. Can be reflected from workspace.

If this option is unset, then the basename of the (explicitly configured or reflected) option sourceserver_remote_url is being used.

Any relative path (which is recommended over using an absolute path) will be interpreted relative to the dashboard's configuration subfolder repositories.

Any absolute path will stay absolute unless you set ForceRelativeRepositoryPath to true inside dashboard2.config in which case absolute paths are also forced to be interpreted relative to the dashboard's configuration subfolder repositories.

The mirror clone can be created manually from within the dashboard or automatically from a subsequent successful analysis run if the project is registered in the dashboard and the git credentials are known in the context of the user running the dashboard on the dashboard server.

For testing setups: If analysis and dashboard are running on the same machine, the gitdir of the analysis (i.e. the .git directory or file) may be used instead (do not use for production). Note however that sourcecode in submodules cannot be displayed in the dashboard in this case.

 

sourceserver_remote_url

sourceserver_remote_url : str | None = None

Remote git repository for the sourceserver to initially clone from. Can be reflected from workspace.
 

unshallow_worktree

unshallow_worktree : bool = True

If the analysis worktree is a shallow repository, automatically run git fetch --unshallow first to have access to all commits for proper operation of connecting issues and dashboard sourcecode display.
 

Option Types

These types are used by options listed above:

BlameMode

Enumeration of possible blame approaches for code regions.
 

all_authors

All authors of a code region are considered responsible.

last_author_only

Attribute issues only to the author of the latest change in the code region.