aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-09-15 17:56:55 +0100
committerGitHub <noreply@github.com>2023-09-15 17:56:55 +0100
commitc208b4d513d0e9537f2160cb6d33609c4aa01795 (patch)
treebf76313751ced493b4c298725d6eeaf567c05872 /repository_test.go
parente24e0f714c4ecaf086b5783f099a885e6a2c9a1a (diff)
parent644929ade3ac7c07c370be8065fa2ac6faf081be (diff)
downloadgo-git-c208b4d513d0e9537f2160cb6d33609c4aa01795.tar.gz
Merge pull request #782 from ThinkChaos/feat/plain-init-branch
git: add PlainInitOptions.Bare and allow using InitOptions with PlainInitWithOptions
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()