-
Notifications
You must be signed in to change notification settings - Fork 899
Merge #608
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
Merge #608
Conversation
/cc @nulltoken, @ethomson, @CrumblyCake |
As @CrumblyCake did most of the work here, I suggest we squash this into a single commit (with credit going to @CrumblyCake ), as long as he agrees (both with where this pull request has landed and to have his name attached with the final result). |
This is looking awesome to me. Giant thanks to @jamill and @CrumblyCake ! |
[Fact] | ||
public void CanMergeRepos() | ||
{ | ||
string firstBranchFileName = "first branch file.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make those variables and the other ones in the tests below as const
?
@CrumblyCake @jamill I ❤️ this Tiny proposal: how about adding small ASCII graphs in the tests to show the state of the branches before the merge? |
{ | ||
var firstBranch = repo.CreateBranch("FirstBranch"); | ||
firstBranch.Checkout(); | ||
var originalTreeCount = firstBranch.Tip.Tree.Count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem this variable is used in the assertions.
|
||
/// <summary> | ||
/// The resulting commit of the merge. For fast-forward merges, this is the | ||
/// commit that merge was fast forwared to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forwar d ed
@jamill Definitely happy with both and very much hope I can be of more use in the libraries future! |
@jamill 👍 |
[Fact] | ||
public void IsUpToDateMerge() | ||
{ | ||
string sharedBranchFileName = "first+second branch file.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const?
Bring initial merge functionality to LibGit2Sharp.
@nulltoken squashed, added the |
@jamill @CrumblyCake Merged. Amazing job! Thanks thousands to both of you ✨ |
|
||
Assert.Equal(MergeStatus.FastForward, mergeResult.Status); | ||
Assert.Equal(repo.Branches["FirstBranch"].Tip, mergeResult.Commit); | ||
Assert.Equal(repo.Branches["FirstBranch"].Tip, repo.Head.Tip); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamill @nulltoken
Hi guys,
I'm implementing a bit of the merge stuff now and on fast forwards the head is being detached onto the merged commit. The reason these tests pass is because I must've screwed up on these lines. They should be checking the SecondBranch as it's the one that has been merged up to FirstBranch.
Assert.Equal(repo.Branches["SecondBranch"].Tip, mergeResult.Commit);
Assert.Equal(repo.Branches["SecondBranch"].Tip, repo.Head.Tip);
The change I made to pass the tests with is below:
https://github.com/libgit2/libgit2sharp/pull/608/files#r9262152
This is a PR based off of #579 - but rebased on latest and including an extra commit to tweak the merge logic. This PR would supersede #579.