Skip to content

Commit 417b20b

Browse files
feat: add --get-url flag to git ls-remote for URL config overrides (#1642)
* feat: add --get-url flag to git ls-remote for URL config overrides Closes #1097 Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com> * Apply suggestion from @marcossevilla --------- Co-authored-by: unicoderbot[bot] <269805761+unicoderbot[bot]@users.noreply.github.com> Co-authored-by: marcossevilla <marcossevilla@users.noreply.github.com> Co-authored-by: Marcos Sevilla <31174242+marcossevilla@users.noreply.github.com>
1 parent e30da76 commit 417b20b

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

lib/src/cli/git_cli.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Git {
2525
try {
2626
await _Cmd.run('git', [
2727
'ls-remote',
28+
'--get-url',
2829
'$remote',
2930
'--exit-code',
3031
], logger: logger);

test/src/cli/git_cli_test.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ void main() {
6464
}, runProcess: process.run);
6565
});
6666

67+
test('passes --get-url to respect insteadOf overrides', () async {
68+
final remote = Uri.parse('https://github.com/org/repo');
69+
await ProcessOverrides.runZoned(() async {
70+
await Git.reachable(remote, logger: logger);
71+
}, runProcess: process.run);
72+
73+
verify(
74+
() => process.run(
75+
'git',
76+
['ls-remote', '--get-url', '$remote', '--exit-code'],
77+
runInShell: any(named: 'runInShell'),
78+
workingDirectory: any(named: 'workingDirectory'),
79+
),
80+
).called(1);
81+
});
82+
6783
test(
6884
'throws UnreachableGitDependency for an unreachable remote',
6985
() async {

0 commit comments

Comments
 (0)