diff --git a/lib/src/cli/git_cli.dart b/lib/src/cli/git_cli.dart index 7f96c19b3..21f4d80cd 100644 --- a/lib/src/cli/git_cli.dart +++ b/lib/src/cli/git_cli.dart @@ -25,6 +25,7 @@ class Git { try { await _Cmd.run('git', [ 'ls-remote', + '--get-url', '$remote', '--exit-code', ], logger: logger); diff --git a/test/src/cli/git_cli_test.dart b/test/src/cli/git_cli_test.dart index be911ff36..222a16b7a 100644 --- a/test/src/cli/git_cli_test.dart +++ b/test/src/cli/git_cli_test.dart @@ -64,6 +64,22 @@ void main() { }, runProcess: process.run); }); + test('passes --get-url to respect insteadOf overrides', () async { + final remote = Uri.parse('https://github.com/org/repo'); + await ProcessOverrides.runZoned(() async { + await Git.reachable(remote, logger: logger); + }, runProcess: process.run); + + verify( + () => process.run( + 'git', + ['ls-remote', '--get-url', '$remote', '--exit-code'], + runInShell: any(named: 'runInShell'), + workingDirectory: any(named: 'workingDirectory'), + ), + ).called(1); + }); + test( 'throws UnreachableGitDependency for an unreachable remote', () async {