commit.h (2026B)
1 #ifndef GITOUT_GIT_COMMIT_H_ 2 #define GITOUT_GIT_COMMIT_H_ 3 4 #include <time.h> 5 6 #include "git/delta.h" 7 8 /* A git commit. */ 9 typedef struct GitCommit GitCommit; 10 11 /* Returns the commit OID as a SHA1 hash. */ 12 const char* gitcommit_oid(const GitCommit* commit); 13 14 /* Returns the parent commit OID as a SHA1 hash, or NULL if there is no parent 15 * commit. */ 16 const char* gitcommit_parentoid(const GitCommit* commit); 17 18 /* Returns the commit summary. This is the first line of the commit message. */ 19 const char* gitcommit_summary(const GitCommit* commit); 20 21 /* Returns the commit message, excluding the summary. */ 22 const char* gitcommit_message(const GitCommit* commit); 23 24 /* Returns the commit author name. */ 25 const char* gitcommit_author_name(const GitCommit* commit); 26 27 /* Returns the commit author email. */ 28 const char* gitcommit_author_email(const GitCommit* commit); 29 30 /* Returns the author time. */ 31 time_t gitcommit_author_time(const GitCommit* commit); 32 33 /* Returns the timezone for the time returned by gitcommit_author_time. */ 34 int gitcommit_author_timezone_offset(const GitCommit* commit); 35 36 /* Returns the commit time. */ 37 time_t gitcommit_commit_time(const GitCommit* commit); 38 39 /* Returns the timezone for the time returned by gitcommit_commit_time. */ 40 int gitcommit_commit_timezone_offset(const GitCommit* commit); 41 42 /* Returns the delta at the specified index. The index must be less than the 43 * value returned by gitcommit_delta_count. */ 44 GitDelta* gitcommit_delta(const GitCommit* commit, size_t index); 45 46 /* Returns the total number of deltas in this commit. */ 47 size_t gitcommit_delta_count(const GitCommit* commit); 48 49 /* Returns the sum of lines added across all deltas in this commit. */ 50 size_t gitcommit_addcount(const GitCommit* commit); 51 52 /* Returns the sum of lines deleted across all deltas in this commit. */ 53 size_t gitcommit_delcount(const GitCommit* commit); 54 55 /* Returns the sum of files modified across all deltas in this commit. */ 56 size_t gitcommit_filecount(const GitCommit* commit); 57 58 #endif // GITOUT_GIT_COMMIT_H_