summaryrefslogtreecommitdiff
path: root/include/git2/odb.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-07-09 15:05:14 +0200
committerVicent Marti <tanoku@gmail.com>2011-07-09 15:05:14 +0200
commitc52736fa5226141754918cabf55c22be9c2aee1b (patch)
tree97b9d36ba49045c53ab12a6529b7c6260065498b /include/git2/odb.h
parent3b2a423c3fb9e434c427b819d3281ae9e277091d (diff)
downloadlibgit2-c52736fa5226141754918cabf55c22be9c2aee1b.tar.gz
status: Cleanup
The `hashfile` function has been moved to ODB, next to `git_odb_hash`. Global state has been removed from the dirent call in `status.c`, because global state is killing the rainforest and causing global warming.
Diffstat (limited to 'include/git2/odb.h')
-rw-r--r--include/git2/odb.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h
index ef16e1e42..d0c369055 100644
--- a/include/git2/odb.h
+++ b/include/git2/odb.h
@@ -282,6 +282,19 @@ GIT_EXTERN(int) git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const
GIT_EXTERN(int) git_odb_hash(git_oid *id, const void *data, size_t len, git_otype type);
/**
+ * Read a file from disk and fill a git_oid with the object id
+ * that the file would have if it were written to the Object
+ * Database as an object of the given type. Similar functionality
+ * to git.git's `git hash-object` without the `-w` flag.
+ *
+ * @param out oid structure the result is written into.
+ * @param path file to read and determine object id for
+ * @param type the type of the object that will be hashed
+ * @return GIT_SUCCESS if valid; error code otherwise
+ */
+GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type);
+
+/**
* Close an ODB object
*
* This method must always be called once a `git_odb_object` is no