Skip to content

Commit

Permalink
[web] - fix branch compare trees on merge (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Matusevich authored Oct 19, 2023
1 parent a513f2f commit 79d9bb5
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/1.0.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/2.0.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3047,7 +3047,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/3.0.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3467,7 +3467,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/4.0.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3535,7 +3535,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/5.0.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4024,7 +4024,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/5.1.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4024,7 +4024,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/6.0.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4133,7 +4133,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
2 changes: 1 addition & 1 deletion react-gosh/src/gosh/6.1.0/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4157,7 +4157,7 @@ class GoshRepositoryAdapter implements IGoshRepositoryAdapter {
return value0
}

private async _getSnapshot(options: {
async _getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot> {
Expand Down
4 changes: 4 additions & 0 deletions react-gosh/src/gosh/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ interface IGoshRepositoryAdapter {
content: string | Buffer
ipfs: boolean
}>
_getSnapshot(options: {
fullpath?: string
address?: TAddress
}): Promise<IGoshSnapshot>
getCommit(options: { name?: string; address?: TAddress }): Promise<TCommit>
_getCommit(options: { name?: string; address?: TAddress }): Promise<IGoshCommit>
getCommitBlob(
Expand Down
10 changes: 4 additions & 6 deletions react-gosh/src/hooks/repo.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1061,12 +1061,11 @@ function _useMergeRequest(
async (treepath, index) => {
const { src, dst } = treepath
const srcFullPath = `${src.treeitem.commit}/${src.path}`
const _srcBlob = await srcRepo.getBlob({
commit: srcBranch.commit.name,
const _srcSnapshot = await srcRepo._getSnapshot({
fullpath: srcFullPath,
})
const srcBlob = await srcRepo.getCommitBlob(
_srcBlob.address,
_srcSnapshot.address,
src.path,
srcBranch.commit.name,
)
Expand All @@ -1075,12 +1074,11 @@ function _useMergeRequest(
const dstFullPath = `${dst.treeitem?.commit}/${dst.path}`
let dstContent: string | Buffer = ''
if (dst.path) {
const _dstBlob = await dstRepo.getBlob({
commit: dstBranch.commit.name,
const _dstSnapshot = await dstRepo._getSnapshot({
fullpath: dstFullPath,
})
const dstBlob = await dstRepo.getCommitBlob(
_dstBlob.address,
_dstSnapshot.address,
dst.path,
dstBranch.commit.name,
)
Expand Down

0 comments on commit 79d9bb5

Please sign in to comment.