Handle all git status codes in file class mapping

This commit is contained in:
Jared Miller 2026-01-28 15:03:16 -05:00
parent c0387ff0d3
commit acdceaf083
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -866,10 +866,17 @@
} }
function getFileClass(status) { function getFileClass(status) {
if (status === 'M') return 'git-file-modified'; // Git status is two characters: index status + working tree status
if (status === 'A') return 'git-file-added'; // Check first non-space character for primary classification
if (status === 'D') return 'git-file-deleted'; const char = status.trim()[0] || '';
if (status === '??') return 'git-file-untracked'; 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 ''; return '';
} }