diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2013-05-21 11:05:21 -0500 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2013-06-17 10:03:14 -0700 |
| commit | 1ee2ef87ec4c2c63b7c89849eb9daad9e46e6fe7 (patch) | |
| tree | d10293ba11d1ed7cb54df329b75d293bf8c3e9aa /include | |
| parent | 09c2f91c150a4862c9189d9e08d0dc111d4d706c (diff) | |
| download | libgit2-1ee2ef87ec4c2c63b7c89849eb9daad9e46e6fe7.tar.gz | |
status access by index, providing more details to callers
Diffstat (limited to 'include')
| -rw-r--r-- | include/git2/status.h | 63 | ||||
| -rw-r--r-- | include/git2/types.h | 3 |
2 files changed, 66 insertions, 0 deletions
diff --git a/include/git2/status.h b/include/git2/status.h index 38b6fa5bd..ce1d44a06 100644 --- a/include/git2/status.h +++ b/include/git2/status.h @@ -174,10 +174,73 @@ typedef struct { git_strarray pathspec; } git_status_options; +/** + * A status entry, providing the differences between the file as it exists + * in HEAD and the index, and providing the differences between the index + * and the working directory. + * + * The `status` value provides the status flags for this file. + * + * The `head_to_index` value provides detailed information about the + * differences between the file in HEAD and the file in the index. + * + * The `index_to_workdir` value provides detailed information about the + * differences between the file in the index and the file in the + * working directory. + */ +typedef struct { + git_status_t status; + git_diff_delta *head_to_index; + git_diff_delta *index_to_workdir; +} git_status_entry; + #define GIT_STATUS_OPTIONS_VERSION 1 #define GIT_STATUS_OPTIONS_INIT {GIT_STATUS_OPTIONS_VERSION} /** + * Gather file status information and populate the `git_status_list`. + * + * @param out Pointer to store the status results in + * @param repo Repository object + * @param opts Status options structure + * @return 0 on success or error code + */ +GIT_EXTERN(int) git_status_list_new( + git_status_list **out, + git_repository *repo, + const git_status_options *opts); + +/** + * Gets the count of status entries in this list. + * + * @param statuslist Existing status list object + * @return the number of status entries + */ +GIT_EXTERN(size_t) git_status_list_entrycount( + git_status_list *statuslist); + +/** + * Get a pointer to one of the entries in the status list. + * + * The entry is not modifiable and should not be freed. + * + * @param statuslist Existing status list object + * @param idx Position of the entry + * @return Pointer to the entry; NULL if out of bounds + */ +GIT_EXTERN(const git_status_entry *) git_status_byindex( + git_status_list *statuslist, + size_t idx); + +/** + * Free an existing status list + * + * @param statuslist Existing status list object + */ +GIT_EXTERN(void) git_status_list_free( + git_status_list *statuslist); + +/** * Gather file status information and run callbacks as requested. * * This is an extended version of the `git_status_foreach()` API that diff --git a/include/git2/types.h b/include/git2/types.h index 1bfa73be6..dc344075c 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -174,6 +174,9 @@ typedef struct git_reference_iterator git_reference_iterator; /** Merge heads, the input to merge */ typedef struct git_merge_head git_merge_head; +/** Representation of a status collection */ +typedef struct git_status_list git_status_list; + /** Basic type of any Git reference. */ typedef enum { |
