Fix changing branch of pins with 'git+ssh://' and 'xyz+https://' urls #1722
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.
Currently, specifying the branch of pinned remote repositories fails for
git+ssh://
urls. The requested branch is fetched correctly when alr build is first run (or after manually clearing the cache), but subsequent changes to thebranch =
component of the pin inalire.toml
always results in the default branch being checked out. The same bug is also observed with[^+]*\+https:
urls.git+ssh://
urls actually appear to be deprecated, but we should probably support them anyway.The issue manifests in the
Update
procedure. This detects if the url has changed and, if so, it clears the cached copy and does a freshgit clone
(presumably on the basis that a different url probably points to a different version of the repository, which may have diverged sufficiently that an update will fail).For some reason, this fresh
git clone
always checks out the default branch (callsCheckout
, rather thanCheckout (Branch => Branch)
). I'm not sure whether this is intended behaviour, but it is not ordinarily a problem asDeploy
always seems to be called several times. As such:clone
of the default branchThis fails for
git+ssh://
and[^+]*\+https:
urls because theRepo
function (which constructs the url when performing theclone
) removes the prefix. A change to the url is detected by comparing the appropriate line ingit config --list
(here) with the string defined inalire.toml
(here).git config
returns the form passed to theclone
command (without the prefix), while the string inalire.toml
retains the fullgit+ssh://
form. The net effect is that a pin with agit+ssh://
url will always be treated as having changed (fromssh://
togit+ssh://
), and the default branch will always be used (for every call toDeploy
).This pull request resolves the issue by substituting
git+ssh://
→ssh://
andxyz+https://
→https://
when readingalire.toml
.