Skip to content

[dart 3.9.0] Document tag_pattern for git dependencies #6607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
23 changes: 23 additions & 0 deletions src/content/tools/pub/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,29 @@ The ref can be anything that Git allows to [identify a commit.][commit]

[commit]: https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#naming-commits

If the package you depend on has tagged the revision of each version of the
package, you can use `tag_pattern` instead of `ref`, together with a version
constraint.

Pub will then query Git for all matching tags, and feed those version to the
version solver.

```yaml
dependencies:
kittens:
git:
url: [email protected]:munificent/kittens.git
tag_pattern: v{{version}} # Find version-tag prefixed by 'v'.
version: ^2.0.1
```

:::version-note
Support for `tag_pattern` was introduced in Dart 3.9.0.

To use `tag_pattern`, the including pubspec (but not the dependency)
must have an SDK version constraint of `^3.9.0` or higher.
:::

Pub assumes that the package is in the root of the Git repository. To specify a
different location in the repo, specify a `path` relative to the repository
root:
Expand Down
Loading