Xgit v0.8.0 Xgit.Repository.OnDisk View Source
Implementation of Xgit.Repository.Storage
that stores content on the
local file system.
IMPORTANT NOTE: This is intended as a reference implementation largely
for testing purposes and may not necessarily handle all of the edge cases that
the traditional git
command-line interface will handle.
That said, it does intentionally use the same .git
folder format as command-line
git
so that results may be compared for similar operations.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Creates a new, empty git repository on the local file system.
Start an on-disk git repository.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
create(work_dir)
View Sourcecreate(work_dir :: Path.t()) :: :ok | {:error, :work_dir_must_not_exist}
Creates a new, empty git repository on the local file system.
Analogous to git init
.
NOTE: We use the name create
here so as to avoid a naming conflict with
GenServer.init/1
.
Parameters
work_dir
(String) is the top-level working directory. A .git
directory is
created inside this directory.
Return Value
:ok
if created successfully.
{:error, :work_dir_must_not_exist}
if work_dir
already exists.
start_link(opts)
View Sourcestart_link([{:work_dir, Path.t()}]) :: GenServer.on_start()
Start an on-disk git repository.
Use the functions in Xgit.Repository.Storage
to interact with this repository process.
An Xgit.Repository.WorkingTree
will be automatically created and attached
to this repository.
Options
:work_dir
(required): Top-level working directory. A.git
directory should exist at this path. Usecreate/1
to create an empty on-disk repository if necessary.
Any other options are passed through to GenServer.start_link/3
.
Return Value
{:error, :work_dir_invalid}
if work_dir
is missing or not a String.