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

newt: Fix shallow upgrade with specific commit version #543

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

m-gorecki
Copy link
Contributor

Upgrading project using shallow option was causing an error if repository version was specified as specific commit. Because this specific commit could not yet be fetched it could not be found during version validation.
Now if shallow upgrade is being performed, instead of returning an error immediately after commit was not found, we first try to fetch the specified commit.

@@ -126,6 +126,15 @@ func (r *Repo) VersionIsValid(ver newtutil.RepoVersion) bool {
}

cs, _ := r.downloader.CommitsFor(r.Path(), ver.Commit)

// For shallow copy commit might not be fetched yet
Copy link
Contributor

Choose a reason for hiding this comment

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

this could be actually done regardless of whether repo is shallow or now
the same problem exists if user specifies a commit that is not preset on any remote branch, e.g. a sha for PR head

Upgrading project using shallow option was causing an error if
repository version was specified as specific commit.
Because this specific commit could not yet be fetched
it could not be found during version validation.
Now if specific commit could not be found, instead of returning
an error immediately, we first try to fetch it.
@sjanc sjanc merged commit 4632ba2 into apache:master Mar 4, 2024
59 checks passed
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.

3 participants