-- -- Warning: AUTOGENERATED DOCS. -- --- Class "Reference". -- module("Reference") --- Create a new Reference object. -- --

Calls git_reference_lookup:

The generated reference must be freed by the user. -- @param repo the repository to look up the reference. Must be of type Repository. -- @param name the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...). Must be of type string. -- @return Reference or nil on error. -- @return Error string. -- @name Reference.lookup function Reference.lookup(repo, name) end --- object method. -- --

Calls git_reference_oid:

Only available if the reference is direct (i.e. not symbolic) -- @return OID. -- @name Reference:oid function Reference:oid() end --- object method. -- --

Calls git_reference_set_oid:

The reference must be a direct reference, otherwise -- this method will fail.

The reference will be automatically updated in -- memory and on disk. -- @param oid Must be of type OID. -- @return true if no error. -- @return Error string. -- @name Reference:set_oid function Reference:set_oid(oid) end --- object method. -- --

Calls git_reference_target:

Only available if the reference is symbolic -- @return string. -- @name Reference:target function Reference:target() end --- object method. -- --

Calls git_reference_set_target:

The reference must be a symbolic reference, otherwise -- this method will fail.

The reference will be automatically updated in -- memory and on disk. -- @param target The new target for the reference. Must be of type string. -- @return true if no error. -- @return Error string. -- @name Reference:set_target function Reference:set_target(target) end --- object method. -- --

Calls git_reference_type:

Either direct (GIT_REF_OID) or symbolic (GIT_REF_SYMBOLIC) -- @return integer. -- @name Reference:type function Reference:type() end --- object method. -- --

Calls git_reference_name:

-- @return string. -- @name Reference:name function Reference:name() end --- object method. -- --

Calls git_reference_resolve:

Thie method iteratively peels a symbolic reference -- until it resolves to a direct reference to an OID.

The peeled reference is returned in the `resolved_ref` -- argument, and must be freed manually once it's no longer -- needed.

If a direct reference is passed as an argument, -- a copy of that reference is returned. This copy must -- be manually freed too. -- @return Reference or nil on error. -- @return Error string. -- @name Reference:resolve function Reference:resolve() end --- object method. -- --

Calls git_reference_owner:

-- @return Repository. -- @name Reference:owner function Reference:owner() end --- object method. -- --

Calls git_reference_rename:

This method works for both direct and symbolic references. -- The new name will be checked for validity and may be -- modified into a normalized form.

The given git_reference will be updated in place.

The reference will be immediately renamed in-memory -- and on disk.

If the `force` flag is not enabled, and there's already -- a reference with the given name, the renaming will fail.

IMPORTANT: -- The user needs to write a proper reflog entry if the -- reflog is enabled for the repository. We only rename -- the reflog if it exists. -- @param new_name The new name for the reference. Must be of type string. -- @param force Overwrite an existing reference. Must be of type boolean. -- @return true if no error. -- @return Error string. -- @name Reference:rename function Reference:rename(new_name, force) end --- object method. -- --

Calls git_reference_delete:

This method works for both direct and symbolic references.

The reference will be immediately removed on disk and from -- memory. The given reference pointer will no longer be valid. -- @return true if no error. -- @return Error string. -- @name Reference:delete function Reference:delete() end --- module function. -- --

Calls git_reference_packall:

This method will load into the cache all the loose -- references on the repository and update the -- `packed-refs` file with them.

Once the `packed-refs` file has been written properly, -- the loose references will be removed from disk. -- @param repo Repository where the loose refs will be packed. Must be of type Repository. -- @return true if no error. -- @return Error string. -- @name Reference.packall function Reference.packall(repo) end --- module function. -- -- @param repo Must be of type Repository. -- @param list_flags Must be of type integer. -- @return StrArray or nil on error. -- @return Error string. -- @name Reference.list function Reference.list(repo, list_flags) end