aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/repository_test.go b/repository_test.go
index 9e000a3..3154f1d 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -518,6 +518,30 @@ func (s *RepositorySuite) TestPlainInit(c *C) {
c.Assert(cfg.Core.IsBare, Equals, true)
}
+func (s *RepositorySuite) TestPlainInitWithOptions(c *C) {
+ dir, clean := s.TemporalDir()
+ defer clean()
+
+ r, err := PlainInitWithOptions(dir, &PlainInitOptions{
+ InitOptions: InitOptions{
+ DefaultBranch: "refs/heads/foo",
+ },
+ Bare: false,
+ })
+ c.Assert(err, IsNil)
+ c.Assert(r, NotNil)
+
+ cfg, err := r.Config()
+ c.Assert(err, IsNil)
+ c.Assert(cfg.Core.IsBare, Equals, false)
+
+ createCommit(c, r)
+
+ ref, err := r.Head()
+ c.Assert(err, IsNil)
+ c.Assert(ref.Name().String(), Equals, "refs/heads/foo")
+}
+
func (s *RepositorySuite) TestPlainInitAlreadyExists(c *C) {
dir, clean := s.TemporalDir()
defer clean()