summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/git2/index.h8
-rw-r--r--src/index.c6
2 files changed, 14 insertions, 0 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index 1fb77efa3..b44535601 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -240,6 +240,14 @@ GIT_EXTERN(int) git_index_read(git_index *index);
GIT_EXTERN(int) git_index_write(git_index *index);
/**
+ * Get the full path to the index file on disk.
+ *
+ * @param index an existing index object
+ * @return path to index file or NULL for in-memory index
+ */
+GIT_EXTERN(const char *) git_index_path(git_index *index);
+
+/**
* Read a tree into the index file with stats
*
* The current index contents will be replaced by the specified tree.
diff --git a/src/index.c b/src/index.c
index 21efd2c63..bd5e192f3 100644
--- a/src/index.c
+++ b/src/index.c
@@ -516,6 +516,12 @@ int git_index_write(git_index *index)
return 0;
}
+const char * git_index_path(git_index *index)
+{
+ assert(index);
+ return index->index_file_path;
+}
+
int git_index_write_tree(git_oid *oid, git_index *index)
{
git_repository *repo;