gg_git library

Classes

Checkout
Checks out an existing branch (creating a tracking branch from the remote when the branch only exists on origin).
Commit
Checks if eyerything in the current working directory is committed.
CommitCount
Checks if eyerything in the current working directory is committed.
DefaultBranch
Returns the name of the repository's default branch.
Fetch
Runs git fetch in the given directory.
GetTags
Provides "ggGit current-version-tag dir" command
GgGit
The command line interface for GgGit
GgGitBase<T>
Base class for all ggGit commands
GgGitCommandExample
Example git command implementation
GitRetry
Reruns a git network command that failed with a transient transport error: a dropped connection, GitHub's SSH throttling, a 5xx reply, a failed host name lookup or a connection that timed out.
GitStatus
Returns the parsed »git status --porcelain« of a repository.
GitStatusEntry
One entry of »git status --porcelain«.
GitVersion
Tells which git is installed, so a caller can use what a newer git offers and fall back to the older way otherwise.
GitWatch
Watches git network commands — clone, fetch, push, ls-remote — while they run, where Process.run shows nothing until the command ends.
HasRemote
Checks if the local git repo has a remote
HeadHash
Returns the commit hash of the head revision.
HeadMessage
Reads the commit message of the head revision.
IsCommitted
Checks if eyerything in the current working directory is committed.
IsEolLf
Returns if automatic line feed conversion is on or not
IsFeatureBranch
Returns true when the current branch is not the default branch.
IsLocked
Checks if a git repository is locked by another git process.
IsPushed
Provides "ggGit pushed dir" command
LastChangesHash
Returns a 64bit hash summarizing the changes since the last commit.
LocalBranch
Provides "ggGit pushed dir" command
MockChangeHash
Mocktail mock
MockCheckout
Mocktail mock
MockCommit
Mocktail mock
MockCommitCount
Mocktail mock
MockDefaultBranch
Mocktail mock
MockFetch
Mocktail mock
MockGetTags
Mocktail mock
MockGitRetry
Mock for GitRetry.
MockGitStatus
Mocktail mock
MockHasRemote
Mocktail mock
MockHeadHash
Mocktail mock
MockHeadMessage
Mocktail mock
MockIsAutoConversionOn
Mocktail mock
MockIsCommitted
Mocktail mock
MockIsFeatureBranch
Mocktail mock
MockIsLocked
Mocktail mock
MockIsPushed
Mocktail mock
MockLocalBranch
Mocktail mock
MockModifiedFiles
Mocktail mock
MockRemoteBranches
Mocktail mock
MockRemoteBranchExists
Mocktail mock
MockShowFile
Mocktail mock
MockSshHostKeys
Mock for SshHostKeys.
MockUnstagedFiles
Mocktail mock
MockUpstreamBranch
Mocktail mock
ModifiedFiles
Returns the modified files in the current Git repository.
RemoteBranches
Lists the short names of the remote branches at origin (the origin/ prefix is stripped and the symbolic origin/HEAD is dropped).
RemoteBranchExists
Checks whether origin/<branch> is resolvable in the given directory (after a fetch).
ShowFile
Returns the content of a file at a git ref via git show <ref>:<path>.
SshHostKey
A key an ssh server presented, as one line of a known_hosts file.
SshHostKeys
Finds out why an ssh connection of git failed, reads the key an unknown host presents and adds it to the known_hosts file.
UnstagedFiles
Returns the unstaged files in the current Git repository.
UpstreamBranch
Provides "ggGit pushed dir" command

Enums

FingerprintCheck
How the fingerprint of a host key compares to the fingerprints the operator of the host publishes.

Functions

captureUncommitted(ProcessRunner runner, {required Directory repoDir, required String status}) → Future<String?>
Captures the uncommitted changes of repoDir — tracked modifications, the staged/unstaged split and untracked files — in a dangling stash commit, leaving the working tree exactly as it was. Returns the stash commit hash, or null when status shows nothing to preserve.
defaultProcessRunner(String executable, List<String> arguments, {String? workingDirectory, Map<String, String>? environment, bool runInShell = true}) → Future<ProcessResult>
Default ProcessRunner delegating to GgProcessDelegate.current.
isIgnoredFile(String file, List<String> ignoreFiles) → bool
Returns true when file is covered by ignoreFiles.
parseGitStatus(String stdout) → List<GitStatusEntry>
Parses the raw stdout of »git status --porcelain« into entries.
runGit(ProcessRunner runner, List<String> args, {required Directory repoDir, bool allowFailure = false, bool trimmed = true}) → Future<String>
Runs git with args in repoDir using runner and returns the trimmed stdout.
waitForBoth<A, B>(Future<A> first, Future<B> second) → Future<(A, B)>
Waits for two things running at the same time and returns both results.

Typedefs

ProcessRunner = Future<ProcessResult> Function(String executable, List<String> arguments, {Map<String, String>? environment, bool runInShell, String? workingDirectory})
Signature for running an external process (for injection & tests).