git-chopstick-core 0.1.1 → 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 (461) hide show
  1. package/README.md +324 -32
  2. package/dist/git/add.d.ts +9 -0
  3. package/dist/git/add.js +11 -0
  4. package/dist/git/add.js.map +1 -0
  5. package/dist/git/apply.d.ts +33 -0
  6. package/dist/git/apply.js +103 -0
  7. package/dist/git/apply.js.map +1 -0
  8. package/dist/git/authentication.d.ts +5 -0
  9. package/dist/git/authentication.js +19 -0
  10. package/dist/git/authentication.js.map +1 -0
  11. package/dist/git/branch.d.ts +43 -0
  12. package/dist/git/branch.js +150 -0
  13. package/dist/git/branch.js.map +1 -0
  14. package/dist/git/checkout-index.d.ts +19 -0
  15. package/{src/git/checkout-index.ts → dist/git/checkout-index.js} +11 -22
  16. package/dist/git/checkout-index.js.map +1 -0
  17. package/dist/git/checkout.d.ts +46 -0
  18. package/dist/git/checkout.js +126 -0
  19. package/dist/git/checkout.js.map +1 -0
  20. package/dist/git/cherry-pick.d.ts +82 -0
  21. package/dist/git/cherry-pick.js +371 -0
  22. package/dist/git/cherry-pick.js.map +1 -0
  23. package/dist/git/clean.d.ts +5 -0
  24. package/dist/git/clean.js +8 -0
  25. package/dist/git/clean.js.map +1 -0
  26. package/dist/git/clone.d.ts +22 -0
  27. package/dist/git/clone.js +58 -0
  28. package/dist/git/clone.js.map +1 -0
  29. package/dist/git/coerce-to-buffer.d.ts +1 -0
  30. package/dist/git/coerce-to-buffer.js +2 -0
  31. package/dist/git/coerce-to-buffer.js.map +1 -0
  32. package/dist/git/coerce-to-string.d.ts +1 -0
  33. package/dist/git/coerce-to-string.js +2 -0
  34. package/dist/git/coerce-to-string.js.map +1 -0
  35. package/dist/git/commit.d.ts +25 -0
  36. package/dist/git/commit.js +99 -0
  37. package/dist/git/commit.js.map +1 -0
  38. package/dist/git/config.d.ts +98 -0
  39. package/dist/git/config.js +249 -0
  40. package/dist/git/config.js.map +1 -0
  41. package/dist/git/core.d.ts +167 -0
  42. package/dist/git/core.js +368 -0
  43. package/dist/git/core.js.map +1 -0
  44. package/dist/git/create-tail-stream.d.ts +4 -0
  45. package/dist/git/create-tail-stream.js +30 -0
  46. package/dist/git/create-tail-stream.js.map +1 -0
  47. package/dist/git/credential.d.ts +5 -0
  48. package/dist/git/credential.js +64 -0
  49. package/dist/git/credential.js.map +1 -0
  50. package/dist/git/description.d.ts +5 -0
  51. package/dist/git/description.js +24 -0
  52. package/dist/git/description.js.map +1 -0
  53. package/dist/git/diff-check.d.ts +7 -0
  54. package/dist/git/diff-check.js +17 -0
  55. package/dist/git/diff-check.js.map +1 -0
  56. package/dist/git/diff-index.d.ts +31 -0
  57. package/dist/git/diff-index.js +76 -0
  58. package/dist/git/diff-index.js.map +1 -0
  59. package/dist/git/diff.d.ts +81 -0
  60. package/dist/git/diff.js +611 -0
  61. package/dist/git/diff.js.map +1 -0
  62. package/dist/git/environment.d.ts +51 -0
  63. package/dist/git/environment.js +97 -0
  64. package/dist/git/environment.js.map +1 -0
  65. package/dist/git/exec.d.ts +109 -0
  66. package/dist/git/exec.js +224 -0
  67. package/dist/git/exec.js.map +1 -0
  68. package/dist/git/fetch.d.ts +25 -0
  69. package/dist/git/fetch.js +100 -0
  70. package/dist/git/fetch.js.map +1 -0
  71. package/dist/git/for-each-ref.d.ts +13 -0
  72. package/dist/git/for-each-ref.js +114 -0
  73. package/dist/git/for-each-ref.js.map +1 -0
  74. package/dist/git/format-patch.d.ts +10 -0
  75. package/dist/git/format-patch.js +16 -0
  76. package/dist/git/format-patch.js.map +1 -0
  77. package/dist/git/git-delimiter-parser.d.ts +38 -0
  78. package/dist/git/git-delimiter-parser.js +79 -0
  79. package/dist/git/git-delimiter-parser.js.map +1 -0
  80. package/dist/git/gitignore.d.ts +26 -0
  81. package/dist/git/gitignore.js +124 -0
  82. package/dist/git/gitignore.js.map +1 -0
  83. package/dist/git/index.d.ts +46 -0
  84. package/dist/git/index.js +47 -0
  85. package/dist/git/index.js.map +1 -0
  86. package/dist/git/init.d.ts +2 -0
  87. package/dist/git/init.js +7 -0
  88. package/dist/git/init.js.map +1 -0
  89. package/{src/git/interpret-trailers.ts → dist/git/interpret-trailers.d.ts} +9 -97
  90. package/dist/git/interpret-trailers.js +130 -0
  91. package/dist/git/interpret-trailers.js.map +1 -0
  92. package/dist/git/lfs.d.ts +25 -0
  93. package/dist/git/lfs.js +73 -0
  94. package/dist/git/lfs.js.map +1 -0
  95. package/dist/git/log.d.ts +56 -0
  96. package/dist/git/log.js +258 -0
  97. package/dist/git/log.js.map +1 -0
  98. package/dist/git/merge-tree.d.ts +13 -0
  99. package/dist/git/merge-tree.js +24 -0
  100. package/dist/git/merge-tree.js.map +1 -0
  101. package/dist/git/merge.d.ts +50 -0
  102. package/dist/git/merge.js +111 -0
  103. package/dist/git/merge.js.map +1 -0
  104. package/dist/git/multi-operation-terminal-output.d.ts +20 -0
  105. package/dist/git/multi-operation-terminal-output.js +56 -0
  106. package/dist/git/multi-operation-terminal-output.js.map +1 -0
  107. package/dist/git/pull.d.ts +24 -0
  108. package/dist/git/pull.js +91 -0
  109. package/dist/git/pull.js.map +1 -0
  110. package/{src/git/push-terminal-chunk.ts → dist/git/push-terminal-chunk.d.ts} +1 -23
  111. package/dist/git/push-terminal-chunk.js +36 -0
  112. package/dist/git/push-terminal-chunk.js.map +1 -0
  113. package/dist/git/push.d.ts +42 -0
  114. package/dist/git/push.js +80 -0
  115. package/dist/git/push.js.map +1 -0
  116. package/dist/git/rebase.d.ts +119 -0
  117. package/dist/git/rebase.js +415 -0
  118. package/dist/git/rebase.js.map +1 -0
  119. package/dist/git/reflog.d.ts +14 -0
  120. package/dist/git/reflog.js +88 -0
  121. package/dist/git/reflog.js.map +1 -0
  122. package/dist/git/refs.d.ts +26 -0
  123. package/dist/git/refs.js +53 -0
  124. package/dist/git/refs.js.map +1 -0
  125. package/dist/git/remote.d.ts +31 -0
  126. package/dist/git/remote.js +81 -0
  127. package/dist/git/remote.js.map +1 -0
  128. package/dist/git/reorder.d.ts +23 -0
  129. package/dist/git/reorder.js +111 -0
  130. package/dist/git/reorder.js.map +1 -0
  131. package/dist/git/reset.d.ts +41 -0
  132. package/dist/git/reset.js +86 -0
  133. package/dist/git/reset.js.map +1 -0
  134. package/dist/git/rev-list.d.ts +67 -0
  135. package/dist/git/rev-list.js +157 -0
  136. package/dist/git/rev-list.js.map +1 -0
  137. package/dist/git/rev-parse.d.ts +24 -0
  138. package/dist/git/rev-parse.js +65 -0
  139. package/dist/git/rev-parse.js.map +1 -0
  140. package/dist/git/revert.d.ts +12 -0
  141. package/dist/git/revert.js +30 -0
  142. package/dist/git/revert.js.map +1 -0
  143. package/dist/git/rm.d.ts +12 -0
  144. package/dist/git/rm.js +22 -0
  145. package/dist/git/rm.js.map +1 -0
  146. package/dist/git/show.d.ts +42 -0
  147. package/{src/git/show.ts → dist/git/show.js} +17 -46
  148. package/dist/git/show.js.map +1 -0
  149. package/dist/git/spawn.d.ts +18 -0
  150. package/dist/git/spawn.js +16 -0
  151. package/dist/git/spawn.js.map +1 -0
  152. package/dist/git/squash.d.ts +28 -0
  153. package/dist/git/squash.js +127 -0
  154. package/dist/git/squash.js.map +1 -0
  155. package/dist/git/stage.d.ts +21 -0
  156. package/dist/git/stage.js +72 -0
  157. package/dist/git/stage.js.map +1 -0
  158. package/dist/git/stash.d.ts +53 -0
  159. package/dist/git/stash.js +204 -0
  160. package/dist/git/stash.js.map +1 -0
  161. package/dist/git/status.d.ts +39 -0
  162. package/dist/git/status.js +293 -0
  163. package/dist/git/status.js.map +1 -0
  164. package/dist/git/submodule.d.ts +20 -0
  165. package/dist/git/submodule.js +153 -0
  166. package/dist/git/submodule.js.map +1 -0
  167. package/dist/git/tag.d.ts +32 -0
  168. package/dist/git/tag.js +101 -0
  169. package/dist/git/tag.js.map +1 -0
  170. package/dist/git/update-index.d.ts +11 -0
  171. package/dist/git/update-index.js +99 -0
  172. package/dist/git/update-index.js.map +1 -0
  173. package/dist/git/update-ref.d.ts +23 -0
  174. package/{src/git/update-ref.ts → dist/git/update-ref.js} +10 -28
  175. package/dist/git/update-ref.js.map +1 -0
  176. package/dist/git/var.d.ts +18 -0
  177. package/{src/git/var.ts → dist/git/var.js} +16 -25
  178. package/dist/git/var.js.map +1 -0
  179. package/dist/git/worktree-include.d.ts +42 -0
  180. package/dist/git/worktree-include.js +109 -0
  181. package/dist/git/worktree-include.js.map +1 -0
  182. package/dist/git/worktree.d.ts +25 -0
  183. package/dist/git/worktree.js +139 -0
  184. package/dist/git/worktree.js.map +1 -0
  185. package/dist/index.d.ts +4 -0
  186. package/dist/index.js +7 -0
  187. package/dist/index.js.map +1 -0
  188. package/dist/lib/api.d.ts +2 -0
  189. package/dist/lib/api.js +7 -0
  190. package/dist/lib/api.js.map +1 -0
  191. package/dist/lib/diff-parser.d.ts +20 -0
  192. package/dist/lib/diff-parser.js +184 -0
  193. package/dist/lib/diff-parser.js.map +1 -0
  194. package/dist/lib/directory-exists.d.ts +1 -0
  195. package/dist/lib/directory-exists.js +11 -0
  196. package/dist/lib/directory-exists.js.map +1 -0
  197. package/dist/lib/errno-exception.d.ts +6 -0
  198. package/dist/lib/errno-exception.js +6 -0
  199. package/dist/lib/errno-exception.js.map +1 -0
  200. package/dist/lib/fatal-error.d.ts +4 -0
  201. package/dist/lib/fatal-error.js +18 -0
  202. package/dist/lib/fatal-error.js.map +1 -0
  203. package/dist/lib/feature-flag.d.ts +14 -0
  204. package/dist/lib/feature-flag.js +25 -0
  205. package/dist/lib/feature-flag.js.map +1 -0
  206. package/dist/lib/file-system.d.ts +1 -0
  207. package/dist/lib/file-system.js +7 -0
  208. package/dist/lib/file-system.js.map +1 -0
  209. package/dist/lib/get-old-path.d.ts +2 -0
  210. package/dist/lib/get-old-path.js +9 -0
  211. package/dist/lib/get-old-path.js.map +1 -0
  212. package/dist/lib/git/environment.d.ts +3 -0
  213. package/dist/lib/git/environment.js +7 -0
  214. package/dist/lib/git/environment.js.map +1 -0
  215. package/dist/lib/git-perf.d.ts +1 -0
  216. package/dist/lib/git-perf.js +4 -0
  217. package/dist/lib/git-perf.js.map +1 -0
  218. package/dist/lib/helpers/default-branch.d.ts +1 -0
  219. package/dist/lib/helpers/default-branch.js +4 -0
  220. package/dist/lib/helpers/default-branch.js.map +1 -0
  221. package/dist/lib/helpers/path.d.ts +1 -0
  222. package/dist/lib/helpers/path.js +5 -0
  223. package/dist/lib/helpers/path.js.map +1 -0
  224. package/dist/lib/hooks/with-hooks-env.d.ts +3 -0
  225. package/dist/lib/hooks/with-hooks-env.js +4 -0
  226. package/dist/lib/hooks/with-hooks-env.js.map +1 -0
  227. package/dist/lib/merge.d.ts +1 -0
  228. package/dist/lib/merge.js +4 -0
  229. package/dist/lib/merge.js.map +1 -0
  230. package/dist/lib/noop.d.ts +1 -0
  231. package/dist/lib/noop.js +2 -0
  232. package/dist/lib/noop.js.map +1 -0
  233. package/dist/lib/patch-formatter.d.ts +5 -0
  234. package/dist/lib/patch-formatter.js +7 -0
  235. package/dist/lib/patch-formatter.js.map +1 -0
  236. package/dist/lib/path-exists.d.ts +1 -0
  237. package/dist/lib/path-exists.js +3 -0
  238. package/dist/lib/path-exists.js.map +1 -0
  239. package/dist/lib/progress/from-process.d.ts +2 -0
  240. package/dist/lib/progress/from-process.js +4 -0
  241. package/dist/lib/progress/from-process.js.map +1 -0
  242. package/dist/lib/progress/index.d.ts +49 -0
  243. package/dist/lib/progress/index.js +32 -0
  244. package/dist/lib/progress/index.js.map +1 -0
  245. package/dist/lib/progress/revert.d.ts +8 -0
  246. package/dist/lib/progress/revert.js +15 -0
  247. package/dist/lib/progress/revert.js.map +1 -0
  248. package/dist/lib/rebase.d.ts +1 -0
  249. package/dist/lib/rebase.js +4 -0
  250. package/dist/lib/rebase.js.map +1 -0
  251. package/dist/lib/remove-remote-prefix.d.ts +1 -0
  252. package/dist/lib/remove-remote-prefix.js +5 -0
  253. package/dist/lib/remove-remote-prefix.js.map +1 -0
  254. package/dist/lib/resolve-git-proxy.d.ts +1 -0
  255. package/dist/lib/resolve-git-proxy.js +4 -0
  256. package/dist/lib/resolve-git-proxy.js.map +1 -0
  257. package/dist/lib/round.d.ts +1 -0
  258. package/dist/lib/round.js +5 -0
  259. package/dist/lib/round.js.map +1 -0
  260. package/dist/lib/split-buffer.d.ts +1 -0
  261. package/dist/lib/split-buffer.js +15 -0
  262. package/dist/lib/split-buffer.js.map +1 -0
  263. package/dist/lib/status-parser.d.ts +19 -0
  264. package/dist/lib/status-parser.js +125 -0
  265. package/dist/lib/status-parser.js.map +1 -0
  266. package/dist/lib/stores/helpers/find-default-remote.d.ts +1 -0
  267. package/dist/lib/stores/helpers/find-default-remote.js +4 -0
  268. package/dist/lib/stores/helpers/find-default-remote.js.map +1 -0
  269. package/dist/lib/trampoline/trampoline-environment.d.ts +1 -0
  270. package/dist/lib/trampoline/trampoline-environment.js +4 -0
  271. package/dist/lib/trampoline/trampoline-environment.js.map +1 -0
  272. package/dist/models/branch.d.ts +44 -0
  273. package/dist/models/branch.js +59 -0
  274. package/dist/models/branch.js.map +1 -0
  275. package/dist/models/cherry-pick.d.ts +11 -0
  276. package/dist/models/cherry-pick.js +2 -0
  277. package/dist/models/cherry-pick.js.map +1 -0
  278. package/dist/models/clone-options.d.ts +6 -0
  279. package/dist/models/clone-options.js +2 -0
  280. package/dist/models/clone-options.js.map +1 -0
  281. package/dist/models/commit-identity.d.ts +9 -0
  282. package/dist/models/commit-identity.js +34 -0
  283. package/dist/models/commit-identity.js.map +1 -0
  284. package/dist/models/commit.d.ts +30 -0
  285. package/dist/models/commit.js +32 -0
  286. package/dist/models/commit.js.map +1 -0
  287. package/dist/models/computed-action.d.ts +6 -0
  288. package/dist/models/computed-action.js +8 -0
  289. package/dist/models/computed-action.js.map +1 -0
  290. package/dist/models/diff/diff-data.d.ts +53 -0
  291. package/dist/models/diff/diff-data.js +19 -0
  292. package/dist/models/diff/diff-data.js.map +1 -0
  293. package/dist/models/diff/diff-line.d.ts +18 -0
  294. package/dist/models/diff/diff-line.js +33 -0
  295. package/dist/models/diff/diff-line.js.map +1 -0
  296. package/dist/models/diff/diff-selection.d.ts +22 -0
  297. package/dist/models/diff/diff-selection.js +127 -0
  298. package/dist/models/diff/diff-selection.js.map +1 -0
  299. package/dist/models/diff/image-diff.d.ts +6 -0
  300. package/dist/models/diff/image-diff.js +8 -0
  301. package/dist/models/diff/image-diff.js.map +1 -0
  302. package/dist/models/diff/image.d.ts +7 -0
  303. package/dist/models/diff/image.js +13 -0
  304. package/dist/models/diff/image.js.map +1 -0
  305. package/dist/models/diff/index.d.ts +6 -0
  306. package/dist/models/diff/index.js +7 -0
  307. package/dist/models/diff/index.js.map +1 -0
  308. package/dist/models/diff/raw-diff.d.ts +32 -0
  309. package/dist/models/diff/raw-diff.js +38 -0
  310. package/dist/models/diff/raw-diff.js.map +1 -0
  311. package/dist/models/git-author.d.ts +7 -0
  312. package/dist/models/git-author.js +18 -0
  313. package/dist/models/git-author.js.map +1 -0
  314. package/dist/models/index.d.ts +21 -0
  315. package/dist/models/index.js +20 -0
  316. package/dist/models/index.js.map +1 -0
  317. package/dist/models/manual-conflict-resolution.d.ts +4 -0
  318. package/dist/models/manual-conflict-resolution.js +6 -0
  319. package/dist/models/manual-conflict-resolution.js.map +1 -0
  320. package/dist/models/merge.d.ts +6 -0
  321. package/dist/models/merge.js +2 -0
  322. package/dist/models/merge.js.map +1 -0
  323. package/dist/models/multi-commit-operation.d.ts +6 -0
  324. package/dist/models/multi-commit-operation.js +8 -0
  325. package/dist/models/multi-commit-operation.js.map +1 -0
  326. package/dist/models/progress.d.ts +41 -0
  327. package/dist/models/progress.js +7 -0
  328. package/dist/models/progress.js.map +1 -0
  329. package/dist/models/rebase.d.ts +17 -0
  330. package/dist/models/rebase.js +8 -0
  331. package/dist/models/rebase.js.map +1 -0
  332. package/dist/models/remote.d.ts +5 -0
  333. package/dist/models/remote.js +8 -0
  334. package/dist/models/remote.js.map +1 -0
  335. package/dist/models/repository.d.ts +7 -0
  336. package/dist/models/repository.js +15 -0
  337. package/dist/models/repository.js.map +1 -0
  338. package/dist/models/stash-entry.d.ts +20 -0
  339. package/dist/models/stash-entry.js +7 -0
  340. package/dist/models/stash-entry.js.map +1 -0
  341. package/dist/models/status.d.ts +166 -0
  342. package/dist/models/status.js +135 -0
  343. package/dist/models/status.js.map +1 -0
  344. package/dist/models/submodule.d.ts +12 -0
  345. package/dist/models/submodule.js +2 -0
  346. package/dist/models/submodule.js.map +1 -0
  347. package/dist/models/worktree.d.ts +10 -0
  348. package/dist/models/worktree.js +2 -0
  349. package/dist/models/worktree.js.map +1 -0
  350. package/package.json +44 -5
  351. package/examples/get-status.ts +0 -84
  352. package/src/git/add.ts +0 -16
  353. package/src/git/apply.ts +0 -154
  354. package/src/git/authentication.ts +0 -19
  355. package/src/git/branch.ts +0 -206
  356. package/src/git/checkout.ts +0 -235
  357. package/src/git/cherry-pick.ts +0 -504
  358. package/src/git/clean.ts +0 -9
  359. package/src/git/clone.ts +0 -86
  360. package/src/git/coerce-to-buffer.ts +0 -4
  361. package/src/git/coerce-to-string.ts +0 -4
  362. package/src/git/commit.ts +0 -136
  363. package/src/git/config.ts +0 -392
  364. package/src/git/core.ts +0 -625
  365. package/src/git/create-tail-stream.ts +0 -36
  366. package/src/git/credential.ts +0 -83
  367. package/src/git/description.ts +0 -33
  368. package/src/git/diff-check.ts +0 -27
  369. package/src/git/diff-index.ts +0 -116
  370. package/src/git/diff.ts +0 -880
  371. package/src/git/environment.ts +0 -116
  372. package/src/git/exec.ts +0 -285
  373. package/src/git/fetch.ts +0 -141
  374. package/src/git/for-each-ref.ts +0 -160
  375. package/src/git/format-patch.ts +0 -17
  376. package/src/git/git-delimiter-parser.ts +0 -95
  377. package/src/git/gitignore.ts +0 -157
  378. package/src/git/index.ts +0 -36
  379. package/src/git/init.ts +0 -11
  380. package/src/git/lfs.ts +0 -100
  381. package/src/git/log.ts +0 -376
  382. package/src/git/merge-tree.ts +0 -42
  383. package/src/git/merge.ts +0 -154
  384. package/src/git/multi-operation-terminal-output.ts +0 -68
  385. package/src/git/pull.ts +0 -130
  386. package/src/git/push.ts +0 -119
  387. package/src/git/rebase.ts +0 -627
  388. package/src/git/reflog.ts +0 -127
  389. package/src/git/refs.ts +0 -63
  390. package/src/git/remote.ts +0 -143
  391. package/src/git/reorder.ts +0 -153
  392. package/src/git/reset.ts +0 -101
  393. package/src/git/rev-list.ts +0 -201
  394. package/src/git/rev-parse.ts +0 -92
  395. package/src/git/revert.ts +0 -55
  396. package/src/git/rm.ts +0 -31
  397. package/src/git/spawn.ts +0 -38
  398. package/src/git/squash.ts +0 -173
  399. package/src/git/stage.ts +0 -97
  400. package/src/git/stash.ts +0 -302
  401. package/src/git/status.ts +0 -502
  402. package/src/git/submodule.ts +0 -212
  403. package/src/git/tag.ts +0 -134
  404. package/src/git/update-index.ts +0 -169
  405. package/src/git/worktree-include.ts +0 -146
  406. package/src/git/worktree.ts +0 -219
  407. package/src/index.ts +0 -23
  408. package/src/lib/api.ts +0 -7
  409. package/src/lib/diff-parser.ts +0 -249
  410. package/src/lib/directory-exists.ts +0 -10
  411. package/src/lib/errno-exception.ts +0 -12
  412. package/src/lib/fatal-error.ts +0 -23
  413. package/src/lib/feature-flag.ts +0 -29
  414. package/src/lib/file-system.ts +0 -7
  415. package/src/lib/get-old-path.ts +0 -11
  416. package/src/lib/git/environment.ts +0 -14
  417. package/src/lib/git-perf.ts +0 -3
  418. package/src/lib/helpers/default-branch.ts +0 -3
  419. package/src/lib/helpers/path.ts +0 -5
  420. package/src/lib/hooks/with-hooks-env.ts +0 -7
  421. package/src/lib/merge.ts +0 -3
  422. package/src/lib/noop.ts +0 -1
  423. package/src/lib/patch-formatter.ts +0 -18
  424. package/src/lib/path-exists.ts +0 -7
  425. package/src/lib/progress/from-process.ts +0 -10
  426. package/src/lib/progress/index.ts +0 -43
  427. package/src/lib/progress/revert.ts +0 -17
  428. package/src/lib/rebase.ts +0 -3
  429. package/src/lib/remove-remote-prefix.ts +0 -4
  430. package/src/lib/resolve-git-proxy.ts +0 -3
  431. package/src/lib/round.ts +0 -4
  432. package/src/lib/split-buffer.ts +0 -14
  433. package/src/lib/status-parser.ts +0 -188
  434. package/src/lib/stores/helpers/find-default-remote.ts +0 -3
  435. package/src/lib/trampoline/trampoline-environment.ts +0 -8
  436. package/src/models/branch.ts +0 -78
  437. package/src/models/cherry-pick.ts +0 -12
  438. package/src/models/clone-options.ts +0 -6
  439. package/src/models/commit-identity.ts +0 -35
  440. package/src/models/commit.ts +0 -44
  441. package/src/models/computed-action.ts +0 -6
  442. package/src/models/diff/diff-data.ts +0 -78
  443. package/src/models/diff/diff-line.ts +0 -36
  444. package/src/models/diff/diff-selection.ts +0 -165
  445. package/src/models/diff/image-diff.ts +0 -6
  446. package/src/models/diff/image.ts +0 -8
  447. package/src/models/diff/index.ts +0 -6
  448. package/src/models/diff/raw-diff.ts +0 -41
  449. package/src/models/git-author.ts +0 -16
  450. package/src/models/manual-conflict-resolution.ts +0 -4
  451. package/src/models/merge.ts +0 -6
  452. package/src/models/multi-commit-operation.ts +0 -6
  453. package/src/models/progress.ts +0 -67
  454. package/src/models/rebase.ts +0 -20
  455. package/src/models/remote.ts +0 -10
  456. package/src/models/repository.ts +0 -16
  457. package/src/models/stash-entry.ts +0 -25
  458. package/src/models/status.ts +0 -275
  459. package/src/models/submodule.ts +0 -13
  460. package/src/models/worktree.ts +0 -11
  461. package/tsconfig.json +0 -17
