initBare method

  1. @override
Future<GitFileBareRepository> initBare(
  1. String path, {
  2. String? initialBranch,
  3. bool allowOccupied = false,
})
override

Creates a new bare repository at path and opens it.

The repository has no work tree: its files live directly in path. path is a directory: git creates it, missing parents included, and an existing empty directory is used as it stands. A directory that already holds files is refused with GitOccupiedDirectoryException, its content untouched, before git runs; allowOccupied hands such a directory to git instead, which reinitializes an existing repository and keeps its data. initialBranch makes HEAD point at that branch; without it git's own default applies.

A path is always treated as a path, even when it is spelled like an option.

Implementation

@override
Future<GitFileBareRepository> initBare(
  String path, {
  String? initialBranch,
  bool allowOccupied = false,
}) async {
  await _init(
    path,
    initialBranch: initialBranch,
    bare: true,
    allowOccupied: allowOccupied,
  );
  return openBare(path);
}