aboutsummaryrefslogtreecommitdiffstats
path: root/submodule_test.go
diff options
context:
space:
mode:
authormatej.risek <matej.risek@hashicorp.com>2023-05-04 09:04:23 +0200
committermatej.risek <matej.risek@hashicorp.com>2023-05-04 09:04:23 +0200
commitecc9fe45b6261492c0cfdcdb1ff4e642252d6694 (patch)
tree141642f1ebc5e5bc2b6435a54c33e55c00bcec7a /submodule_test.go
parentb154dcce7059e4e02f8798db158b6a76ffc4a63e (diff)
downloadgo-git-ecc9fe45b6261492c0cfdcdb1ff4e642252d6694.tar.gz
git: Add Depth to SubmoduleUpdateOptions
Diffstat (limited to 'submodule_test.go')
-rw-r--r--submodule_test.go29
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)
+}