eh
This commit is contained in:
parent
1163da826e
commit
5776a37dc9
13 changed files with 652 additions and 181 deletions
|
|
@ -1,18 +1,14 @@
|
|||
import type {
|
||||
DocumentRecord,
|
||||
DocumentWithPath,
|
||||
RelativePath
|
||||
} from "../sync-operations/types";
|
||||
import type { DocumentRecord } from "../sync-operations/types";
|
||||
import { EMPTY_HASH } from "./hash";
|
||||
|
||||
// TODO: make this smarter so that offline files can be renamed & edited at the same time
|
||||
export async function findMatchingFile(
|
||||
contentHash: string,
|
||||
candidates: { path: RelativePath; record: DocumentRecord }[]
|
||||
): Promise<DocumentWithPath | undefined> {
|
||||
candidates: DocumentRecord[]
|
||||
): Promise<DocumentRecord | undefined> {
|
||||
if (contentHash === (await EMPTY_HASH)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return candidates.find(({ record }) => record.remoteHash === contentHash);
|
||||
return candidates.find((record) => record.remoteHash === contentHash);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue