git_init_repository
git_init_repository ensures an empty Git repository exists at a project-relative destination. Initialization runs during xx run and appears in the run UI. Pass the returned dependency to deps when another task must wait for the repository. Repeated calls do nothing when repository mode, object format, and requested initial branch are compatible.
The function never empties an existing directory or repository. It fails when destination contains non-repository files, repository has a commit, or existing repository is incompatible.
Arguments
| Argument | Required | Description |
|---|---|---|
destination | Yes | Project-relative repository directory. |
bare | No | Create or require a bare repository. Defaults to False. |
initial_branch | No | Initial branch short name. Defaults to host global init.defaultBranch, then master. When omitted, any initial branch in an existing compatible empty repository is accepted. |
object_format | No | Object ID format: sha1 or sha256. Defaults to sha256. Set sha1 explicitly for compatibility with hosts that do not support SHA-256 repositories. |
deps | No | Dependencies that must complete before initialization. Defaults to []. |
Example
load("@git@1", "git_init_repository")
git_init_repository(
destination=".xx/repositories/output.git",
bare=True,
initial_branch="main",
object_format="sha256",
)