@@ -26,8 +26,6 @@ import (
2626 "testing"
2727
2828 "github.com/go-git/go-git/v5"
29- gogitConfig "github.com/go-git/go-git/v5/config"
30- "github.com/go-git/go-git/v5/storage/memory"
3129 "github.com/google/go-cmp/cmp"
3230 "github.com/googleapis/librarian/internal/config"
3331 "github.com/googleapis/librarian/internal/github"
@@ -1322,16 +1320,16 @@ func TestCommitAndPush(t *testing.T) {
13221320 {
13231321 name : "create a commit" ,
13241322 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1325- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1323+ remote := & gitrepo. Remote {
13261324 Name : "origin" ,
13271325 URLs : []string {"https://github.com/googleapis/librarian.git" },
1328- })
1326+ }
13291327 status := make (git.Status )
13301328 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
13311329 return & MockRepository {
13321330 Dir : t .TempDir (),
13331331 AddAllStatus : status ,
1334- RemotesValue : []* git .Remote {remote },
1332+ RemotesValue : []* gitrepo .Remote {remote },
13351333 }
13361334 },
13371335 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1345,16 +1343,16 @@ func TestCommitAndPush(t *testing.T) {
13451343 {
13461344 name : "create a generate pull request" ,
13471345 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1348- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1346+ remote := & gitrepo. Remote {
13491347 Name : "origin" ,
13501348 URLs : []string {"https://github.com/googleapis/librarian.git" },
1351- })
1349+ }
13521350 status := make (git.Status )
13531351 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
13541352 return & MockRepository {
13551353 Dir : t .TempDir (),
13561354 AddAllStatus : status ,
1357- RemotesValue : []* git .Remote {remote },
1355+ RemotesValue : []* gitrepo .Remote {remote },
13581356 }
13591357 },
13601358 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1369,16 +1367,16 @@ func TestCommitAndPush(t *testing.T) {
13691367 {
13701368 name : "create a release pull request" ,
13711369 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1372- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1370+ remote := & gitrepo. Remote {
13731371 Name : "origin" ,
13741372 URLs : []string {"https://github.com/googleapis/librarian.git" },
1375- })
1373+ }
13761374 status := make (git.Status )
13771375 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
13781376 return & MockRepository {
13791377 Dir : t .TempDir (),
13801378 AddAllStatus : status ,
1381- RemotesValue : []* git .Remote {remote },
1379+ RemotesValue : []* gitrepo .Remote {remote },
13821380 }
13831381 },
13841382 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1398,7 +1396,7 @@ func TestCommitAndPush(t *testing.T) {
13981396 return & MockRepository {
13991397 Dir : t .TempDir (),
14001398 AddAllStatus : status ,
1401- RemotesValue : []* git .Remote {}, // No remotes
1399+ RemotesValue : []* gitrepo .Remote {}, // No remotes
14021400 }
14031401 },
14041402 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1413,13 +1411,13 @@ func TestCommitAndPush(t *testing.T) {
14131411 {
14141412 name : "AddAll error" ,
14151413 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1416- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1414+ remote := & gitrepo. Remote {
14171415 Name : "origin" ,
14181416 URLs : []string {"https://github.com/googleapis/librarian.git" },
1419- })
1417+ }
14201418 return & MockRepository {
14211419 Dir : t .TempDir (),
1422- RemotesValue : []* git .Remote {remote },
1420+ RemotesValue : []* gitrepo .Remote {remote },
14231421 AddAllError : errors .New ("mock add all error" ),
14241422 }
14251423 },
@@ -1434,17 +1432,17 @@ func TestCommitAndPush(t *testing.T) {
14341432 {
14351433 name : "Create branch error" ,
14361434 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1437- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1435+ remote := & gitrepo. Remote {
14381436 Name : "origin" ,
14391437 URLs : []string {"https://github.com/googleapis/librarian.git" },
1440- })
1438+ }
14411439
14421440 status := make (git.Status )
14431441 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
14441442 return & MockRepository {
14451443 Dir : t .TempDir (),
14461444 AddAllStatus : status ,
1447- RemotesValue : []* git .Remote {remote },
1445+ RemotesValue : []* gitrepo .Remote {remote },
14481446 CreateBranchAndCheckoutError : errors .New ("create branch error" ),
14491447 }
14501448 },
@@ -1459,17 +1457,17 @@ func TestCommitAndPush(t *testing.T) {
14591457 {
14601458 name : "Commit error" ,
14611459 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1462- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1460+ remote := & gitrepo. Remote {
14631461 Name : "origin" ,
14641462 URLs : []string {"https://github.com/googleapis/librarian.git" },
1465- })
1463+ }
14661464
14671465 status := make (git.Status )
14681466 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
14691467 return & MockRepository {
14701468 Dir : t .TempDir (),
14711469 AddAllStatus : status ,
1472- RemotesValue : []* git .Remote {remote },
1470+ RemotesValue : []* gitrepo .Remote {remote },
14731471 CommitError : errors .New ("commit error" ),
14741472 }
14751473 },
@@ -1484,17 +1482,17 @@ func TestCommitAndPush(t *testing.T) {
14841482 {
14851483 name : "Push error" ,
14861484 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1487- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1485+ remote := & gitrepo. Remote {
14881486 Name : "origin" ,
14891487 URLs : []string {"https://github.com/googleapis/librarian.git" },
1490- })
1488+ }
14911489
14921490 status := make (git.Status )
14931491 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
14941492 return & MockRepository {
14951493 Dir : t .TempDir (),
14961494 AddAllStatus : status ,
1497- RemotesValue : []* git .Remote {remote },
1495+ RemotesValue : []* gitrepo .Remote {remote },
14981496 PushError : errors .New ("push error" ),
14991497 }
15001498 },
@@ -1509,17 +1507,17 @@ func TestCommitAndPush(t *testing.T) {
15091507 {
15101508 name : "Create PR body error" ,
15111509 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1512- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1510+ remote := & gitrepo. Remote {
15131511 Name : "origin" ,
15141512 URLs : []string {"https://github.com/googleapis/librarian.git" },
1515- })
1513+ }
15161514
15171515 status := make (git.Status )
15181516 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
15191517 return & MockRepository {
15201518 Dir : t .TempDir (),
15211519 AddAllStatus : status ,
1522- RemotesValue : []* git .Remote {remote },
1520+ RemotesValue : []* gitrepo .Remote {remote },
15231521 }
15241522 },
15251523 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1534,17 +1532,17 @@ func TestCommitAndPush(t *testing.T) {
15341532 {
15351533 name : "Create pull request error" ,
15361534 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1537- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1535+ remote := & gitrepo. Remote {
15381536 Name : "origin" ,
15391537 URLs : []string {"https://github.com/googleapis/librarian.git" },
1540- })
1538+ }
15411539
15421540 status := make (git.Status )
15431541 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
15441542 return & MockRepository {
15451543 Dir : t .TempDir (),
15461544 AddAllStatus : status ,
1547- RemotesValue : []* git .Remote {remote },
1545+ RemotesValue : []* gitrepo .Remote {remote },
15481546 }
15491547 },
15501548 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1561,14 +1559,14 @@ func TestCommitAndPush(t *testing.T) {
15611559 {
15621560 name : "No changes to commit" ,
15631561 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1564- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1562+ remote := & gitrepo. Remote {
15651563 Name : "origin" ,
15661564 URLs : []string {"https://github.com/googleapis/librarian.git" },
1567- })
1565+ }
15681566 return & MockRepository {
15691567 Dir : t .TempDir (),
15701568 AddAllStatus : git.Status {}, // Clean status
1571- RemotesValue : []* git .Remote {remote },
1569+ RemotesValue : []* gitrepo .Remote {remote },
15721570 }
15731571 },
15741572 setupMockClient : func (t * testing.T ) GitHubClient {
@@ -1580,16 +1578,16 @@ func TestCommitAndPush(t *testing.T) {
15801578 {
15811579 name : "create_a_comment_on_generation_pr_error" ,
15821580 setupMockRepo : func (t * testing.T ) gitrepo.Repository {
1583- remote := git . NewRemote ( memory . NewStorage (), & gogitConfig. RemoteConfig {
1581+ remote := & gitrepo. Remote {
15841582 Name : "origin" ,
15851583 URLs : []string {"https://github.com/googleapis/librarian.git" },
1586- })
1584+ }
15871585 status := make (git.Status )
15881586 status ["file.txt" ] = & git.FileStatus {Worktree : git .Modified }
15891587 return & MockRepository {
15901588 Dir : t .TempDir (),
15911589 AddAllStatus : status ,
1592- RemotesValue : []* git .Remote {remote },
1590+ RemotesValue : []* gitrepo .Remote {remote },
15931591 }
15941592 },
15951593 setupMockClient : func (t * testing.T ) GitHubClient {
0 commit comments