diff options
author | matej.risek <matej.risek@hashicorp.com> | 2023-05-04 09:04:23 +0200 |
---|---|---|
committer | matej.risek <matej.risek@hashicorp.com> | 2023-05-04 09:04:23 +0200 |
commit | ecc9fe45b6261492c0cfdcdb1ff4e642252d6694 (patch) | |
tree | 141642f1ebc5e5bc2b6435a54c33e55c00bcec7a /submodule_test.go | |
parent | b154dcce7059e4e02f8798db158b6a76ffc4a63e (diff) | |
download | go-git-ecc9fe45b6261492c0cfdcdb1ff4e642252d6694.tar.gz |
git: Add Depth to SubmoduleUpdateOptions
Diffstat (limited to 'submodule_test.go')
-rw-r--r-- | submodule_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/submodule_test.go b/submodule_test.go index 4bae544..a8a0681 100644 --- a/submodule_test.go +++ b/submodule_test.go @@ -233,3 +233,32 @@ func (s *SubmoduleSuite) TestSubmodulesUpdateContext(c *C) { err = sm.UpdateContext(ctx, &SubmoduleUpdateOptions{Init: true}) c.Assert(err, NotNil) } + +func (s *SubmoduleSuite) TestSubmodulesFetchDepth(c *C) { + if testing.Short() { + c.Skip("skipping test in short mode.") + } + + sm, err := s.Worktree.Submodule("basic") + c.Assert(err, IsNil) + + err = sm.Update(&SubmoduleUpdateOptions{ + Init: true, + Depth: 1, + }) + c.Assert(err, IsNil) + + r, err := sm.Repository() + c.Assert(err, IsNil) + + lr, err := r.Log(&LogOptions{}) + c.Assert(err, IsNil) + + commitCount := 0 + for _, err := lr.Next(); err == nil; _, err = lr.Next() { + commitCount++ + } + c.Assert(err, IsNil) + + c.Assert(commitCount, Equals, 1) +} |