Skip to content

Correctly handle component versions which are tags#290

Merged
simu merged 2 commits into
masterfrom
fix/component-version-tag
Mar 12, 2021
Merged

Correctly handle component versions which are tags#290
simu merged 2 commits into
masterfrom
fix/component-version-tag

Conversation

@simu

@simu simu commented Mar 12, 2021

Copy link
Copy Markdown
Member

Tags show up as heads in the remote, but without the remote name as prefix. Previously the code would then try to checkout a branch with the name of the tag.

This commit makes the assumption that any heads in a remote which don't have the remote name as a prefix are tags, and handles checkout accordingly.

To keep the things simple, tags are checked out in detached HEAD state.

Checklist

  • Keep pull requests small so they can be easily reviewed.
  • Update tests.
  • Update the ./CHANGELOG.md.

@simu simu requested a review from srueg March 12, 2021 15:24
Tags show up as heads in the remote, but without the remote name as
prefix. Previously the code would then try to checkout a branch with the
name of the tag.

This commit makes the assumption that any heads in a remote which don't
have the remote name as a prefix are tags, and handles checkout
accordingly.

To keep the things simple, tags are checked out in detached HEAD state.
The `checkout()` method has gotten quite unwieldy.

This commit factors out the following methods:
* method to calculate prefix of remote (e.g. "origin/")
* method to find the default version for a component (the remote's
  default branch) if no explicit version is set
* method to find a GitPython `Commit` for the specified version
@simu simu force-pushed the fix/component-version-tag branch from df0bc27 to 4ccd661 Compare March 12, 2021 16:06
@simu simu merged commit 9f0e515 into master Mar 12, 2021
@simu simu deleted the fix/component-version-tag branch March 12, 2021 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants