MCPcopy Create free account
hub / github.com/Kong/insomnia / classifyStatus

Method classifyStatus

packages/insomnia/src/sync/git/git-vcs.ts:1003–1041  ·  view source on GitHub ↗
(head: git.StageStatus, workdir: git.WorkdirStatus, stage: git.StageStatus)

Source from the content-addressed store, hash-verified

1001 }
1002
1003 classifyStatus(head: git.StageStatus, workdir: git.WorkdirStatus, stage: git.StageStatus): FileStatus {
1004 // Untracked
1005 if (head === 0 && stage === 0 && workdir === 2) {
1006 return { type: 'untracked', symbol: 'U' };
1007 }
1008
1009 // Added (staged new file)
1010 if (head === 0 && (stage === 2 || stage === 3)) {
1011 return { type: 'added', symbol: 'A' };
1012 }
1013
1014 // Modified (unstaged)
1015 if (head === 1 && stage === 1 && workdir === 2) {
1016 return { type: 'modified', symbol: 'M' };
1017 }
1018
1019 // Staged modification
1020 if (head === 1 && stage === 2) {
1021 return { type: 'modified', symbol: 'M' };
1022 }
1023
1024 // Deleted (unstaged)
1025 if (head === 1 && stage === 1 && workdir === 0) {
1026 return { type: 'deleted', symbol: 'D' };
1027 }
1028
1029 // Staged deletion
1030 if (head === 1 && stage === 0 && workdir === 0) {
1031 return { type: 'deleted', symbol: 'D' };
1032 }
1033
1034 // Clean
1035 if (head === 1 && stage === 1 && workdir === 1) {
1036 return { type: 'clean', symbol: '-' };
1037 }
1038
1039 // Default (unknown state)
1040 return { type: 'unknown', symbol: '-' };
1041 }
1042
1043 async status(): Promise<{
1044 staged: {

Callers 1

statusMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected