aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-01-18 11:59:27 +0100
committerGitHub <noreply@github.com>2018-01-18 11:59:27 +0100
commitf6aca0820fb0a44d4c4875a21581a09609d63a6b (patch)
treecc94d2d3accb4f5277f2a13e571da275b0bbf08e /repository_test.go
parente9247ce9c5ce12126f646ca3ddf0066e4829bd14 (diff)
parent591aed138177b27b08a90c90e6e074a6cf2dbd00 (diff)
downloadgo-git-f6aca0820fb0a44d4c4875a21581a09609d63a6b.tar.gz
Merge pull request #721 from rykov/clone-no-checkout
Support for clone without checkout (git clone -n)
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go
index cf0805a..ef37e37 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -448,6 +448,28 @@ func (s *RepositorySuite) TestPlainCloneWithRecurseSubmodules(c *C) {
c.Assert(cfg.Submodules, HasLen, 2)
}
+func (s *RepositorySuite) TestPlainCloneNoCheckout(c *C) {
+ dir, err := ioutil.TempDir("", "plain-clone-no-checkout")
+ c.Assert(err, IsNil)
+ defer os.RemoveAll(dir)
+
+ path := fixtures.ByTag("submodule").One().Worktree().Root()
+ r, err := PlainClone(dir, false, &CloneOptions{
+ URL: path,
+ NoCheckout: true,
+ RecurseSubmodules: DefaultSubmoduleRecursionDepth,
+ })
+ c.Assert(err, IsNil)
+
+ h, err := r.Head()
+ c.Assert(err, IsNil)
+ c.Assert(h.Hash().String(), Equals, "b685400c1f9316f350965a5993d350bc746b0bf4")
+
+ fi, err := osfs.New(dir).ReadDir("")
+ c.Assert(err, IsNil)
+ c.Assert(fi, HasLen, 1) // .git
+}
+
func (s *RepositorySuite) TestFetch(c *C) {
r, _ := Init(memory.NewStorage(), nil)
_, err := r.CreateRemote(&config.RemoteConfig{