Handle all git status codes in file class mapping
This commit is contained in:
parent
c0387ff0d3
commit
acdceaf083
1 changed files with 11 additions and 4 deletions
|
|
@ -866,10 +866,17 @@
|
|||
}
|
||||
|
||||
function getFileClass(status) {
|
||||
if (status === 'M') return 'git-file-modified';
|
||||
if (status === 'A') return 'git-file-added';
|
||||
if (status === 'D') return 'git-file-deleted';
|
||||
if (status === '??') return 'git-file-untracked';
|
||||
// Git status is two characters: index status + working tree status
|
||||
// Check first non-space character for primary classification
|
||||
const char = status.trim()[0] || '';
|
||||
if (char === 'M') return 'git-file-modified';
|
||||
if (char === 'A') return 'git-file-added';
|
||||
if (char === 'D') return 'git-file-deleted';
|
||||
if (char === 'R') return 'git-file-modified'; // Renamed treated as modified
|
||||
if (char === 'C') return 'git-file-added'; // Copied treated as added
|
||||
if (char === 'U') return 'git-file-modified'; // Unmerged treated as modified
|
||||
if (char === '?') return 'git-file-untracked';
|
||||
if (char === '!') return 'git-file-untracked'; // Ignored
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue