@@ -48,8 +48,9 @@ func updateRef(t *testing.T, repoPath string, refname string, oid git.OID) error
48
48
}
49
49
50
50
// 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.
53
54
func createObject (
54
55
t * testing.T , repoPath string , otype git.ObjectType , writer func (io.Writer ) error ,
55
56
) git.OID {
@@ -86,7 +87,7 @@ func createObject(
86
87
return oid
87
88
}
88
89
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 ) {
90
91
dirPath := filepath .Dir (relativePath )
91
92
if dirPath != "." {
92
93
require .NoError (t , os .MkdirAll (filepath .Join (repoPath , dirPath ), 0777 ), "creating subdir" )
@@ -292,12 +293,10 @@ func TestFromSubdir(t *testing.T) {
292
293
293
294
cmd := exec .Command ("git" , "init" , path )
294
295
require .NoError (t , cmd .Run (), "initializing repo" )
295
- repo , err := git .NewRepository (path )
296
- require .NoError (t , err , "initializing Repository object" )
297
296
298
297
timestamp := time .Unix (1112911993 , 0 )
299
298
300
- addFile (t , path , repo , "subdir/file.txt" , "Hello, world!\n " )
299
+ addFile (t , path , "subdir/file.txt" , "Hello, world!\n " )
301
300
302
301
cmd = gitCommand (t , path , "commit" , "-m" , "initial" )
303
302
addAuthorInfo (cmd , & timestamp )
@@ -326,11 +325,9 @@ func TestSubmodule(t *testing.T) {
326
325
submPath := filepath .Join (path , "subm" )
327
326
cmd := exec .Command ("git" , "init" , submPath )
328
327
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 " )
334
331
335
332
cmd = gitCommand (t , submPath , "commit" , "-m" , "subm initial" )
336
333
addAuthorInfo (cmd , & timestamp )
@@ -341,7 +338,7 @@ func TestSubmodule(t *testing.T) {
341
338
require .NoError (t , cmd .Run (), "initializing main repo" )
342
339
mainRepo , err := git .NewRepository (mainPath )
343
340
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 " )
345
342
346
343
cmd = gitCommand (t , mainPath , "commit" , "-m" , "main initial" )
347
344
addAuthorInfo (cmd , & timestamp )
0 commit comments