-
Notifications
You must be signed in to change notification settings - Fork 71
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
Creates wrong commits #6
Comments
Yeah that's a bug alright. Looks like the blob in apply_hunk_to_tree has
some off by one errors (specific to one-sided hunks that contain only
additions or only deletions?). I'll hack up a fix over the weekend probably.
…On Thu, Dec 13, 2018, 17:30 est31 ***@***.*** wrote:
Do the following
git clone https://github.com/est31/ringcd ring
git checkout git_absorb_bug
git reset HEAD^
git add .
git absorb
Then you'll get a bunch of okay commits but some commits will be totally
wrong and change stuff that actually wasn't supposed to be changed.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEFieXHu-ietzSLDle6jJHsFCk_bZIsPks5u4v82gaJpZM4ZSujV>
.
|
Thanks! Optimally it would have a sanity check to compare the index before and after it ran. If everything went right, the two would be the same. I'll file another issue for that. |
There seem to be two problems here: (To make sense of line numbers, you have to reproduce the bug and look at the created commits while reading this. I had to remove the "foreign author" check in order to reproduce.)
@tummychow does this make sense? If so, I can whip up a PR. I don't see existing tests for the code in |
(an off-by-one error) First part of the fix for tummychow#6.
Alas, this breaks multiple additions. The other idea I had is to restart the absorption after creating each fixup commit - this works with the testcases I posted in #14, but not with my real tree, and I have yet to figure out why. |
yep, this sounds about right to me
i think this makes sense to me. rough guess of the fix: each time we apply a hunk in a file, all the subsequent hunks in that file should be offset by the net lines that the applied hunk added or removed. if it winds up being tricky, you're welcome to leave that out and just fix the off-by-one errors
let's not write tests that exec git, that introduces all kinds of new ways that tests can flake or fail. libgit can make test environments when we need a real repo to run against - see stack.rs for an example of what this looks like. it's admittedly rather boilerplate heavy, so don't feel obligated to write tests for this |
Thanks for the reply!
..or skip it -- that was the remaining problem I was seeing.
Yep, that sounds right.
The off-by-one fix is trivial, feel free to land it without waiting for a PR from me, and please let me know if you have time/inclination to work on the other problem, otherwise I'll try to finish this.
I understand that running git is sub-optimal, but I can't reuse the boilerplate from the tests in stack.rs, so I'll use my git-based tests for now. |
yeah i'm probably not gonna touch it in the immediate future, go for it |
(an off-by-one error) First part of the fix for tummychow#6.
@tummychow please check PR #14. |
Thanks for the fixes @nickolay ! |
Do the following
Then you'll get a bunch of okay commits but some commits will be totally wrong and change stuff that actually wasn't supposed to be changed. Edit: also, thanks for creating git-absorb, it's a wonderful idea to have this for git as well!
The text was updated successfully, but these errors were encountered: