@@ -33,25 +33,29 @@ test.it("init creates a non-bare repo", function()
3333 test .truthy (repo .path ():find (" .git" ))
3434 test .equal (repo .isBare (), false )
3535 test .equal (repo .headUnborn (), true )
36+ repo .free ()
3637end )
3738
3839test .it (" init bare creates a bare repo" , function ()
3940 local repo = git2 .init (mkTmp (" bare" ), true )
4041 test .equal (repo .isBare (), true )
42+ repo .free ()
4143end )
4244
4345test .it (" open existing repo works" , function ()
4446 local src = debug.getinfo (1 , " S" ).source :sub (2 ):match (" (.*[/\\ ])" )
4547 local repo = git2 .open (src .. " .." )
4648 test .truthy (repo .path ())
4749 test .equal (repo .isBare (), false )
50+ repo .free ()
4851end )
4952
5053test .it (" head returns a 40-char sha" , function ()
5154 local dir = mkTmp (" head" )
5255 mkCommit (dir , " init" )
5356 local repo = git2 .open (dir )
5457 test .equal (# repo .head (), 40 )
58+ repo .free ()
5559end )
5660
5761test .it (" commitLookup returns correct metadata" , function ()
@@ -65,11 +69,13 @@ test.it("commitLookup returns correct metadata", function()
6569 test .equal (c .author .name , " T" )
6670 test .equal (c .author .email , " t@t.com" )
6771 test .truthy (c .time > 0 )
72+ repo .free ()
6873end )
6974
7075test .it (" revparse HEAD matches head()" , function ()
7176 local dir = mkTmp (" rev" )
7277 mkCommit (dir , " rev" )
7378 local repo = git2 .open (dir )
7479 test .equal (repo .revparse (" HEAD" ), repo .head ())
80+ repo .free ()
7581end )
0 commit comments