@@ -1,504 +0,0 @@
1
- import { GitError } from './exec'
2
- import { Repository } from '../models/repository'
3
- import {
4
- AppFileStatusKind,
5
- WorkingDirectoryFileChange,
6
- } from '../models/status'
7
- import {
8
- git,
9
- IGitExecutionOptions,
10
- IGitResult,
11
- IGitStringExecutionOptions,
12
- } from './core'
13
- import { getStatus } from './status'
14
- import { stageFiles } from './update-index'
15
- import { getCommitsInRange, revRange } from './rev-list'
16
- import { CommitOneLine } from '../models/commit'
17
- import { merge } from '../lib/merge'
18
- import { ChildProcess } from 'child_process'
19
- import { round } from '../lib/round'
20
- import byline from 'byline'
21
- import { ICherryPickSnapshot } from '../models/cherry-pick'
22
- import { ManualConflictResolution } from '../models/manual-conflict-resolution'
23
- import { stageManualConflictResolution } from './stage'
24
- import { getCommit } from '.'
25
- import { IMultiCommitOperationProgress } from '../models/progress'
26
- import { join } from 'path'
27
- import { readFile } from 'fs/promises'
28
- import { pathExists } from '../lib/path-exists'
29
-
30
- /** The app-specific results from attempting to cherry pick commits*/
31
- export enum CherryPickResult {
32
- /**
33
- * Git completed the cherry pick without reporting any errors, and the caller can
34
- * signal success to the user.
35
- */
36
- CompletedWithoutError = 'CompletedWithoutError',
37
- /**
38
- * The cherry pick encountered conflicts while attempting to cherry pick and
39
- * need to be resolved before the user can continue.
40
- */
41
- ConflictsEncountered = 'ConflictsEncountered',
42
- /**
43
- * The cherry pick was not able to continue as tracked files were not staged in
44
- * the index.
45
- */
46
- OutstandingFilesNotStaged = 'OutstandingFilesNotStaged',
47
- /**
48
- * The cherry pick was not attempted:
49
- * - it could not check the status of the repository.
50
- * - there was an invalid revision range provided.
51
- * - there were uncommitted changes present.
52
- * - there were errors in checkout the target branch
53
- */
54
- UnableToStart = 'UnableToStart',
55
- /**
56
- * An unexpected error as part of the cherry pick flow was caught and handled.
57
- *
58
- * Check the logs to find the relevant Git details.
59
- */
60
- Error = 'Error',
61
- }
62
-
63
- /**
64
- * A parser to read and emit cherry pick progress from Git `stdout`.
65
- *
66
- * Each successful cherry picked commit outputs a set of lines similar to the
67
- * following example:
68
- * [branchName commitSha] commitSummary
69
- * Date: timestamp
70
- * 1 file changed, 1 insertion(+)
71
- * create mode 100644 filename
72
- */
73
- class GitCherryPickParser {
74
- public constructor(
75
- private readonly commits: ReadonlyArray<CommitOneLine>,
76
- private count: number = 0
77
- ) {}
78
-
79
- public parse(line: string): IMultiCommitOperationProgress | null {
80
- const cherryPickRe = /^\[(.*\s.*)\]/
81
- const match = cherryPickRe.exec(line)
82
- if (match === null) {
83
- // Skip lines that don't represent the first line of a successfully picked
84
- // commit. -- i.e. timestamp, files changed, conflicts, etc..
85
- return null
86
- }
87
- this.count++
88
-
89
- return {
90
- kind: 'multiCommitOperation',
91
- value: round(this.count / this.commits.length, 2),
92
- position: this.count,
93
- totalCommitCount: this.commits.length,
94
- currentCommitSummary: this.commits[this.count - 1]?.summary ?? '',
95
- }
96
- }
97
- }
98
-
99
- /**
100
- * This method merges `baseOptions` with a call back method that obtains a
101
- * `ICherryPickProgress` instance from `stdout` parsing.
102
- *
103
- * @param baseOptions - contains git execution options other than the
104
- * progressCallBack such as expectedErrors
105
- * @param commits - used by the parser to form `ICherryPickProgress` instance
106
- * @param progressCallback - the callback method that accepts an
107
- * `ICherryPickProgress` instance created by the parser
108
- */
109
- function configureOptionsWithCallBack<T extends IGitExecutionOptions>(
110
- baseOptions: T,
111
- commits: readonly CommitOneLine[],
112
- progressCallback: (progress: IMultiCommitOperationProgress) => void,
113
- cherryPickedCount: number = 0
114
- ) {
115
- return merge(baseOptions, {
116
- processCallback: (process: ChildProcess) => {
117
- if (process.stdout === null) {
118
- return
119
- }
120
- const parser = new GitCherryPickParser(commits, cherryPickedCount)
121
-
122
- byline(process.stdout).on('data', (line: string) => {
123
- const progress = parser.parse(line)
124
-
125
- if (progress != null) {
126
- progressCallback(progress)
127
- }
128
- })
129
- },
130
- })
131
- }
132
-
133
- /**
134
- * A function to initiate cherry picking in the app.
135
- *
136
- * @param commits - array of commits to cherry-pick
137
- * For a cherry-pick operation, it does not matter what order the commits
138
- * appear. But, it is best practice to send them in ascending order to prevent
139
- * conflicts. First one on the array is first to be cherry-picked.
140
- */
141
- export async function cherryPick(
142
- repository: Repository,
143
- commits: ReadonlyArray<CommitOneLine>,
144
- progressCallback?: (progress: IMultiCommitOperationProgress) => void
145
- ): Promise<CherryPickResult> {
146
- if (commits.length === 0) {
147
- return CherryPickResult.UnableToStart
148
- }
149
-
150
- let baseOptions: IGitStringExecutionOptions = {
151
- expectedErrors: new Set([
152
- GitError.MergeConflicts,
153
- GitError.ConflictModifyDeletedInBranch,
154
- ]),
155
- }
156
-
157
- if (progressCallback !== undefined) {
158
- baseOptions = await configureOptionsWithCallBack(
159
- baseOptions,
160
- commits,
161
- progressCallback
162
- )
163
- }
164
-
165
- // --empty=keep follows pattern of making sure someone cherry
166
- // picked commit summaries appear in target branch history even tho they may
167
- // be empty. This flag also results in the ability to cherry pick empty
168
- // commits (thus, --allow-empty is not required.)
169
- //
170
- // -m 1 makes it so a merge commit always takes the first parent's history
171
- // (the branch you are cherry-picking from) for the commit. It also means
172
- // there could be multiple empty commits. I.E. If user does a range that
173
- // includes commits from that merge.
174
- const result = await git(
175
- ['cherry-pick', ...commits.map(c => c.sha), '--empty=keep', '-m 1'],
176
- repository.path,
177
- 'cherry-pick',
178
- baseOptions
179
- )
180
-
181
- return parseCherryPickResult(result)
182
- }
183
-
184
- function parseCherryPickResult(result: IGitResult): CherryPickResult {
185
- if (result.exitCode === 0) {
186
- return CherryPickResult.CompletedWithoutError
187
- }
188
-
189
- switch (result.gitError) {
190
- case GitError.ConflictModifyDeletedInBranch:
191
- case GitError.MergeConflicts:
192
- return CherryPickResult.ConflictsEncountered
193
- case GitError.UnresolvedConflicts:
194
- return CherryPickResult.OutstandingFilesNotStaged
195
- default:
196
- throw new Error(`Unhandled result found: '${JSON.stringify(result)}'`)
197
- }
198
- }
199
-
200
- /**
201
- * Inspect the `.git/sequencer` folder and convert the current cherry pick
202
- * state into am `ICherryPickProgress` instance as well as return an array of
203
- * remaining commits queued for cherry picking.
204
- * - Progress instance required to display progress to user.
205
- * - Commits required to track progress after a conflict has been resolved.
206
- *
207
- * This is required when Desktop is not responsible for initiating the cherry
208
- * pick and when continuing a cherry pick after conflicts are resolved:
209
- *
210
- * It returns null if it cannot parse an ongoing cherry pick. This happens when,
211
- * - There isn't a cherry pick in progress (expected null outcome).
212
- * - Runs into errors parsing cherry pick files. This is expected if cherry
213
- * pick is aborted or finished during parsing. It could also occur if cherry
214
- * pick sequencer files are corrupted.
215
- */
216
- export async function getCherryPickSnapshot(
217
- repository: Repository
218
- ): Promise<ICherryPickSnapshot | null> {
219
- if (!isCherryPickHeadFound(repository)) {
220
- // If there no cherry pick head, there is no cherry pick in progress.
221
- return null
222
- }
223
-
224
- // Abort safety sha is stored in.git/sequencer/abort-safety. It is the sha of
225
- // the last cherry-picked commit in the operation or the head of target branch
226
- // if no commits have been cherry-picked yet.
227
- let abortSafetySha: string = ''
228
-
229
- // The head sha is stored in .git/sequencer/head. It is the sha of target
230
- // branch before the cherry-pick operation occurred.
231
- let headSha: string = ''
232
-
233
- // Each line of .git/sequencer/todo holds a sha of a commit lined up to be
234
- // cherry-picked. These shas are in historical order starting oldest commit as
235
- // the first line and newest as the last line.
236
- const remainingCommits: CommitOneLine[] = []
237
-
238
- // Try block included as files may throw an error if it cannot locate
239
- // the sequencer files. This is possible if cherry pick is continued
240
- // or aborted at the same time.
241
- try {
242
- abortSafetySha = (
243
- await readFile(
244
- join(repository.resolvedGitDir, 'sequencer', 'abort-safety'),
245
- 'utf8'
246
- )
247
- ).trim()
248
-
249
- if (abortSafetySha === '') {
250
- // Technically possible if someone continued or aborted the cherry pick at
251
- // the same time
252
- return null
253
- }
254
-
255
- headSha = (
256
- await readFile(
257
- join(repository.resolvedGitDir, 'sequencer', 'head'),
258
- 'utf8'
259
- )
260
- ).trim()
261
-
262
- if (headSha === '') {
263
- // Technically possible if someone continued or aborted the cherry pick at
264
- // the same time
265
- return null
266
- }
267
-
268
- const remainingPicks = (
269
- await readFile(
270
- join(repository.resolvedGitDir, 'sequencer', 'todo'),
271
- 'utf8'
272
- )
273
- ).trim()
274
-
275
- if (remainingPicks === '') {
276
- // Technically possible if someone continued or aborted the cherry pick at
277
- // the same time
278
- return null
279
- }
280
-
281
- // Each line is of the format: `pick shortSha commitSummary`
282
- remainingPicks.split('\n').forEach(line => {
283
- line = line.replace(/^pick /, '')
284
- if (line.trim().includes(' ')) {
285
- const sha = line.substr(0, line.indexOf(' '))
286
- const commit: CommitOneLine = {
287
- sha,
288
- summary: line.substr(sha.length + 1),
289
- }
290
- remainingCommits.push(commit)
291
- }
292
- })
293
-
294
- if (remainingCommits.length === 0) {
295
- // This should only be possible with corrupt sequencer files.
296
- return null
297
- }
298
- } catch {
299
- // could not parse sequencer files
300
-
301
- if (!isCherryPickHeadFound(repository)) {
302
- // We redo this check just because a user technically could end the
303
- // cherry-pick by the time we got here.
304
- return null
305
- }
306
-
307
- // If cherry-pick is in progress, then there was only one commit cherry-picked
308
- // thus sequencer files were not used.
309
- const cherryPickHeadSha = (
310
- await readFile(
311
- join(repository.resolvedGitDir, 'CHERRY_PICK_HEAD'),
312
- 'utf8'
313
- )
314
- ).trim()
315
- const commit = await getCommit(repository, cherryPickHeadSha)
316
- if (commit === null) {
317
- return null
318
- }
319
-
320
- return {
321
- sha: commit.sha,
322
- parentCount: 1,
323
- progress: {
324
- kind: 'multiCommitOperation',
325
- value: 1,
326
- position: 1,
327
- totalCommitCount: 1,
328
- currentCommitSummary: commit.summary,
329
- },
330
- remainingCommits: [],
331
- commits: [{ sha: commit.sha, summary: commit.summary }],
332
- targetBranchUndoSha: headSha,
333
- cherryPickedCount: 0,
334
- }
335
- }
336
-
337
- // To get all the commits for the cherry-pick operation, we need to get the
338
- // ones already cherry-picked. If abortSafetySha is headSha; none have been
339
- // cherry-picked yet.
340
- const commitsCherryPicked =
341
- abortSafetySha !== headSha
342
- ? await getCommitsInRange(repository, revRange(headSha, abortSafetySha))
343
- : []
344
-
345
- if (commitsCherryPicked === null) {
346
- // This should only be possible with corrupt sequencer files resulting in a
347
- // bad revision range.
348
- return null
349
- }
350
-
351
- const commits = [...commitsCherryPicked, ...remainingCommits]
352
- const position = commitsCherryPicked.length + 1
353
-
354
- const sha = remainingCommits[0]?.sha ?? ''
355
- return {
356
- sha,
357
- parentCount: commits.length,
358
- progress: {
359
- kind: 'multiCommitOperation',
360
- value: round(position / commits.length, 2),
361
- position,
362
- totalCommitCount: commits.length,
363
- currentCommitSummary: remainingCommits[0].summary ?? '',
364
- },
365
- remainingCommits,
366
- commits,
367
- targetBranchUndoSha: headSha,
368
- cherryPickedCount: commitsCherryPicked.length,
369
- }
370
- }
371
-
372
- /**
373
- * Proceed with the current cherry pick operation and report back on whether it completed
374
- *
375
- * It is expected that the index has staged files which are cleanly cherry
376
- * picked onto the base branch, and the remaining unstaged files are those which
377
- * need manual resolution or were changed by the user to address inline
378
- * conflicts.
379
- *
380
- * @param files - The working directory of files. These are the files that are
381
- * detected to have changes that we want to stage for the cherry pick.
382
- */
383
- export async function continueCherryPick(
384
- repository: Repository,
385
- files: ReadonlyArray<WorkingDirectoryFileChange>,
386
- manualResolutions: ReadonlyMap<string, ManualConflictResolution> = new Map(),
387
- progressCallback?: (progress: IMultiCommitOperationProgress) => void
388
- ): Promise<CherryPickResult> {
389
- // only stage files related to cherry pick
390
- const trackedFiles = files.filter(f => {
391
- return f.status.kind !== AppFileStatusKind.Untracked
392
- })
393
-
394
- // apply conflict resolutions
395
- for (const [path, resolution] of manualResolutions) {
396
- const file = files.find(f => f.path === path)
397
- if (file === undefined) {
398
- console.error(
399
- `[continueCherryPick] couldn't find file ${path} even though there's a manual resolution for it`
400
- )
401
- continue
402
- }
403
- await stageManualConflictResolution(repository, file, resolution)
404
- }
405
-
406
- const otherFiles = trackedFiles.filter(f => !manualResolutions.has(f.path))
407
- await stageFiles(repository, otherFiles)
408
-
409
- const status = await getStatus(repository, false)
410
- if (status == null) {
411
- console.warn(
412
- `[continueCherryPick] unable to get status after staging changes,
413
- skipping any other steps`
414
- )
415
- return CherryPickResult.UnableToStart
416
- }
417
-
418
- // make sure cherry pick is still in progress to continue
419
- if (await !isCherryPickHeadFound(repository)) {
420
- return CherryPickResult.UnableToStart
421
- }
422
-
423
- let options: IGitStringExecutionOptions = {
424
- expectedErrors: new Set([
425
- GitError.MergeConflicts,
426
- GitError.ConflictModifyDeletedInBranch,
427
- GitError.UnresolvedConflicts,
428
- ]),
429
- env: {
430
- // if we don't provide editor, we can't detect git errors
431
- GIT_EDITOR: ':',
432
- },
433
- }
434
-
435
- if (progressCallback !== undefined) {
436
- const snapshot = await getCherryPickSnapshot(repository)
437
- if (snapshot === null) {
438
- console.warn(
439
- `[continueCherryPick] unable to get cherry-pick status, skipping other steps`
440
- )
441
- return CherryPickResult.UnableToStart
442
- }
443
-
444
- options = configureOptionsWithCallBack(
445
- options,
446
- snapshot.commits,
447
- progressCallback,
448
- snapshot.cherryPickedCount
449
- )
450
- }
451
-
452
- const trackedFilesAfter = status.workingDirectory.files.filter(
453
- f => f.status.kind !== AppFileStatusKind.Untracked
454
- )
455
-
456
- if (trackedFilesAfter.length === 0) {
457
- console.warn(
458
- `[cherryPick] no tracked changes to commit, continuing cherry-pick but skipping this commit`
459
- )
460
-
461
- // This commits the empty commit so that the cherry picked commit still
462
- // shows up in the target branches history.
463
- const result = await git(
464
- ['commit', '--allow-empty'],
465
- repository.path,
466
- 'continueCherryPickSkipCurrentCommit',
467
- options
468
- )
469
-
470
- return parseCherryPickResult(result)
471
- }
472
-
473
- const result = await git(
474
- ['cherry-pick', '--continue'],
475
- repository.path,
476
- 'continueCherryPick',
477
- options
478
- )
479
-
480
- return parseCherryPickResult(result)
481
- }
482
-
483
- /** Abandon the current cherry pick operation */
484
- export async function abortCherryPick(repository: Repository) {
485
- await git(['cherry-pick', '--abort'], repository.path, 'abortCherryPick')
486
- }
487
-
488
- /**
489
- * Check if the `.git/CHERRY_PICK_HEAD` file exists
490
- */
491
- export async function isCherryPickHeadFound(
492
- repository: Repository
493
- ): Promise<boolean> {
494
- try {
495
- return pathExists(join(repository.resolvedGitDir, 'CHERRY_PICK_HEAD'))
496
- } catch (err) {
497
- console.warn(
498
- `[cherryPick] a problem was encountered reading .git/CHERRY_PICK_HEAD,
499
- so it is unsafe to continue cherry-picking`,
500
- err
501
- )
502
- return false
503
- }
504
- }
package/src/git/clean.ts DELETED
@@ -1,9 +0,0 @@
1
- import { git } from './core'
2
- import { Repository } from '../models/repository'
3
-
4
- /**
5
- * Clean untracked files from the repository.
6
- */
7
- export async function cleanUntrackedFiles(repository: Repository) {
8
- await git(['clean', '-d', '--force'], repository.path, 'cleanUntrackedFiles')
9
- }
package/src/git/clone.ts DELETED
@@ -1,86 +0,0 @@
1
- import { git, IGitStringExecutionOptions } from './core'
2
- import { ICloneProgress } from '../models/progress'
3
- import { CloneOptions } from '../models/clone-options'
4
- import { CloneProgressParser, executionOptionsWithProgress } from '../lib/progress'
5
- import { getDefaultBranch } from '../lib/helpers/default-branch'
6
- import { envForRemoteOperation } from './environment'
7
-
8
- /**
9
- * Clones a repository from a given url into to the specified path.
10
- *
11
- * @param url - The remote repository URL to clone from
12
- *
13
- * @param path - The destination path for the cloned repository. If the
14
- * path does not exist it will be created. Cloning into an
15
- * existing directory is only allowed if the directory is
16
- * empty.
17
- *
18
- * @param options - Options specific to the clone operation, see the
19
- * documentation for CloneOptions for more details.
20
- *
21
- * @param progressCallback - An optional function which will be invoked
22
- * with information about the current progress
23
- * of the clone operation. When provided this enables
24
- * the '--progress' command line flag for
25
- * 'git clone'.
26
- */
27
- export async function clone(
28
- url: string,
29
- path: string,
30
- options: CloneOptions,
31
- login: string | null,
32
- progressCallback?: (progress: ICloneProgress) => void
33
- ): Promise<void> {
34
- const env = {
35
- ...(await envForRemoteOperation(url)),
36
- GIT_CLONE_PROTECTION_ACTIVE: 'false',
37
- }
38
-
39
- const remoteUrl = login
40
- ? url.replace(
41
- /^((?:https|http|git+ssh|git|ssh|file)?:\/\/)/i,
42
- '$1' + login + '@'
43
- )
44
- : url
45
-
46
- const defaultBranch = options.defaultBranch ?? (await getDefaultBranch())
47
-
48
- const args = [
49
- '-c',
50
- `init.defaultBranch=${defaultBranch}`,
51
- 'clone',
52
- '--recursive',
53
- ]
54
-
55
- let opts: IGitStringExecutionOptions = { env }
56
-
57
- if (progressCallback) {
58
- args.push('--progress')
59
-
60
- const title = `Cloning into ${path}`
61
- const kind = 'clone'
62
-
63
- opts = await executionOptionsWithProgress(
64
- { ...opts, trackLFSProgress: true },
65
- new CloneProgressParser(),
66
- progress => {
67
- const description =
68
- progress.kind === 'progress' ? progress.details.text : progress.text
69
- const value = progress.percent
70
-
71
- progressCallback({ kind, title, description, value })
72
- }
73
- )
74
-
75
- // Initial progress
76
- progressCallback({ kind, title, value: 0 })
77
- }
78
-
79
- if (options.branch) {
80
- args.push('-b', options.branch)
81
- }
82
-
83
- args.push('--', remoteUrl, path)
84
-
85
- await git(args, __dirname, 'clone', opts)
86
- }
@@ -1,4 +0,0 @@
1
- export const coerceToBuffer = (
2
- value: string | Buffer,
3
- encoding: BufferEncoding = 'utf8'
4
- ) => (Buffer.isBuffer(value) ? value : Buffer.from(value, encoding))
@@ -1,4 +0,0 @@
1
- export const coerceToString = (
2
- value: string | Buffer,
3
- encoding: BufferEncoding = 'utf8'
4
- ) => (Buffer.isBuffer(value) ? value.toString(encoding) : value)