Xgit v0.1.4 Xgit.Repository.WorkingTree View Source
A working tree is an on-disk manifestation of a commit or pending commit in a git repository.
An Xgit.Repository
may have a default working tree associated with it or
it may not. (Such a repository is often referred to as a "bare" repository.)
More than one working tree may be associated with a repository, though this is not (currently) well-tested in Xgit.
A working tree is itself strictly tied to a file system, but it need not be tied to an on-disk repository instance.
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.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Returns a current snapshot of the working tree state.
Starts a WorkingTree
process linked to the current process.
Returns true
if the argument is a PID representing a valid WorkingTree
process.
Link to this section Types
The process ID for a WorkingTree
process.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
dir_cache(working_tree)
View Sourcedir_cache(working_tree :: t()) :: {:ok, Xgit.Core.DirCache.t()} | {:error, reason :: Xgit.Repository.WorkingTree.ParseIndexFile.from_iodevice_reason()}
Returns a current snapshot of the working tree state.
Return Value
{:ok, dir_cache}
if an index file exists and could be parsed as a dir cache file.
{:ok, dir_cache}
if no index file exists. (dir_cache
will have zero entries.)
{:error, reason}
if the file exists but could not be parsed.
See Xgit.Repository.WorkingTree.ParseIndexFile.from_iodevice/1
for possible
reason codes.
TO DO
Find index file in appropriate location (i.e. as potentially modified
by .git/config
file). Issue #86
Cache state of index file so we don't have to parse it for every all. Issue #87
Consider scalability of passing a potentially large Xgit.Core.DirCache
structure
across process boundaries. Issue #88
start_link(repository, work_dir, options \\ [])
View Sourcestart_link( repository :: Xgit.Repository.t(), work_dir :: Path.t(), GenServer.options() ) :: GenServer.on_start()
Starts a WorkingTree
process linked to the current process.
Parameters
repository
is the associated Xgit.Repository
process.
work_dir
is the root path for the working tree.
options
are passed to GenServer.start_link/3
.
Return Value
If the process is unable to create the working directory root, the response
will be {:error, {:mkdir, :eexist}}
(or perhaps a different posix error code).
Returns true
if the argument is a PID representing a valid WorkingTree
process.