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

Fixes broken LibGit2.rebase! #19624

Merged
merged 6 commits into from
Dec 19, 2016
Merged

Fixes broken LibGit2.rebase! #19624

merged 6 commits into from
Dec 19, 2016

Conversation

simonbyrne
Copy link
Contributor

@simonbyrne simonbyrne commented Dec 16, 2016

LibGit2.rebase! is broken, causing problems with Pkg.update()
after PkgDev.tag(), see
https://discourse.julialang.org/t/how-to-properly-add-releases-with-pkgdev/961/15?u=simonbyrne

There were two problems:

  • upstream was used as a variable name and a function call
  • if the patch was redundant (EAPPLIED return code), rebase! would
    throw an error.

LibGit2 was not rebasing correctly, causing problems with `Pkg.update()`
after `PkgDev.tag()`, see
https://discourse.julialang.org/t/how-to-properly-add-releases-with-pkgdev/961/15?u=simonbyrne

There were two problems:
- `upstream` was used as a variable name and a function call
- if the patch was redundant (`EAPPLIED` return code), `rebase!` would
throw an error.
@tkelman tkelman added backport pending 0.5 bugfix This change fixes an existing bug libgit2 The libgit2 library or the LibGit2 stdlib module labels Dec 16, 2016
(Ptr{Oid}, Ptr{Void}, Ptr{SignatureStruct}, Ptr{SignatureStruct}, Ptr{UInt8}, Ptr{UInt8}),
oid_ptr, rb.ptr, C_NULL, sig.ptr, C_NULL, C_NULL)
oid_ptr, rb.ptr, C_NULL, sig.ptr, C_NULL, C_NULL)
Copy link
Contributor

Choose a reason for hiding this comment

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

alignment probably shouldn't change here?

@tkelman
Copy link
Contributor

tkelman commented Dec 16, 2016

yay, Simon to the rescue. can we construct this situation locally and test for it in test/libgit2.jl or test/pkg.jl ?

@simonbyrne
Copy link
Contributor Author

Yes, we probably should do it, and I imagine it should be possible, but I'm not sure how best to do it. Any suggestions?

@tkelman
Copy link
Contributor

tkelman commented Dec 16, 2016

create 2 local test repos with the same content but via different series of commits so that merging from an on-disk remote that points to the other repo wouldn't be a fast forward but would trigger this bug?

@simonbyrne
Copy link
Contributor Author

I'm still not sure why this went undiscovered for so long: it should have thrown a more informative error.

@tkelman tkelman added the needs tests Unit tests are required for this change label Dec 16, 2016
@tkelman
Copy link
Contributor

tkelman commented Dec 16, 2016

I'm not surprised, the libgit2 code is full of this kind of thing, it could use a pretty thorough review, refactoring, and docs.

@simonbyrne
Copy link
Contributor Author

I've added a test: it fails earlier and now passes.

@tkelman tkelman removed the needs tests Unit tests are required for this change label Dec 17, 2016
(Ptr{Oid}, Ptr{Void}, Ptr{SignatureStruct}, Ptr{SignatureStruct}, Ptr{UInt8}, Ptr{UInt8}),
oid_ptr, rb.ptr, C_NULL, sig.ptr, C_NULL, C_NULL)
catch err
err.code == Error.EAPPLIED && return nothing
Copy link
Contributor

Choose a reason for hiding this comment

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

is returning nothing acceptable for callers? would returning the head be any more appropriate?

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, but I can't figure out how to do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

hm okay. leave a todo comment maybe?

@tkelman
Copy link
Contributor

tkelman commented Dec 17, 2016

cool. that test passes without internet access, right? looks like it should, but if not then it should be moved to libgit2-online.

@simonbyrne
Copy link
Contributor Author

Yes, it just tests rebase locally (as it is a local operation).

@tkelman tkelman merged commit 474210f into master Dec 19, 2016
@tkelman tkelman deleted the sb/libgit2/rebase branch December 19, 2016 00:41
tkelman pushed a commit that referenced this pull request Mar 1, 2017
* Fixes broken LibGit2.rebase!

LibGit2 was not rebasing correctly, causing problems with `Pkg.update()`
after `PkgDev.tag()`, see
https://discourse.julialang.org/t/how-to-properly-add-releases-with-pkgdev/961/15?u=simonbyrne

There were two problems:
- `upstream` was used as a variable name and a function call
- if the patch was redundant (`EAPPLIED` return code), `rebase!` would
throw an error.

* alignment

* revert check macro to avoid incompatibilities

* add docstring

* add testcase

* add TODO

(cherry picked from commit 474210f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug libgit2 The libgit2 library or the LibGit2 stdlib module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants