Commit fea95f88 authored by Thomas Randolph's avatar Thomas Randolph

Identify diff files

parent cd3242a8
...@@ -4,6 +4,7 @@ import { ...@@ -4,6 +4,7 @@ import {
DIFF_FILE_MANUAL_COLLAPSE, DIFF_FILE_MANUAL_COLLAPSE,
DIFF_FILE_AUTOMATIC_COLLAPSE, DIFF_FILE_AUTOMATIC_COLLAPSE,
} from '../constants'; } from '../constants';
import { uuids } from './uuids';
function fileSymlinkInformation(file, fileList) { function fileSymlinkInformation(file, fileList) {
const duplicates = fileList.filter(iteratedFile => iteratedFile.file_hash === file.file_hash); const duplicates = fileList.filter(iteratedFile => iteratedFile.file_hash === file.file_hash);
...@@ -32,8 +33,15 @@ function collapsed(file) { ...@@ -32,8 +33,15 @@ function collapsed(file) {
}; };
} }
export function identifier({ file }) {
return uuids({
seeds: [file.file_identifier_hash, file.content_sha],
})[0];
}
export function prepareRawDiffFile({ file, allFiles }) { export function prepareRawDiffFile({ file, allFiles }) {
Object.assign(file, { Object.assign(file, {
id: identifier({ file }),
brokenSymlink: fileSymlinkInformation(file, allFiles), brokenSymlink: fileSymlinkInformation(file, allFiles),
viewer: { viewer: {
...file.viewer, ...file.viewer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment