summaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-05-19 15:05:00 +0200
committerCarlos Martín Nieto <[email protected]>2015-05-19 15:05:00 +0200
commit72c19f73c9170720780839cd1561486e075d35a8 (patch)
tree55f48583cec75d41265679ccad2075730ab2b786 /index.go
parentd7a0495000e35d06993605a9a31a5f9823292f8a (diff)
Index: Add Path() accessor
Diffstat (limited to 'index.go')
-rw-r--r--index.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/index.go b/index.go
index 2082ebd..1a899f1 100644
--- a/index.go
+++ b/index.go
@@ -114,6 +114,12 @@ func OpenIndex(path string) (*Index, error) {
return &Index{ptr: ptr}, nil
}
+// Path returns the index' path on disk or an empty string if it
+// exists only in memory.
+func (v *Index) Path() string {
+ return C.GoString(C.git_index_path(v.ptr))
+}
+
// Add adds or replaces the given entry to the index, making a copy of
// the data
func (v *Index) Add(entry *IndexEntry) error {