git-chopstick-core 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +6 -6
  2. package/dist/git/exec.js.map +1 -1
  3. package/dist/lib/fatal-error.d.ts +1 -1
  4. package/dist/lib/fatal-error.js +1 -1
  5. package/dist/lib/fatal-error.js.map +1 -1
  6. package/dist/lib/progress/from-process.js.map +1 -1
  7. package/dist/lib/progress/index.d.ts +5 -5
  8. package/dist/lib/progress/index.js +5 -5
  9. package/dist/lib/progress/index.js.map +1 -1
  10. package/dist/lib/status-parser.js +0 -12
  11. package/dist/lib/status-parser.js.map +1 -1
  12. package/package.json +38 -8
  13. package/src/git/add.ts +0 -16
  14. package/src/git/apply.ts +0 -154
  15. package/src/git/authentication.ts +0 -20
  16. package/src/git/branch.ts +0 -206
  17. package/src/git/checkout-index.ts +0 -40
  18. package/src/git/checkout.ts +0 -235
  19. package/src/git/cherry-pick.ts +0 -504
  20. package/src/git/clean.ts +0 -9
  21. package/src/git/clone.ts +0 -86
  22. package/src/git/coerce-to-buffer.ts +0 -4
  23. package/src/git/coerce-to-string.ts +0 -4
  24. package/src/git/commit.ts +0 -136
  25. package/src/git/config.ts +0 -392
  26. package/src/git/core.ts +0 -625
  27. package/src/git/create-tail-stream.ts +0 -36
  28. package/src/git/credential.ts +0 -83
  29. package/src/git/description.ts +0 -33
  30. package/src/git/diff-check.ts +0 -27
  31. package/src/git/diff-index.ts +0 -116
  32. package/src/git/diff.ts +0 -880
  33. package/src/git/environment.ts +0 -116
  34. package/src/git/exec.ts +0 -285
  35. package/src/git/fetch.ts +0 -141
  36. package/src/git/for-each-ref.ts +0 -160
  37. package/src/git/format-patch.ts +0 -17
  38. package/src/git/git-delimiter-parser.ts +0 -95
  39. package/src/git/gitignore.ts +0 -157
  40. package/src/git/index.ts +0 -46
  41. package/src/git/init.ts +0 -11
  42. package/src/git/interpret-trailers.ts +0 -176
  43. package/src/git/lfs.ts +0 -100
  44. package/src/git/log.ts +0 -376
  45. package/src/git/merge-tree.ts +0 -42
  46. package/src/git/merge.ts +0 -154
  47. package/src/git/multi-operation-terminal-output.ts +0 -68
  48. package/src/git/pull.ts +0 -130
  49. package/src/git/push-terminal-chunk.ts +0 -41
  50. package/src/git/push.ts +0 -119
  51. package/src/git/rebase.ts +0 -627
  52. package/src/git/reflog.ts +0 -127
  53. package/src/git/refs.ts +0 -63
  54. package/src/git/remote.ts +0 -143
  55. package/src/git/reorder.ts +0 -153
  56. package/src/git/reset.ts +0 -101
  57. package/src/git/rev-list.ts +0 -201
  58. package/src/git/rev-parse.ts +0 -92
  59. package/src/git/revert.ts +0 -55
  60. package/src/git/rm.ts +0 -31
  61. package/src/git/show.ts +0 -88
  62. package/src/git/spawn.ts +0 -38
  63. package/src/git/squash.ts +0 -173
  64. package/src/git/stage.ts +0 -97
  65. package/src/git/stash.ts +0 -302
  66. package/src/git/status.ts +0 -502
  67. package/src/git/submodule.ts +0 -212
  68. package/src/git/tag.ts +0 -134
  69. package/src/git/update-index.ts +0 -169
  70. package/src/git/update-ref.ts +0 -50
  71. package/src/git/var.ts +0 -42
  72. package/src/git/worktree-include.ts +0 -146
  73. package/src/git/worktree.ts +0 -219
  74. package/src/index.ts +0 -11
  75. package/src/lib/api.ts +0 -7
  76. package/src/lib/diff-parser.ts +0 -249
  77. package/src/lib/directory-exists.ts +0 -10
  78. package/src/lib/errno-exception.ts +0 -12
  79. package/src/lib/fatal-error.ts +0 -23
  80. package/src/lib/feature-flag.ts +0 -29
  81. package/src/lib/file-system.ts +0 -7
  82. package/src/lib/get-old-path.ts +0 -11
  83. package/src/lib/git/environment.ts +0 -14
  84. package/src/lib/git-perf.ts +0 -3
  85. package/src/lib/helpers/default-branch.ts +0 -3
  86. package/src/lib/helpers/path.ts +0 -5
  87. package/src/lib/hooks/with-hooks-env.ts +0 -7
  88. package/src/lib/merge.ts +0 -3
  89. package/src/lib/noop.ts +0 -1
  90. package/src/lib/patch-formatter.ts +0 -18
  91. package/src/lib/path-exists.ts +0 -7
  92. package/src/lib/progress/from-process.ts +0 -10
  93. package/src/lib/progress/index.ts +0 -43
  94. package/src/lib/progress/revert.ts +0 -17
  95. package/src/lib/rebase.ts +0 -3
  96. package/src/lib/remove-remote-prefix.ts +0 -4
  97. package/src/lib/resolve-git-proxy.ts +0 -3
  98. package/src/lib/round.ts +0 -4
  99. package/src/lib/split-buffer.ts +0 -14
  100. package/src/lib/status-parser.ts +0 -188
  101. package/src/lib/stores/helpers/find-default-remote.ts +0 -3
  102. package/src/lib/trampoline/trampoline-environment.ts +0 -8
  103. package/src/models/branch.ts +0 -78
  104. package/src/models/cherry-pick.ts +0 -12
  105. package/src/models/clone-options.ts +0 -6
  106. package/src/models/commit-identity.ts +0 -35
  107. package/src/models/commit.ts +0 -44
  108. package/src/models/computed-action.ts +0 -6
  109. package/src/models/diff/diff-data.ts +0 -78
  110. package/src/models/diff/diff-line.ts +0 -36
  111. package/src/models/diff/diff-selection.ts +0 -165
  112. package/src/models/diff/image-diff.ts +0 -6
  113. package/src/models/diff/image.ts +0 -8
  114. package/src/models/diff/index.ts +0 -6
  115. package/src/models/diff/raw-diff.ts +0 -41
  116. package/src/models/git-author.ts +0 -16
  117. package/src/models/index.ts +0 -36
  118. package/src/models/manual-conflict-resolution.ts +0 -4
  119. package/src/models/merge.ts +0 -6
  120. package/src/models/multi-commit-operation.ts +0 -6
  121. package/src/models/progress.ts +0 -67
  122. package/src/models/rebase.ts +0 -20
  123. package/src/models/remote.ts +0 -10
  124. package/src/models/repository.ts +0 -16
  125. package/src/models/stash-entry.ts +0 -25
  126. package/src/models/status.ts +0 -275
  127. package/src/models/submodule.ts +0 -13
  128. package/src/models/worktree.ts +0 -11
