diff options
author | Santiago M. Mola <santi@mola.io> | 2016-12-14 23:12:44 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-12-14 23:12:44 +0100 |
commit | 0af572dd21c0aa79d13745b633ee24ba6c4d6cf1 (patch) | |
tree | 49e81e74e82d84fd88b2fc1e4b0dc7c7bfe9c40f /plumbing/object/commit_walker_test.go | |
parent | df0f38af83f972f026d7e14150f3d37b95f13484 (diff) | |
download | go-git-0af572dd21c0aa79d13745b633ee24ba6c4d6cf1.tar.gz |
move plumbing from top level package to plumbing (#183)
* plumbing: rename Object -> EncodedObject.
* plumbing/storer: rename ObjectStorer -> EncodedObjectStorer.
* move difftree to plumbing/difftree.
* move diff -> utils/diff
* make Object/Tag/Blob/Tree/Commit/File depend on storer.
* Object and its implementations now depend only on
storer.EncodedObjectStorer, not git.Repository.
* Tests are decoupled accordingly.
* move Object/Commit/File/Tag/Tree to plumbing/object.
* move Object/Commit/File/Tag/Tree to plumbing/object.
* move checkClose to utils/ioutil.
* move RevListObjects to plumbing/revlist.Objects.
* move DiffTree to plumbing/difftree package.
* rename files with plural nouns to singular
* plumbing/object: add GetBlob/GetCommit/GetTag/GetTree.
Diffstat (limited to 'plumbing/object/commit_walker_test.go')
-rw-r--r-- | plumbing/object/commit_walker_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/plumbing/object/commit_walker_test.go b/plumbing/object/commit_walker_test.go new file mode 100644 index 0000000..67d6695 --- /dev/null +++ b/plumbing/object/commit_walker_test.go @@ -0,0 +1,34 @@ +package object + +import . "gopkg.in/check.v1" + +type CommitWalkerSuite struct { + BaseObjectsSuite +} + +var _ = Suite(&CommitWalkerSuite{}) + +func (s *CommitWalkerSuite) TestWalkerNext(c *C) { + commit := s.commit(c, s.Fixture.Head) + + var commits []*Commit + + WalkCommitHistory(commit, func(c *Commit) error { + commits = append(commits, c) + return nil + }) + + SortCommits(commits) + c.Assert(commits, HasLen, 8) + + expected := []string{ + "b029517f6300c2da0f4b651b8642506cd6aaf45d", "b8e471f58bcbca63b07bda20e428190409c2db47", + "35e85108805c84807bc66a02d91535e1e24b38b9", "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69", + "1669dce138d9b841a518c64b10914d88f5e488ea", "af2d6a6954d532f8ffb47615169c8fdf9d383a1a", + "918c48b83bd081e863dbe1b80f8998f058cd8294", "6ecf0ef2c2dffb796033e5a02219af86ec6584e5", + } + + for i, commit := range commits { + c.Assert(commit.Hash.String(), Equals, expected[i]) + } +} |