-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
feat(add): Merge deletions support #1836
feat(add): Merge deletions support #1836
Conversation
I have no idea why tests are failing. First time I cloned isomorpgic-git, run |
Thanks for the PR. Can you fix the lint errors? I'm not sure if the tests work locally, there were some fixed done but I'm not sure if they work. The CI/CD failed on lint errors. If tests fail you can use this PR to fix the tests. |
I fixed link erorrs |
now tests are failing, what exactly is |
https://jestjs.io/docs/asynchronous#asyncawait If |
This reverts commit 4e627f7.
the tests seemed to pass |
AFAIK the proper API in jest to test if something throws is:
|
I did the same thing as the other tests in |
That's odd. |
Ok looks good. One more thing can you document the feature of mergeConflict Error? I hope that the website can be built, we have this legacy Azure Pipeline that gives a lot of issues. |
🎉 This PR is included in version 1.25.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I aldready tried to change docs: isomorphic-git/isomorphic-git.github.io#94, but it looks like website isn't being updated. |
I've sent a message to the original author on LinkedIN, I hope he will reply there. Last time I sent him DM on twitter he didn't replied, and it seems that website is the only one thing that we don't have access to. And we don't know how to build the website. |
Hiya @jcubic - sorry I don't have a Twitter (er, I mean X) account anymore. I'll add you on LinkedIn The docs are in the main repo (this one) in the To test the docs locally, you also run |
@billiegoose so normal release do the the update of website? We thought that the website was on isomorphic-git.github.io repo. What is this repo for then? |
Yup.
Free hosting from GitHub Pages. It's not meant to be edited by humans, it's just a destination. See all the commits on the main branch? https://github.com/isomorphic-git/isomorphic-git.github.io/commits/main They're all made by I guess the "Edit" links docusaurus makes are a little awkward since they point to that repo instead of the |
* init * add fixture * add tests * refactor test errors * add new bracnhes in merge fixture rep * fix grammar * add "delete poth" in fixture rep * add "delete by both" * fix test "delete by both" * add data in MergeConflictError * change docs * docs: add @DanilKazanov as a contributor * revert change docs for some reason * fix-eslint * Revert "refactor test errors" This reverts commit 4e627f7.
This PR adds merge deletions support to isomorhic-git. if a file that was deleted in one branch and modified in another branch,
MergeConflictError
is returned with the data.For example, I have repo with two branches:
master
anddevelop
, and filea
. Then I change filea
inmaster
and delete filea
in branchdevelop
.I merge
develop
inmaster
(delete by them):With native git:
[ 'a', 1, 1, 3 ]
With isomorphic-git:
[ 'a', 1, 1, 3 ]
As you can see, they are the same.
I merge
master
indevelop
(delete by us):With native git:
[ 'a', 0, 2, 3 ]
With isomorphic-git:
[ 'a', 0, 2, 3 ]
As you can see, they are the same too.
Also, if file
a
has been deleted in both branches, it is simply not a conflict and it is resolved automatically (removed from the index).The
MergeConflictError
error now has this data:{ filepaths: string[], bothModified: string[], deleteByUs: string[], deleteByTheirs: string[] }
. Also, I added more branches in test-merge fixture repository.From my experience, there is only one variant of conficts left: when the same file is added in different branches. But, I don't really understand how to solve this, because diff3 algorithm needs 3 files, so it needs a base file as well. The native git somehow knows how to build a base file from two files, or it uses some other diff algorithm. I had ideas to implement via diff-lines (already in the isomorphic-git dependencies), but I can't be sure how native this is. I'd have to change mergeDriver, since it won't return the base file in such cases.
And another difference I've noticed is the renaming. The native git can realize that a file has been renamed in one branch and in another, and will create a conlifct. (For example, I do
mv a a2
inmaster
andmv a a3
indevelop
. Native-git in merge will create a conflict, isomorphic-git will not. For isomorphic, it is deleting in two branches, addinga2
anda3