@@ -1,275 +0,0 @@
1
- import { DiffSelection, DiffSelectionType } from './diff/index.js'
2
-
3
- export enum GitStatusEntry {
4
- Modified = 'M',
5
- Added = 'A',
6
- Deleted = 'D',
7
- Renamed = 'R',
8
- Copied = 'C',
9
- Unchanged = '.',
10
- Untracked = '?',
11
- Ignored = '!',
12
- UpdatedButUnmerged = 'U',
13
- }
14
-
15
- export enum AppFileStatusKind {
16
- New = 'New',
17
- Modified = 'Modified',
18
- Deleted = 'Deleted',
19
- Copied = 'Copied',
20
- Renamed = 'Renamed',
21
- Conflicted = 'Conflicted',
22
- Untracked = 'Untracked',
23
- }
24
-
25
- export type PlainFileStatus = {
26
- kind: AppFileStatusKind.New | AppFileStatusKind.Modified | AppFileStatusKind.Deleted
27
- submoduleStatus?: SubmoduleStatus
28
- }
29
-
30
- export type CopiedOrRenamedFileStatus = {
31
- kind: AppFileStatusKind.Copied | AppFileStatusKind.Renamed
32
- oldPath: string
33
- renameIncludesModifications: boolean
34
- submoduleStatus?: SubmoduleStatus
35
- }
36
-
37
- export type ConflictsWithMarkers = {
38
- kind: AppFileStatusKind.Conflicted
39
- entry: TextConflictEntry
40
- conflictMarkerCount: number
41
- submoduleStatus?: SubmoduleStatus
42
- }
43
-
44
- export type ManualConflict = {
45
- kind: AppFileStatusKind.Conflicted
46
- entry: ManualConflictEntry
47
- submoduleStatus?: SubmoduleStatus
48
- }
49
-
50
- export type ConflictedFileStatus = ConflictsWithMarkers | ManualConflict
51
-
52
- export function isConflictedFileStatus(
53
- appFileStatus: AppFileStatus
54
- ): appFileStatus is ConflictedFileStatus {
55
- return appFileStatus.kind === AppFileStatusKind.Conflicted
56
- }
57
-
58
- export function isConflictWithMarkers(
59
- conflictedFileStatus: ConflictedFileStatus
60
- ): conflictedFileStatus is ConflictsWithMarkers {
61
- return 'conflictMarkerCount' in conflictedFileStatus
62
- }
63
-
64
- export type UntrackedFileStatus = {
65
- kind: AppFileStatusKind.Untracked
66
- submoduleStatus?: SubmoduleStatus
67
- }
68
-
69
- export type AppFileStatus =
70
- | PlainFileStatus
71
- | CopiedOrRenamedFileStatus
72
- | ConflictedFileStatus
73
- | UntrackedFileStatus
74
-
75
- export type SubmoduleStatus = {
76
- readonly commitChanged: boolean
77
- readonly modifiedChanges: boolean
78
- readonly untrackedChanges: boolean
79
- }
80
-
81
- type OrdinaryEntry = {
82
- readonly kind: 'ordinary'
83
- readonly type: 'added' | 'modified' | 'deleted'
84
- readonly index?: GitStatusEntry
85
- readonly workingTree?: GitStatusEntry
86
- readonly submoduleStatus?: SubmoduleStatus
87
- }
88
-
89
- type RenamedOrCopiedEntry = {
90
- readonly kind: 'renamed' | 'copied'
91
- readonly index?: GitStatusEntry
92
- readonly workingTree?: GitStatusEntry
93
- readonly submoduleStatus?: SubmoduleStatus
94
- readonly renameOrCopyScore?: number
95
- }
96
-
97
- export enum UnmergedEntrySummary {
98
- AddedByUs = 'added-by-us',
99
- DeletedByUs = 'deleted-by-us',
100
- AddedByThem = 'added-by-them',
101
- DeletedByThem = 'deleted-by-them',
102
- BothDeleted = 'both-deleted',
103
- BothAdded = 'both-added',
104
- BothModified = 'both-modified',
105
- }
106
-
107
- type TextConflictDetails =
108
- | {
109
- readonly action: UnmergedEntrySummary.BothAdded
110
- readonly us: GitStatusEntry.Added
111
- readonly them: GitStatusEntry.Added
112
- }
113
- | {
114
- readonly action: UnmergedEntrySummary.BothModified
115
- readonly us: GitStatusEntry.UpdatedButUnmerged
116
- readonly them: GitStatusEntry.UpdatedButUnmerged
117
- }
118
-
119
- type TextConflictEntry = {
120
- readonly kind: 'conflicted'
121
- readonly submoduleStatus?: SubmoduleStatus
122
- } & TextConflictDetails
123
-
124
- type ManualConflictDetails = {
125
- readonly submoduleStatus?: SubmoduleStatus
126
- } & (
127
- | { readonly action: UnmergedEntrySummary.BothAdded; readonly us: GitStatusEntry.Added; readonly them: GitStatusEntry.Added }
128
- | { readonly action: UnmergedEntrySummary.BothModified; readonly us: GitStatusEntry.UpdatedButUnmerged; readonly them: GitStatusEntry.UpdatedButUnmerged }
129
- | { readonly action: UnmergedEntrySummary.AddedByUs; readonly us: GitStatusEntry.Added; readonly them: GitStatusEntry.UpdatedButUnmerged }
130
- | { readonly action: UnmergedEntrySummary.DeletedByThem; readonly us: GitStatusEntry.UpdatedButUnmerged; readonly them: GitStatusEntry.Deleted }
131
- | { readonly action: UnmergedEntrySummary.AddedByThem; readonly us: GitStatusEntry.UpdatedButUnmerged; readonly them: GitStatusEntry.Added }
132
- | { readonly action: UnmergedEntrySummary.DeletedByUs; readonly us: GitStatusEntry.Deleted; readonly them: GitStatusEntry.UpdatedButUnmerged }
133
- | { readonly action: UnmergedEntrySummary.BothDeleted; readonly us: GitStatusEntry.Deleted; readonly them: GitStatusEntry.Deleted }
134
- )
135
-
136
- type ManualConflictEntry = {
137
- readonly kind: 'conflicted'
138
- readonly submoduleStatus?: SubmoduleStatus
139
- } & ManualConflictDetails
140
-
141
- export type UnmergedEntry = TextConflictEntry | ManualConflictEntry
142
-
143
- type UntrackedEntry = {
144
- readonly kind: 'untracked'
145
- readonly submoduleStatus?: SubmoduleStatus
146
- }
147
-
148
- export type FileEntry =
149
- | OrdinaryEntry
150
- | RenamedOrCopiedEntry
151
- | UnmergedEntry
152
- | UntrackedEntry
153
-
154
- export class FileChange {
155
- public readonly id: string
156
-
157
- public constructor(
158
- public readonly path: string,
159
- public readonly status: AppFileStatus
160
- ) {
161
- if (
162
- status.kind === AppFileStatusKind.Renamed ||
163
- status.kind === AppFileStatusKind.Copied
164
- ) {
165
- this.id = `${status.kind}+${path}+${status.oldPath}`
166
- } else {
167
- this.id = `${status.kind}+${path}`
168
- }
169
- }
170
-
171
- public isDeleted(): boolean {
172
- return this.status.kind === AppFileStatusKind.Deleted
173
- }
174
-
175
- public isNew(): boolean {
176
- return this.status.kind === AppFileStatusKind.New
177
- }
178
-
179
- public isModified(): boolean {
180
- return this.status.kind === AppFileStatusKind.Modified
181
- }
182
-
183
- public isUntracked(): boolean {
184
- return this.status.kind === AppFileStatusKind.Untracked
185
- }
186
- }
187
-
188
- export class WorkingDirectoryFileChange extends FileChange {
189
- public constructor(
190
- path: string,
191
- status: AppFileStatus,
192
- public readonly selection: DiffSelection
193
- ) {
194
- super(path, status)
195
- }
196
-
197
- public withIncludeAll(include: boolean): WorkingDirectoryFileChange {
198
- const newSelection = include
199
- ? this.selection.withSelectAll()
200
- : this.selection.withSelectNone()
201
- return this.withSelection(newSelection)
202
- }
203
-
204
- public withSelection(selection: DiffSelection): WorkingDirectoryFileChange {
205
- return new WorkingDirectoryFileChange(this.path, this.status, selection)
206
- }
207
-
208
- public isIncludedInCommit(): boolean {
209
- return this.selection.getSelectionType() === DiffSelectionType.All
210
- }
211
-
212
- public isExcludedFromCommit(): boolean {
213
- return this.selection.getSelectionType() === DiffSelectionType.None
214
- }
215
- }
216
-
217
- export class CommittedFileChange extends FileChange {
218
- public constructor(
219
- path: string,
220
- status: AppFileStatus,
221
- public readonly commitish: string,
222
- public readonly parentCommitish: string
223
- ) {
224
- super(path, status)
225
- }
226
- }
227
-
228
- export class WorkingDirectoryStatus {
229
- public static fromFiles(
230
- files: ReadonlyArray<WorkingDirectoryFileChange>
231
- ): WorkingDirectoryStatus {
232
- return new WorkingDirectoryStatus(files, getIncludeAllState(files))
233
- }
234
-
235
- private readonly fileIxById = new Map<string, number>()
236
-
237
- private constructor(
238
- public readonly files: ReadonlyArray<WorkingDirectoryFileChange>,
239
- public readonly includeAll: boolean | null = true
240
- ) {
241
- files.forEach((f, ix) => this.fileIxById.set(f.id, ix))
242
- }
243
-
244
- public withIncludeAllFiles(includeAll: boolean): WorkingDirectoryStatus {
245
- const newFiles = this.files.map(f => f.withIncludeAll(includeAll))
246
- return new WorkingDirectoryStatus(newFiles, includeAll)
247
- }
248
-
249
- public findFileWithID(id: string): WorkingDirectoryFileChange | null {
250
- const ix = this.fileIxById.get(id)
251
- return ix !== undefined ? this.files[ix] || null : null
252
- }
253
-
254
- public findFileIndexByID(id: string): number {
255
- const ix = this.fileIxById.get(id)
256
- return ix !== undefined ? ix : -1
257
- }
258
- }
259
-
260
- function getIncludeAllState(
261
- files: ReadonlyArray<WorkingDirectoryFileChange>
262
- ): boolean | null {
263
- if (!files.length) return true
264
-
265
- const allSelected = files.every(
266
- f => f.selection.getSelectionType() === DiffSelectionType.All
267
- )
268
- const noneSelected = files.every(
269
- f => f.selection.getSelectionType() === DiffSelectionType.None
270
- )
271
-
272
- if (allSelected) return true
273
- if (noneSelected) return false
274
- return null
275
- }
@@ -1,13 +0,0 @@
1
- export type SubmoduleEntry = {
2
- readonly path: string
3
- readonly url: string
4
- readonly describe?: string
5
- readonly sha: string
6
- readonly status: SubmoduleStatus
7
- }
8
-
9
- export type SubmoduleStatus = {
10
- readonly commitChanged: boolean
11
- readonly modifiedChanges: boolean
12
- readonly untrackedChanges: boolean
13
- }
@@ -1,11 +0,0 @@
1
- export type WorktreeType = 'main' | 'linked'
2
-
3
- export type WorktreeEntry = {
4
- readonly path: string
5
- readonly head: string
6
- readonly branch: string | null
7
- readonly isDetached: boolean
8
- readonly type: WorktreeType
9
- readonly isLocked: boolean
10
- readonly isPrunable: boolean
11
- }