Skip to content
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

Improve support for git reference kinds (branch, tag, rev), improve fetching behaviour #1045

Merged
merged 4 commits into from
Mar 28, 2022

Conversation

mitchmindtree
Copy link
Contributor

Previously, we initialised the temporary git repository with a clone operation. By default, this only fetches a subset of git references, meaning that using references other than those provided by default with clone failed to resolve.

Inspired by cargo, this commit updates the behaviour to instead first initialise the repository, then attempt to fetch only those references that are relevant to the user specified git reference.

In order to construct an accurate set of refspecs and fetch only the relevant commits, its useful to retain knowledge about the kind of git reference. This introduces a new GitReference type and updates the git source lock file serialization to account for this.

The lock files of all examples and tests have been updated for the new approach to serializing the pinned git sources.

Closes #1019
Closes #1016
Unblocks #978

Works toward resolving #1019, however tests and examples still need to
be updated.

Previously, we initialised the temporary git repository with a `clone`
operation. By default, this only fetches a subset of git references,
meaning that using references other than those provided by default with
`clone` failed to resolve.

Inspired by cargo, this commit updates the behaviour to instead first
initialise the repository, then attempt to fetch only those references
that are relevant to the user specified git reference.

In order to construct an accurate set of `refspecs` and fetch only the
relevant commits, its useful to retain knowledge about the *kind* of git
reference. This introduces a new `GitReference` type and updates the git
source lock file serialization to account for this.
JoshuaBatty
JoshuaBatty previously approved these changes Mar 28, 2022
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, nice one.

@mitchmindtree
Copy link
Contributor Author

Cheers @JoshuaBatty, I just noticed I still had a TODO in there to validate the commit hash when parsing the git sources from the lock file so I've addressed that too.

@mitchmindtree mitchmindtree added the enhancement New feature or request label Mar 28, 2022
@mitchmindtree mitchmindtree merged commit cf5c3d1 into master Mar 28, 2022
@mitchmindtree mitchmindtree deleted the mitchmindtree/proper-git-ref-support branch March 28, 2022 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forc
Projects
Archived in project
2 participants