Skip to content

feat: interactive rebase should include current commit #883

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

Merged
merged 1 commit into from
Oct 11, 2023
Merged

feat: interactive rebase should include current commit #883

merged 1 commit into from
Oct 11, 2023

Conversation

star-szr
Copy link
Contributor

@star-szr star-szr commented Oct 9, 2023

As discussed in #862

I really tried to write a test for this, but couldn't figure out how to wait until the git-rebase-todo was present to check its contents. Maybe later :)

Feedback very welcomed, as always.

@CKolkey
Copy link
Member

CKolkey commented Oct 11, 2023

Is something like this useful? https://stackoverflow.com/questions/2221658/whats-the-difference-between-head-and-head-in-git

I was imagining (though maybe I'm wrong) that using <commit>^ would work here.

@star-szr
Copy link
Contributor Author

Thanks for taking a look.

If we just change the commit parameter to commit^, it will produce an error if the user selects the initial commit in a repository, since that commit has no parent. But it is possible to rebase the initial commit by passing --root.

Since we need to figure out the parent to handle the case of the initial commit, my thinking was that it may be worthwhile to just extract it from that output via vim.split rather than use something like commit^.

@CKolkey
Copy link
Member

CKolkey commented Oct 11, 2023

Ah, ok, that makes sense. Thanks for the explanation :)

@CKolkey CKolkey merged commit d3fbf8b into NeogitOrg:master Oct 11, 2023
@star-szr
Copy link
Contributor Author

Ah, ok, that makes sense. Thanks for the explanation :)

Of course! It could be worth adding a comment in the code, let me know if you think so and I can submit something.

@star-szr star-szr deleted the rebase-include-current-commit branch October 11, 2023 11:15
@CKolkey
Copy link
Member

CKolkey commented Oct 11, 2023

Maybe as a commit message, or message here, but inline can get... overwhelming.

@star-szr
Copy link
Contributor Author

Good point, well I think there's enough detail here so I will leave it. Next time I work on something like this I can add more details to the commit message. Thanks!

By the way, it looks like tests failed on the merge commit, but as far as I can tell it might just be a random fail, possibly a race condition? I found similar failures within the last few weeks though I didn't dig further back than that.

@star-szr
Copy link
Contributor Author

I can't reproduce any failure locally so far.

I ran the status_spec test that failed in the merge commit over 140 times with no failure and I ran the whole suite 70 times with no fail.

@star-szr
Copy link
Contributor Author

Breaking news: I let it run (only the status_spec test) while I was in a meeting and it failed on run 895 in the same way.

@star-szr
Copy link
Contributor Author

To not keep cluttering up this PR, I created #887 to track the random test fail issue now that it has been confirmed.

@CKolkey
Copy link
Member

CKolkey commented Oct 11, 2023

Breaking news: I let it run (only the status_spec test) while I was in a meeting and it failed on run 895 in the same way.

As they say, fool me 894 times, shame on you. Fool me 895 times, shame on me.

The state-with-side-effects nature of testing a local git repo is... rough sometimes.

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