ProcessGitEngine class Getting started
GitRepositoryManager, GitFileClient and GitEngineRuntime that talk to
the real git executable through a ProcessGitRunner (or any GitRunner
handed to the constructor).
It opens and creates repositories, clones them, and answers the neutral GitEngineRuntime with engineVersion and ensureMinimumVersion, which delegate to gitVersion and ensureGitVersion. Its repository creation, cloning and opening methods return the contracts of GitRepositoryManager and GitFileClient, so a caller depends on the interfaces alone.
Clone, fetch, pull and push run with the bounding transport environment of
transportEnvironment and the prompt defaults described by GitFileClient.
The backend assumes git 2.28 or newer. mergeTree of the merge facade
needs git 2.38 or newer (merge-tree --write-tree); on an older installed
git it raises GitFeatureUnavailableException.
Running git on Windows
Git is started directly, never through a shell (runInShell: false), with
its arguments handed over as a list. Every command gets
-c core.quotepath=false so non-ASCII paths stay verbatim, and Windows
commands get -c core.longpaths=true unless the constructor is given
windowsLongPaths: false. The default environment sets
GIT_TERMINAL_PROMPT=0, GCM_INTERACTIVE=never and LC_ALL=C; supplied
environment variables may override these defaults. Output is decoded as
UTF-8.
- Implemented types
Constructors
-
ProcessGitEngine({GitRunner? runner, GitFileSystem? fileSystem, GitPlatform? platform, GitProcessLauncher? launcher, String executable = 'git', Map<
String, String> ? globalEnvironment, bool windowsLongPaths = true, Duration? defaultTimeout = const Duration(minutes: 5), int? defaultMaxOutputBytes}) - Builds the process engine: the git program it launches, the environment it layers over every command, its Windows long-path setting and the delay of a command that names none.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
supportedSchemes
→ List<
String> -
The URI schemes this client accepts for clone sources and remote
locations.
no setteroverride
Methods
-
clone(
String source, String target, {bool noCheckout = false, String? branch}) → Future< GitWorkingRepository> -
Clones the repository
sourceinto the directorytarget, and opens the clone as a GitWorkingRepository.inherited -
cloneBare(
String source, String target) → Future< GitFileBareRepository> -
Clones the repository
sourceinto the bare repositorytarget, and opens it as a GitFileBareRepository.inherited -
engineVersion(
) → Future< String> -
Version text of the engine, with no promise about its format.
override
-
ensureGitVersion(
String minimumVersion) → Future< void> -
Ensures the installed git is at least
minimumVersion, written asmajor[.minor[.patch]]. -
ensureMinimumVersion(
String minimumVersion) → Future< void> -
Ensures the engine is at least
minimumVersion, written asmajor[.minor[.patch]].override -
fetch(
GitFileRepository repository, {String? remote, List< String> ? refspecs, bool prune = false, GitTagFetch tags = GitTagFetch.follow}) → Future<void> -
Downloads objects and refs from
remoteintorepository(git fetch), running inside that repository's context.inherited -
gitVersion(
) → Future< String> -
Version string reported by
git --version, e.g.git version 2.41.0.windows.1. -
init(
String path, {String? initialBranch, bool allowOccupied = false}) → Future< GitWorkingRepository> -
Creates a new repository with a work tree at
pathand opens it.override -
initBare(
String path, {String? initialBranch, bool allowOccupied = false}) → Future< GitFileBareRepository> -
Creates a new bare repository at
pathand opens it.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
String path) → Future< GitFileRepository> -
Opens the repository living at
path(its work tree, or its.gitdirectory for bare repositories).override -
openBare(
String path) → Future< GitFileBareRepository> -
Opens
pathand returns it as a GitFileBareRepository.override -
openWorking(
String path) → Future< GitWorkingRepository> -
Opens
pathand returns it as a GitWorkingRepository.override -
pull(
GitWorkingRepository repository, {String? remote, String? branch, GitMergeMode mode = GitMergeMode.auto}) → Future< GitMergeResult> -
Fetches
branchfromremoteand merges it into the current branch ofrepository— the composition of fetch andGitWorkingMerge.merge(git pull), running inside that repository's context.inherited -
push(
GitFileRepository repository, {String? remote, List< String> ? refspecs, bool force = false, bool tags = false, bool setUpstream = false}) → Future<void> -
Updates
remotewith refs ofrepository(git push), running inside that repository's context.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited