Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/src/source/git.dart
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,9 @@ class GitSource extends CachedSource {
'--list',
'--format',
// We can use space here, as it is not allowed in a git tag
// https://git-scm.com/docs/git-check-ref-format
'%(refname:lstrip=2) %(objectname)',
// https://git-scm.com/docs/git-check-ref-format The `*` means we list the
// hash of the tagged object, not the tag itself.
'%(refname:lstrip=2) %(*objectname)',
], workingDir: path);
final lines = output.trim().split('\n');
final result = <TaggedVersion>[];
Expand Down
104 changes: 104 additions & 0 deletions test/get/git/tag_pattern_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,108 @@ void main() {
});
},
);

test(
'multiple path dependencies to same package work (regression https://github.com/dart-lang/pub/issues/4706)',
() async {
await d.git('foo.git', [
d.dir('one', [
d.libPubspec(
'one',
'1.0.0',
sdk: '^3.9.0',
deps: {
'two': {'path': '../two'},
'three': {'path': '../three'},
},
),
]),
d.dir('two', [
d.libPubspec(
'two',
'1.0.0',
sdk: '^3.9.0',
deps: {
'three': {'path': '../three'},
},
),
]),
d.dir('three', [d.libPubspec('three', '1.0.0', sdk: '^3.9.0')]),
]).create();
final g = d.git('foo.git', []);
await g.tag('1.0.0');
final ref = await g.revParse('HEAD');

await d
.appDir(
dependencies: {
'one': {
'git': {
'url': '../foo.git',
'path': 'one',
'tag_pattern': '{{version}}',
},
'version': '^1.0.0',
},
},
pubspec: {
'environment': {'sdk': '^3.9.0'},
},
)
.create();

await pubGet(
output: allOf(
contains('+ one 1.0.0'),
contains('+ two 1.0.0'),
contains('+ three 1.0.0'),
),
environment: {'_PUB_TEST_SDK_VERSION': '3.9.0'},
);
final lockfile =
loadYaml(
File(
p.join(d.sandbox, appPath, 'pubspec.lock'),
).readAsStringSync(),
)
as Map;
final packages = lockfile['packages'] as Map;
final one = packages['one'];
expect(one, {
'dependency': 'direct main',
'description': {
'path': 'one',
'resolved-ref': ref,
'tag-pattern': '{{version}}',
'url': '../foo.git',
},
'source': 'git',
'version': '1.0.0',
});
final two = packages['two'];
expect(two, {
'dependency': 'transitive',
'description': {
'path': 'two',
'resolved-ref': ref,
'tag-pattern': '{{version}}',
'url': '../foo.git',
},
'source': 'git',
'version': '1.0.0',
});
final three = packages['three'];
expect(three, {
'dependency': 'transitive',
'description': {
'path': 'three',
'resolved-ref': ref,
'tag-pattern': '{{version}}',
'url': '../foo.git',
},
'source': 'git',
'version': '1.0.0',
});
},
);
}
Loading