mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-26 11:08:38 +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 {
|
||||
const { added, removed } = computedAddedRemoved(file);
|
||||
// TODO: How should we handle this for binary files? See: https://git-scm.com/docs/git-status
|
||||
const contentLineCount = file.content?.trim().split('\n').length;
|
||||
return added == contentLineCount ? 'A' : removed == contentLineCount ? 'D' : 'M';
|
||||
if (file.hunks.length == 1) {
|
||||
const diff = file.hunks[0].diff;
|
||||
if (/^@@ -0,0 /.test(diff)) return 'A';
|
||||
if (/^@@ -\d+,\d+ \+0,0/.test(diff)) return 'D';
|
||||
}
|
||||
return 'M';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user