-
Notifications
You must be signed in to change notification settings - Fork 899
Merge/Rebase In Progress #128
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
Conversation
Sounds neat! How do you foresee the API? |
Lacking a better name for now... enum Operation {
None,
RebaseInteractive,
RebaseMerge,
Rebase,
ApplyMailbox, // AM
RebaseInvalid, // AM/REBASE, no idea how this happens
Merge,
CherryPick,
Bisect,
} I can't think of a better place for it to live than Naming things is hard... |
I do strongly strongly agree with this 😄
I'm a little bit concerned that retrieving the current ongoing
Would altering |
I think it could. Will see if I can put some of this into code and we can proceed from there. |
Agreed.
Agreed as well. The I'm starting to wonder if we're not lacking a new namespace... |
naming... how about a property named |
In gerund form the compound names get weird... Re: lacking a new namespace... maybe, but I'm not sure what it is. |
Just getting started...any feedback so far? I started modifying For testing I think I have to just write files directly into |
I can't think of any other option either. Especially, as none of the operations above are implemented yet ;) |
Eh? |
@dahlbyk Could you please rebase it on top of vNext and open a PR. It'll be easier to comment. Thanks! |
Cool, managed to attach my branch to the existing issue. If anyone from GitHub is listening, it would be sweet if I didn't have to use the API for that. 😉 |
PR points to commit. Commit refers to PR by its number -> Indirect self referential achievement :) |
@dahlbyk How about nulltoken@526e589 ? |
734adf7 could be cherry-picked into vNext by itself - lazily checking that reference is null does no good if canonicalNameSelector blows up. 👍 for folding |
I made a mistake. The way I see it, [Fact]
public void TadaDumTadadaDum()
{
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();
using (var repo = new Repository(path.RepositoryPath))
{
Assert.Equal("master", repo.Head.Name);
Assert.False(repo.Info.IsHeadDetached);
repo.Checkout("refs/tags/lw");
Assert.Equal("(e90810b...)", repo.Head.Name);
Assert.True(repo.Info.IsHeadDetached);
}
} |
The problem is during a rebase:
|
Hmm... You're right. Moreover, retrieving the canonical name of the Ok. Let's make a step back. Could you please rollback the "Name" part of this PR and squash this spike into a commit with the |
Done. |
carlosmn/libgit2@e849aa8 looks like a nice native start to get |
I'll need to polish that up, as it was meant for something else which was solved in a different way in the end. Do notice that we can only ever know that we're in a cherry-pick if it the files failed to merge. The rest of the operations should be fairly straightforward. As for naming, I don't feel like "pending" describes it, as it's not something we've yet to do, but something we're currently doing; after all, this status is to let the next git process know what we've started to do but had to stop so the user could fix the code. |
@carlosmn Thanks for the feedback! As far as I know, @dahlbyk ported it from https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh#L198-289 |
@carlosmn Oh please, my dear NameWhisperer, help us with that :-) The idea behind the |
In the C code it's called state, which IMO fits better with it being about the different parts of the repo being involved in this. |
@carlosmn Why not. How would you name the 0 (zero) enum entry representing that nothing is "in progress"? Current proposal was |
You can call it typedef enum {
GIT_REPOSITORY_STATE_NONE,
GIT_REPOSITORY_STATE_MERGE,
GIT_REPOSITORY_STATE_REVERT,
GIT_REPOSITORY_STATE_CHERRY_PICK,
} git_repository_state_t; |
However, I'll stick with the gerund form for other entries ( |
Re: naming the states, I'll echo my comment from above:
I'm skeptical that "state" is discoverable enough, but I suppose that's what documentation is for. |
@dahlbyk Hmmf.. You're right... However, I can't help but think that OK Let's go with the non gerund form (once again :-) ) |
Even if libgit2 calls it "state", I think a variation of operation reads better... Maybe |
@ethomson added a nice state enum in libgit2/libgit2#1013 |
@dahlbyk libgit2/libgit2#1026 is merged! 🎉 How do you feel like about binding it as part of this PR? |
Spike has been refreshed but needs libgit2 update (still no VC++). Names have been adjusted a bit but I'm still not completely happy with them. Was torn about how much to duplicate the libgit2 state tests, so I went all out. |
I'm not sure about Could you please move the |
❤️! |
@dahlbyk Thanks for the review! I tidied up the tests and merged it in
I'm not sure about this. Making it return the current I'd prefer to delay this addition until we have some vision of how would an interactive rebase should be dealt with from an api standpoint. |
Unless I'm missing something, there's no way to tell in libgit2(sharp) if the working directory has a change in progress (merge, rebase, bisect, etc). For posh-git I've ported most of https://github.com/msysgit/git/blob/devel/contrib/completion/git-completion.bash#L214-305 but it seems like other consumers might be interested in this information. Thoughts?