Module Index
Class "Index".
Functions
Index.bare (index_path) | Create a new Index object. |
Index:add (source_entry) | object method. |
Index:add_bypath (path) | object method. |
Index:clear () | object method. |
Index:entrycount () | object method. |
Index:find (at_pos, path) | object method. |
Index:get_byindex (n) | object method. |
Index:get_bypath (path, stage) | object method. |
Index:read (force) | object method. |
Index:read_tree (tree) | object method. |
Index:remove (path, stage) | object method. |
Index:reuc_entrycount () | object method. |
Index:reuc_get_byindex (n) | object method. |
Index:reuc_get_bypath (path) | object method. |
Index:write () | object method. |
Functions
- Index.bare (index_path)
-
Create a new Index object.
Calls git_index_open:
Since there is no ODB or working directory behind this index, any Index methods which rely on these (e.g. index_add) will fail with the GIT_EBAREINDEX error code.
If you need to access the index of an actual repository, use the `git_repository_index` wrapper.
The index must be freed once it's no longer in use.
Parameters
-
index_path: the path to the index file in disk. Must be of type
string
.
Return values:
- Index or
nil
on error. - Error string.
-
index_path: the path to the index file in disk. Must be of type
- Index:add (source_entry)
-
object method.
Calls git_index_add:
The file `path` must be relative to the repository's working folder and must be readable.
This method will fail in bare index instances.
This forces the file to be added to the index, not looking at gitignore rules. Those rules can be evaluated through the git_status APIs (in status.h) before calling this.
Parameters
- source_entry: Must be of type IndexEntry.
Return values:
true
if no error.- Error string.
- Index:add_bypath (path)
-
object method.
Parameters
-
path: Must be of type
string
.
Return values:
true
if no error.- Error string.
-
path: Must be of type
- Index:clear ()
-
object method.
Calls git_index_clear:
- Index:entrycount ()
-
object method.
Calls git_index_entrycount:
Return value:
integer
. - Index:find (at_pos, path)
-
object method.
Calls git_index_find:
Parameters
-
at_pos: Must be of type
lightuserdata
. -
path: path to search. Must be of type
string
.
Return value:
integer
. -
at_pos: Must be of type
- Index:get_byindex (n)
-
object method.
Parameters
-
n: Must be of type
integer
.
Return value:
IndexEntry. -
n: Must be of type
- Index:get_bypath (path, stage)
-
object method.
Parameters
-
path: Must be of type
string
. -
stage: Must be of type
integer
.
Return value:
IndexEntry. -
path: Must be of type
- Index:read (force)
-
object method.
Calls git_index_read:
Parameters
-
force: Must be of type
integer
.
Return values:
true
if no error.- Error string.
-
force: Must be of type
- Index:read_tree (tree)
-
object method.
Calls git_index_read_tree:
The current index contents will be replaced by the specified tree.
Parameters
- tree: tree to read. Must be of type Tree.
Return values:
true
if no error.- Error string.
- Index:remove (path, stage)
-
object method.
Calls git_index_remove:
Parameters
-
path: Must be of type
string
. -
stage: Must be of type
integer
.
Return values:
true
if no error.- Error string.
-
path: Must be of type
- Index:reuc_entrycount ()
-
object method.
Return value:
integer
. - Index:reuc_get_byindex (n)
-
object method.
Parameters
-
n: Must be of type
integer
.
Return value:
IndexEntryUnmerged. -
n: Must be of type
- Index:reuc_get_bypath (path)
-
object method.
Parameters
-
path: Must be of type
string
.
Return value:
IndexEntryUnmerged. -
path: Must be of type
- Index:write ()
-
object method.
Calls git_index_write:
Return values:
true
if no error.- Error string.