AxeWatcherGitInfo Class

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard

Provide explicit Git metadata when automatic detection is unavailable or unreliable

Not for use with personal data

The AxeWatcherGitInfo class holds explicit Git metadata for an axe Watcher test run. Pass an instance to setGitInfo() on AxeWatcherOptions to bypass automatic Git detection.

Use this class when:

  • Your tests run in a repository that is separate from the repository under test
  • The Git binary is unavailable in your CI environment
  • The repository is a shallow clone or is in a detached HEAD state

All fields are optional. Any string field you do not set is transmitted as null. See Providing Git Metadata for usage examples and guidance on which fields to supply.

Constructor

AxeWatcherGitInfo()

Creates a new instance with all fields unset.

AxeWatcherGitInfo gitInfo = new AxeWatcherGitInfo();

Methods

setBranch(String branch)

Sets the Git branch name.

Parameters:

  • branch - Branch name, e.g. "main"

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setBranch(System.getenv("GIT_BRANCH"));

setTag(String tag)

Sets the Git tag.

Parameters:

  • tag - Tag name, e.g. "v1.2.3"

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setTag(System.getenv("GIT_TAG"));

setDefaultBranch(String defaultBranch)

Sets the default branch of the repository.

Parameters:

  • defaultBranch - Default branch name, e.g. "main"

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setDefaultBranch("main");

setCommitSha(String commitSha)

Sets the commit SHA.

Parameters:

  • commitSha - Full or abbreviated commit hash, e.g. "abc1234"

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setCommitSha(System.getenv("GIT_COMMIT"));

setCommitAuthor(String commitAuthor)

Sets the commit author's display name.

Parameters:

  • commitAuthor - Author display name

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setCommitAuthor(System.getenv("GIT_AUTHOR_NAME"));

setCommitEmail(String commitEmail)

Sets the commit author's email address.

Parameters:

  • commitEmail - Author email address

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setCommitEmail(System.getenv("GIT_AUTHOR_EMAIL"));

setCommitMessage(String commitMessage)

Sets the full commit message.

Parameters:

  • commitMessage - The full commit message

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setCommitMessage(System.getenv("GIT_COMMIT_MESSAGE"));

setUrl(String url)

Sets the remote URL of the repository.

Parameters:

  • url - Remote URL, e.g. "https://github.com/org/repo"

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setUrl("https://github.com/org/repo");

setIsDirty(boolean isDirty)

Sets whether the working tree has uncommitted changes. Set to true if there are uncommitted changes, or false if the working tree is clean. If you do not call this method, the working tree is reported as clean (false).

Parameters:

  • isDirty - true if there are uncommitted changes

Returns:

  • AxeWatcherGitInfo - The current instance for method chaining

Example:

new AxeWatcherGitInfo().setIsDirty(true);

getBranch()

Returns: String - The branch name, or null if not set.

getTag()

Returns: String - The tag, or null if not set.

getDefaultBranch()

Returns: String - The default branch name, or null if not set.

getCommitSha()

Returns: String - The commit SHA, or null if not set.

getCommitAuthor()

Returns: String - The commit author's display name, or null if not set.

getCommitEmail()

Returns: String - The commit author's email address, or null if not set.

getCommitMessage()

Returns: String - The commit message, or null if not set.

getUrl()

Returns: String - The repository remote URL, or null if not set.

getIsDirty()

Returns: Boolean - true if dirty, false if clean, or null if setIsDirty() was never called.

See Also