aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit_walker_test.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2024-03-06 09:19:20 +0000
committerGitHub <noreply@github.com>2024-03-06 09:19:20 +0000
commit8d007039aba42c77964cdcb14dd8b86ccabb3469 (patch)
tree472e7549ce53858bf4c0a59dbfa9d726b5b5be34 /plumbing/object/commit_walker_test.go
parent5c6c3939ee4a741aec9c57777c1106077bd96519 (diff)
parentfc222017c0c8e72a7b0a30aab46b494cbc92d3ab (diff)
downloadgo-git-8d007039aba42c77964cdcb14dd8b86ccabb3469.tar.gz
Merge pull request #1036 from onee-only/master
plumbing: object, Make first commit visible on logs filtered with filename. Fixes #191
Diffstat (limited to 'plumbing/object/commit_walker_test.go')
-rw-r--r--plumbing/object/commit_walker_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/plumbing/object/commit_walker_test.go b/plumbing/object/commit_walker_test.go
index c47d68b..fa0ca7d 100644
--- a/plumbing/object/commit_walker_test.go
+++ b/plumbing/object/commit_walker_test.go
@@ -228,3 +228,29 @@ func (s *CommitWalkerSuite) TestCommitBSFIteratorWithIgnore(c *C) {
c.Assert(commit.Hash.String(), Equals, expected[i])
}
}
+
+func (s *CommitWalkerSuite) TestCommitPathIteratorInitialCommit(c *C) {
+ commit := s.commit(c, plumbing.NewHash(s.Fixture.Head))
+
+ fileName := "LICENSE"
+
+ var commits []*Commit
+ NewCommitPathIterFromIter(
+ func(path string) bool { return path == fileName },
+ NewCommitIterCTime(commit, nil, nil),
+ true,
+ ).ForEach(func(c *Commit) error {
+ commits = append(commits, c)
+ return nil
+ })
+
+ expected := []string{
+ "b029517f6300c2da0f4b651b8642506cd6aaf45d",
+ }
+
+ c.Assert(commits, HasLen, len(expected))
+
+ for i, commit := range commits {
+ c.Assert(commit.Hash.String(), Equals, expected[i])
+ }
+}