Skip to content

Commit ff251a6

Browse files
ARBhosaleaniket.bhosale
authored andcommitted
fix: mergeTree handles modifications in both trees (#2122)
Co-authored-by: aniket.bhosale <[email protected]>
1 parent b8b7497 commit ff251a6

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

js/isomorphic-git/index.cjs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9437,7 +9437,22 @@ async function mergeTree({
94379437
: undefined
94389438
}
94399439
case 'true-true': {
9440-
// Modifications
9440+
// Handle tree-tree merges (directories)
9441+
if (
9442+
ours &&
9443+
theirs &&
9444+
(await ours.type()) === 'tree' &&
9445+
(await theirs.type()) === 'tree'
9446+
) {
9447+
return {
9448+
mode: await ours.mode(),
9449+
path,
9450+
oid: await ours.oid(),
9451+
type: 'tree',
9452+
}
9453+
}
9454+
9455+
// Modifications - both are blobs
94419456
if (
94429457
ours &&
94439458
theirs &&

js/isomorphic-git/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9431,7 +9431,22 @@ async function mergeTree({
94319431
: undefined
94329432
}
94339433
case 'true-true': {
9434-
// Modifications
9434+
// Handle tree-tree merges (directories)
9435+
if (
9436+
ours &&
9437+
theirs &&
9438+
(await ours.type()) === 'tree' &&
9439+
(await theirs.type()) === 'tree'
9440+
) {
9441+
return {
9442+
mode: await ours.mode(),
9443+
path,
9444+
oid: await ours.oid(),
9445+
type: 'tree',
9446+
}
9447+
}
9448+
9449+
// Modifications - both are blobs
94359450
if (
94369451
ours &&
94379452
theirs &&

js/isomorphic-git/index.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/index.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/size_report.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)