summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-06-20 14:05:02 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-06-20 14:05:02 -0400
commit883cb642cb1b58a5ede7ebf107aa7fee9025d622 (patch)
treecede4c9e6f2399ee17eee12da9ae6167d5123a4d /include/git2
parent3e5b553ae1f29e0388b8c64624e54b84b33a945e (diff)
parent624c949f01ca553fdd0b42fbac439e822c1bdd5f (diff)
downloadlibgit2-883cb642cb1b58a5ede7ebf107aa7fee9025d622.tar.gz
Merge pull request #3236 from libgit2/cmn/index-checksum
Use the checksum to check whether an index has been modified
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/index.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index 49bbe1614..7caf3ed78 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -274,6 +274,18 @@ GIT_EXTERN(int) git_index_write(git_index *index);
GIT_EXTERN(const char *) git_index_path(const git_index *index);
/**
+ * Get the checksum of the index
+ *
+ * This checksum is the SHA-1 hash over the index file (except the
+ * last 20 bytes which are the checksum itself). In cases where the
+ * index does not exist on-disk, it will be zeroed out.
+ *
+ * @param index an existing index object
+ * @return a pointer to the checksum of the index
+ */
+GIT_EXTERN(const git_oid *) git_index_checksum(git_index *index);
+
+/**
* Read a tree into the index file with stats
*
* The current index contents will be replaced by the specified tree.