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

possibly fix #101 #104

Closed
wants to merge 1 commit into from
Closed

possibly fix #101 #104

wants to merge 1 commit into from

Conversation

simonbyrne
Copy link
Contributor

@simonbyrne simonbyrne commented Mar 19, 2017

I'm fairly sure this will fix #101.

Okay, it's not the prettiest code, but it should make do until we have a better solution to the problem of querying whether or not an object exists (which might be hard to do now in Base due to the feature freeze).

@@ -77,8 +77,17 @@ function publish(branch::AbstractString, prbranch::AbstractString="")
m !== nothing && ismatch(Base.VERSION_REGEX, m.captures[2]) || continue
pkg, ver = m.captures; ver = convert(VersionNumber,ver)
sha1 = readchomp(joinpath(metapath,path))
old = LibGit2.cat(repo, LibGit2.GitBlob, "origin/$branch:$path")
old !== nothing && old != sha1 && throw(PkgError("$pkg v$ver SHA1 changed in METADATA – refusing to publish"))
if VERSION < v"0.6-"
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to be more specific with the version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably not, a lot of stuff has changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

when did this specifically change to throwing?

@tkelman
Copy link
Contributor

tkelman commented Mar 19, 2017

Didn't we have a find or search command for a similar replacement in base? This kind of thing is why we need to return "not found" from API's instead of putting try-catches everywhere.

@simonbyrne
Copy link
Contributor Author

Agreed, but that's a lot more work which might not get done before 0.6.

@tkelman
Copy link
Contributor

tkelman commented Mar 19, 2017

I thought there was an alternative you switched to when something similar came up in a base PR?

@simonbyrne
Copy link
Contributor Author

There was this: JuliaLang/julia#20433, but I changed it to check the index instead of the commit (which I don't think will work in this case).

Another option is to change the behaviour of LibGit2.cat back and keep using it: the downside of this is that users would still see the deprecation warning.

@davidanthoff davidanthoff deleted the sb/publish branch November 12, 2019 23:41
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.

0.6: ERROR: GitError(Code:ENOTFOUND, Class:Tree, the path '0.1.0' does not exist in the given tree)
4 participants