aboutsummaryrefslogtreecommitdiffstats
path: root/references.go
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-28 15:09:15 +0100
committerAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-03-03 16:16:29 +0100
commit900691567e51bf95bb92d36951e2b7b79d2596cc (patch)
tree3ec9bb0f50545745919ce9744095170b22aa8366 /references.go
parentd105e15d91e7553d9d40d6e9fffe0a5008cf8afe (diff)
downloadgo-git-900691567e51bf95bb92d36951e2b7b79d2596cc.tar.gz
improve git package documentation (fix #231)
Diffstat (limited to 'references.go')
-rw-r--r--references.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/references.go b/references.go
index fe1d12b..338e2b7 100644
--- a/references.go
+++ b/references.go
@@ -10,15 +10,18 @@ import (
"github.com/sergi/go-diff/diffmatchpatch"
)
-// References returns a References for the file at "path", the commits are
-// sorted in commit order. It stops searching a branch for a file upon reaching
-// the commit were the file was created.
+// References returns a slice of Commits for the file at "path", starting from
+// the commit provided that contains the file from the provided path. The last
+// commit into the returned slice is the commit where the file was created.
+// If the provided commit does not contains the specified path, a nil slice is
+// returned. The commits are sorted in commit order, newer to older.
//
// Caveats:
+//
// - Moves and copies are not currently supported.
+//
// - Cherry-picks are not detected unless there are no commits between them and
-// therefore can appear repeated in the list.
-// (see git path-id for hints on how to fix this).
+// therefore can appear repeated in the list. (see git path-id for hints on how to fix this).
func References(c *object.Commit, path string) ([]*object.Commit, error) {
var result []*object.Commit
seen := make(map[plumbing.Hash]struct{}, 0)