View Source egit (egit v0.1.2)
Link to this section Summary
Functions
Same as
add(Repo, FileSpecs, Opts)
.Add files matching
PathSpecs
to index.Add all pending changes
Provide content or type and size information for repository objects
Provide content or type and size information for repository objects
Same as
checkout(Repo, Revision, [])
.Provide content or type and size information for repository objects. If
Opts
contains verbose
(and optionally perf
), then the return is a map with checkout stats.Clone a remote repository to the local path
Commit changes to a repository
Lookup commit details identified by OID
Fetch from origin
Fetch from given remote (e.g.
<<"origin">>
)Open a local git repository
Pull from origin
Pull from given remote (e.g.
<<"origin">>
)Reverse parse a reference. See https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for the formats of a Spec
.
Link to this section Types
-type add_opt() :: verbose | dry_run | update | force.
-type add_opts() :: [add_opt()].
-type cat_file_opt() :: type | size | all.
-type checkout_opt() :: force | verbose | perf.
-type checkout_opts() :: [checkout_opt()].
-type checkout_stats() ::
#{chmod_calls => integer(),
mkdir_calls => integer(),
stat_calls => integer(),
total_steps => integer()}.
-type commit_opt() ::
encoding | message | summary | time | time_offset | committer | author | header | tree_id.
-type commit_opts() :: [commit_opt()].
-type repository() :: reference().
Link to this section Functions
-spec add(repository(), binary() | [binary()]) -> [binary()] | {error, term()}.
add(Repo, FileSpecs, Opts)
.
-spec add(repository(), [binary()], add_opts()) -> [binary()] | {error, term()}.
PathSpecs
to index.
-spec cat_file(repository(), binary()) -> {ok, term()} | {error, term()}.
-spec cat_file(repository(), binary(), cat_file_opt()) -> {ok, term()} | {error, term()}.
-spec checkout(repository(), binary()) -> ok | {error, term()}.
checkout(Repo, Revision, [])
.
-spec checkout(repository(), binary(), checkout_opts()) -> ok | checkout_stats() | {error, term()}.
Opts
contains verbose
(and optionally perf
), then the return is a map with checkout stats.
-spec clone(binary(), binary()) -> repository().
-spec commit(repository(), binary()) -> {ok, OID :: binary()} | {error, binary() | atom()}.
-spec commit_lookup(repository(), binary(), [commit_opt()]) -> #{commit_opt() => term()}.
-spec fetch(repository()) -> ok | {error, binary()}.
-spec fetch(repository(), binary()) -> ok | {error, binary()}.
<<"origin">>
)
-spec open(binary()) -> repository().
-spec pull(repository()) -> ok | {error, binary()}.
-spec pull(repository(), binary()) -> ok | {error, binary()}.
<<"origin">>
)
-spec rev_parse(repository(), binary()) -> {ok, binary()} | map() | {error, binary() | atom()}.
Reverse parse a reference. See https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for the formats of a Spec
.
When a reference refers to a single object, an ok tuple with a binary string of the commit hash is returned. When it refers to a range (e.g. HEAD..HEAD~2`), a map is returned with `from
and to
keys. When using a Symmetric Difference Notation ...
(i.e. HEAD...HEAD~4
), a map with three keys from
, to
, and merge_base
is returned.
2> egit:rev_parse(R,<<"HEAD~4">>).
{ok, <<"f5035e0341d00e8f4b5e36356571e7754e3e447"...>>}
3> egit:rev_parse(R,<<"HEAD..HEAD~4">>).
#{from => <<"24ffd5825abcfb74363a91ac28379add925ac65"...>>,
to => <<"f5035e0341d00e8f4b5e36356571e7754e3e447"...>>}
4> egit:rev_parse(R,<<"HEAD...HEAD~4">>).
#{from => <<"24ffd5825abcfb74363a91ac28379add925ac65"...>>,
merge_base =>
<<"f5035e0341d00e8f4b5e36356571e7754e3e447"...>>,
to => <<"f5035e0341d00e8f4b5e36356571e7754e3e447"...>>}