mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-27 19:50:15 +03:00
Merged origin/master into Update new branch styling
This commit is contained in:
commit
2c9270eee9
@ -16,8 +16,10 @@ export function computedAddedRemoved(...files: File[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function computeFileStatus(file: File): FileStatus {
|
export function computeFileStatus(file: File): FileStatus {
|
||||||
const { added, removed } = computedAddedRemoved(file);
|
if (file.hunks.length == 1) {
|
||||||
// TODO: How should we handle this for binary files? See: https://git-scm.com/docs/git-status
|
const diff = file.hunks[0].diff;
|
||||||
const contentLineCount = file.content?.trim().split('\n').length;
|
if (/^@@ -0,0 /.test(diff)) return 'A';
|
||||||
return added == contentLineCount ? 'A' : removed == contentLineCount ? 'D' : 'M';
|
if (/^@@ -\d+,\d+ \+0,0/.test(diff)) return 'D';
|
||||||
|
}
|
||||||
|
return 'M';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user