@@ -48,8 +48,9 @@ func updateRef(t *testing.T, repoPath string, refname string, oid git.OID) error
4848}
4949
5050// CreateObject creates a new Git object, of the specified type, in
51- // `Repository`. `writer` is a function that writes the object in `git
52- // hash-object` input format. This is used for testing only.
51+ // the repository at `repoPath`. `writer` is a function that writes
52+ // the object in `git hash-object` input format. This is used for
53+ // testing only.
5354func createObject (
5455 t * testing.T , repoPath string , otype git.ObjectType , writer func (io.Writer ) error ,
5556) git.OID {
@@ -86,7 +87,7 @@ func createObject(
8687 return oid
8788}
8889
89- func addFile (t * testing.T , repoPath string , repo * git. Repository , relativePath , contents string ) {
90+ func addFile (t * testing.T , repoPath string , relativePath , contents string ) {
9091 dirPath := filepath .Dir (relativePath )
9192 if dirPath != "." {
9293 require .NoError (t , os .MkdirAll (filepath .Join (repoPath , dirPath ), 0777 ), "creating subdir" )
@@ -292,12 +293,10 @@ func TestFromSubdir(t *testing.T) {
292293
293294 cmd := exec .Command ("git" , "init" , path )
294295 require .NoError (t , cmd .Run (), "initializing repo" )
295- repo , err := git .NewRepository (path )
296- require .NoError (t , err , "initializing Repository object" )
297296
298297 timestamp := time .Unix (1112911993 , 0 )
299298
300- addFile (t , path , repo , "subdir/file.txt" , "Hello, world!\n " )
299+ addFile (t , path , "subdir/file.txt" , "Hello, world!\n " )
301300
302301 cmd = gitCommand (t , path , "commit" , "-m" , "initial" )
303302 addAuthorInfo (cmd , & timestamp )
@@ -326,11 +325,9 @@ func TestSubmodule(t *testing.T) {
326325 submPath := filepath .Join (path , "subm" )
327326 cmd := exec .Command ("git" , "init" , submPath )
328327 require .NoError (t , cmd .Run (), "initializing subm repo" )
329- submRepo , err := git .NewRepository (submPath )
330- require .NoError (t , err , "initializing subm Repository object" )
331- addFile (t , submPath , submRepo , "submfile1.txt" , "Hello, submodule!\n " )
332- addFile (t , submPath , submRepo , "submfile2.txt" , "Hello again, submodule!\n " )
333- addFile (t , submPath , submRepo , "submfile3.txt" , "Hello again, submodule!\n " )
328+ addFile (t , submPath , "submfile1.txt" , "Hello, submodule!\n " )
329+ addFile (t , submPath , "submfile2.txt" , "Hello again, submodule!\n " )
330+ addFile (t , submPath , "submfile3.txt" , "Hello again, submodule!\n " )
334331
335332 cmd = gitCommand (t , submPath , "commit" , "-m" , "subm initial" )
336333 addAuthorInfo (cmd , & timestamp )
@@ -341,7 +338,7 @@ func TestSubmodule(t *testing.T) {
341338 require .NoError (t , cmd .Run (), "initializing main repo" )
342339 mainRepo , err := git .NewRepository (mainPath )
343340 require .NoError (t , err , "initializing main Repository object" )
344- addFile (t , mainPath , mainRepo , "mainfile.txt" , "Hello, main!\n " )
341+ addFile (t , mainPath , "mainfile.txt" , "Hello, main!\n " )
345342
346343 cmd = gitCommand (t , mainPath , "commit" , "-m" , "main initial" )
347344 addAuthorInfo (cmd , & timestamp )
0 commit comments