15. Index
These Methods allow us to read, modify, create, delete working index for a given
git repository
.
Add an index entry to a present index in a git repo.
Parameters |
Returns |
luagit2_index |
None |
luagit2_index_entry |
luagit2_index
: The index where to add a new index entry.
luagit2_index_entry
: The Index entry to be added.
- returns None or gives an error.
Add a file to a present index in a git repo.
Parameters |
Returns |
luagit2_index |
None |
file_path (string) |
luagit2_index
: The index where to add a new index entry.
file_path
: The path of file to be added.
- returns None or gives an error.
Get index capabilities flags value for a present index in a git repo.
Parameters |
Returns |
luagit2_index |
Caps_val (integer) |
luagit2_index
: The index where to add a new index entry.
- returns an integer or gives an error.
Get the checksum of the index. A luagit2_oid is returned whose str value is equal to index’s checksum.
Parameters |
Returns |
luagit2_index |
luagit2_oid |
luagit2_index
: The index whose checksum to find.
- returns corresponding
luagit2_oid
or gives an error.
Add or update index entries to represent a conflict. Any staged entries that exist at the given paths will be removed.
parameters |
Returns |
luagit2_index |
None |
luagit2_index_entry(ancestor) |
luagit2_index_entry(ours) |
luagit2_index_entry(theirs) |
luagit2_index
: The index where to add.
luagit2_index_entry
: The entry data for the ancestor of the conflict.
luagit2_index_entry
: The entry data for our side of the merge conflict.
luagit2_index_entry
: The entry data for their side of the merge conflict.
- Returns None or gives an error.
Remove all conflicts in the index
Parameters |
Returns |
luagit2_index |
None |
luagit2_index
: The index whose conflicts are to be cleaned up.
- returns None or gives an error.
Return whether the given index entry is a conflict.
Parameters |
Returns |
luagit2_index_entry |
is_confict (Boolean) |
luagit2_index_entry
: The index entry to check.
- returns Boolean for accordingly as if the enrty is a conflict or not or gives an error.
Get the staged index value for the index entry.
Parameters |
Returns |
luagit2_index_entry |
stage_index (integer) |
luagit2_index_entry
: The index entry for which the stage index value is to be found.
- returns stage index value of index entry or gives an error.
Get the number of entries in a luagit2_index.
Parameters |
Returns |
luagit2_index |
entry_count (integer) |
luagit2_index
: The index whose entry count is to be found.
- Returns integer value of entry count or gives an error.
Find the first position of any entries which point to given path in the Git index.
Parameters |
Returns |
luagit2_index |
idx_pos (integer) |
file_path (string) |
luagit2_index
: The index where to search in.
file_path
: The file path to search for.
- Returns an integer value for the index position or gives an error
Find the first position of any entries which point to given prefix name in the Git index.
Parameters |
Returns |
luagit2_index |
idx_pos (integer) |
prefix_name (string) |
luagit2_index
: The index where to search in.
prefix_name
: The prefix name to search for.
- Returns an integer value for the index position or gives an error.
Get an Index entry by its index number in a given git index.
Parameters |
Returns |
luagit2_index |
luagit2_index_entry |
idx_num (integer) |
luagit2_index
: The index where to look for entry.
idx_pos
: The index position of entry in the luagit2_index.
- Returns corresponding
luagit2_index_entry
or gives an error.
Parameters |
Returns |
luagit2_index |
luagit2_index_entry |
file_path (string) |
stage_val (integer) |
luagit2_index
: The index where to search in.
file_path
: The file path to search for.
stage_val
: The stage value for the indexentry .
- Returns corresponding
luagit2_index_entry
or gives an error.
Check if a luagit2_index has conflicting entries.
Parameters |
Returns |
luagit2_index |
has_conflicts (Boolean) |
luagit2_index
: The index which is to be checked.
- Returns Boolean value if index has conflicts or gives an error.
Open a git index from its path.
Parameters |
Returns |
index_path (string) |
luagit2_index |
- Returns
luagit2_index
or gives an error.
Get the owner repo for a given git index
Parameters |
Returns |
luagit2_index |
luagit2_reposiotory |
- Returns corresponding owner
luagit2_reposiotory
or gives an error.
Get the file path of a given git index.
Parameters |
Returns |
luagit2_index |
path (string) |
- Returns corresponding path or gives an error.
Update the index by reading values from disk. (actual values in the repo)
Parameters |
Returns |
luagit2_index |
None |
force (integer) |
luagit2_index
: The index to be updated.
force
: integer equivalent of bool to force reading values from disk.
- Returns none but updated values in the luagit2_index.
Read values from a given tree into the git index.
Parameters |
Returns |
luagit2_index |
None |
luagit2_tree |
luagit2_index
: The index to read values into.
luagit2_tree
: The tree where to read values from.
- Returns none but updated values in the luagit2_index.
Remove an entry from index. This should remove the staged index entry.
Parameters |
Returns |
luagit2_index |
None |
file_path (string) |
stage_val (integer) |
luagit2_index
: The index where to search in.
file_path
: The file path to search for.
stage_val
: The stage value for the index entry .
- Returns None or gives an error.
Remove an entry from index using only file path. This should remove the index entry completely.
Parameters |
Returns |
luagit2_index |
None |
file_path (string) |
luagit2_index
: The index where to search in.
file_path
: The file path to search for.
- Returns None or gives an error.
Remove an Directory from index. This should remove the staged index entry.
Parameters |
Returns |
luagit2_index |
None |
directory_path (string) |
stage_val (integer) |
luagit2_index
: The index where to search in.
directory_path
: The directory path to search for.
stage_val
: The stage value for the index entry .
- Returns None or gives an error.
Parameters |
Returns |
luagit2_index |
None |
caps_val (integer) |
luagit2_index
: The index value whose capabilities flags are to be set.
caps_val
: The integer value for the flags value of capabilities for index.
- Returns None or gives an error.
Parameters |
Returns |
luagit2_index |
None |
version_number (integer) |
luagit2_index
: The index value whose capabilities flags are to be set.
version_number
: The integer value of version for index.
- Returns None or gives an error.
Parameters |
Returns |
luagit2_index |
version_number (integer) |
luagit2_index
: The index whose version is to be found.
- returns None or gives an error.
Write the index to disk.
Parameters |
Returns |
luagit2_index |
None |
luagit2_index
: The index to be written to disk.
- returns None or gives an error.
Write index to a tree.
Parameters |
Returns |
luagit2_index |
luagit2_oid |
luagit2_index
: The index to be written to tree.
- returns
luagit2_oid
of the tree or gives an error.
Parameters |
Returns |
luagit2_index |
luagit2_oid |
luagit2_reposiotory |
luagit2_index
: The index to be written to tree.
luagit2_reposiotory
: The repository to write to.
- returns
luagit2_oid
of the tree or gives an error.
Parameters |
Returns |
luagit2_index |
None |
luagit2_index
: The index to be freed.
- returns None or gives an error.