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

Allow using specific revisions in lib install --git-url (#1113) #1776

Merged
merged 1 commit into from
Jul 22, 2022

Conversation

joewreschnig
Copy link
Contributor

@joewreschnig joewreschnig commented Jun 19, 2022

This is done by providing the desired revision in the fragment, e.g.
…/Library.git#0.1.0. When set, this disables the clone depth limit so
all remote references will be available.

This is part of what's discussed in #1113 (i.e. for raw library URLs - not for cores, and not for packaged libraries.)

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

Feature.

  • What is the current behavior?

Installing a library via --git-url always installs the default remote branch's HEAD.

  • What is the new behavior?

A URL fragment may be used to identify a revision per the rules for go-git's ResolveRevision, e.g. https://github.com/arduino-libraries/WiFi101.git#master or https://github.com/arduino-libraries/WiFi101.git#0.16.0. The version currently used by arduino-cli supports branch, tag, and full SHAs; more recent versions would also support short SHAs.

Mostly no, unless someone was passing a wrong fragment in their URLs already and expecting to be ignored. If they were, it will now print a message like

Error installing Git Library: Library install failed: reference not found
  • Other information:

Other possible syntax would be @ref instead of #ref. Based on other tools I use #ref seems more common with purely URL-based specifications while @ref is more common for not-really-URLs like go get or package repositories. Since these are really URLs I've gone with #.

This is only supported on true URLs, not the git@ or path variants, as it's not clear what character would be guaranteed to be unambiguous for these formats.

I'm open to reconsidering both of these choices, as well as any additional testing ideas.

@CLAassistant
Copy link

CLAassistant commented Jun 19, 2022

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jun 19, 2022
@joewreschnig joewreschnig force-pushed the git-ref branch 2 times, most recently from e2b3ab3 to 63b9035 Compare June 19, 2022 13:12
This is done by providing the desired revision in the fragment, e.g.
`…/Library.git#0.1.0`. When set, this disables the clone depth limit so
all remote references will be available.
@cmaglie cmaglie merged commit 78be128 into arduino:master Jul 22, 2022
@cmaglie
Copy link
Member

cmaglie commented Jul 22, 2022

@joewreschnig thank you very much for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants