Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I started off just trying to break down
handle_repos_add
(it was a beast!) but the refactoring allowed two bugs to be fixed along the way.Fixes #951. In the first stage (
resolve_repo_add!
) we make sure certain fields of thePackageSpec
are filled out (name
,uuid
,repo.url
,repo.rev
). This means we can have more consistent logic for the rest of the operation. In particular, once we have the UUID, it is simple to check if the package is pinned.Fixes #614. I added a test which simply makes sure that the
mtime
for the source is the same after anadd
by URL.In terms of refactoring, moving all git-heavy operations into their own functions helps to clarify the
add
-specific logic. Also,handle_repos_add!
was being called from many places. It turns out those calls just needed some more limited functionality which is now ininstantiate_pkg_repo!
.