Skip to content

Commit aa437d4

Browse files
committed
refactor: move deprecated code to unused.md
1 parent 09896d8 commit aa437d4

3 files changed

Lines changed: 42 additions & 33 deletions

File tree

docs/development/unused.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Unused
2+
3+
Code that is no longer needed because approach changed, but kept in case it is needed again.
4+
5+
6+
## Status
7+
8+
These were for when `git status` was used, before `git diff-index` was used.
9+
10+
- `src/generate/action.ts`
11+
```typescript
12+
/**
13+
* Extract single action from given X and Y actions.
14+
*
15+
* "Modified" must take preference over the others. Unfortunately, there is no way here to combine
16+
* update and move.
17+
*/
18+
function _lookupStatusAction(x: string, y: string): string {
19+
if (ACTION[y as ActionKeys] === ACTION.M) {
20+
return ACTION.M;
21+
}
22+
23+
return ACTION[x as ActionKeys];
24+
}
25+
```
26+
27+
- `src/git/cli.ts`
28+
```typescript
29+
/**
30+
* Run `git status` with flags and return output.
31+
*
32+
* This will ignore untracked and remove color.
33+
*/
34+
async function status(options: string[] = []) {
35+
return execute(getWorkspaceFolder(), "status", [
36+
"--short",
37+
"-uno",
38+
"--porcelain",
39+
...options,
40+
]);
41+
}
42+
```

src/generate/action.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@ import { ACTION, ROOT } from "../lib/constants";
1111
import { moveOrRenameFromPaths, splitPath } from "../lib/paths";
1212
import { ActionKeys } from "./action.d";
1313

14-
/**
15-
* Extract single action from given X and Y actions.
16-
*
17-
* UNUSED.
18-
*
19-
* Keep for future use with `git status` short output if needed.
20-
*
21-
* "Modified" must take preference over the others. Unfortunately, there is no way here to combine
22-
* update and move.
23-
*/
24-
function _lookupStatusAction(x: string, y: string): string {
25-
if (ACTION[y as ActionKeys] === ACTION.M) {
26-
return ACTION.M;
27-
}
28-
return ACTION[x as ActionKeys];
29-
}
30-
3114
/**
3215
* Lookup the action (e.g. 'modified') for a given key (e.g. 'M').
3316
*/

src/git/cli.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,3 @@ export async function getChanges() {
8282
}
8383
return allChanges;
8484
}
85-
86-
/**
87-
* Run git status short and return output.
88-
*
89-
* Ignore untracked and remove color.
90-
*
91-
* UNUSED - This was used before diffIndex was introduced to this project.
92-
*/
93-
async function status(options: string[] = []) {
94-
return execute(getWorkspaceFolder(), "status", [
95-
"--short",
96-
"-uno",
97-
"--porcelain",
98-
...options,
99-
]);
100-
}

0 commit comments

Comments
 (0)