-
Notifications
You must be signed in to change notification settings - Fork 695
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
Repository.mergeBranches
creates dirty index after a non-conflicting merge
#1217
Comments
Unfortunately i'm having the exact same problem. The code below produces a merge and a commit with message "Merged master into dev". On branch dev
Your branch is ahead of 'origin/dev' by 156 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: .gitignore
modified: license.txt
modified: readme.html
modified: wp-activate.php
modified: wp-admin/about.php
modified: wp-admin/admin-ajax.php
..... which is odd since the merge produced earlier has the files committed. I'm using the code below to fetch origin and merge the two branches. NodeGit.Repository.open(path).then(function(repoResult) {
repo = repoResult;
})
.then(function() {
repo.fetch('origin', {
callbacks: {
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyMemoryNew(userName, publickey, privatekey, '');
}
}
})
})
.then(function() {
return repo.mergeBranches('dev', 'master');
})
.catch(function(err) {
console.log(err);
}); |
@raqqun I suppose you could try working around the problem by switching your |
I am having this same problem; if I merge a branch into master, the merge works (the commit is there, and it is appropriate). After the merge, git status shows that I have uncommitted (but staged) changes; these changes would undo the previous commit. The problem with a hard reset after the merge is that it might clobber other staged (but uncommitted) changes. I need to play around with git itself to see what it does in this situation. I'll try moving HEAD around and see what that does. This is snippets of the code that's exhibiting this behavior (with the reset in there). Unfortunately, this clobbers my staged and/or unstaged changes from already tracked files. |
Seeing the same issue with nodegit v0.19.0 and git v2.6.2 Steps to reproduce:
Expected: Actual: |
I had a similar issue. What worked for me was using the example from https://github.com/nodegit/nodegit/blob/master/examples/add-and-commit.js .then(function() {
return index.writeTree();
})
.then(function(oidResult) {
oid = oidResult;
return nodegit.Reference.nameToId(repo, "HEAD");
})
.then(function(head) {
return repo.getCommit(head);
})
.then(function(parent) {
return repository.createCommit("HEAD",
git.Signature.default(repository),
git.Signature.default(repository),
"right", oid, [ parent ]);
}) |
I had a similar issue. In my case the issue was that I fetched |
cd merge-commit-bug
git status
All the tests in
merge.js
merges two random branches so the bug doesn't appear. The bug will only surfaces if you mergeHEAD
with another branch.The text was updated successfully, but these errors were encountered: