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
package/src/git/core.ts DELETED
@@ -1,625 +0,0 @@
1
- import {
2
- exec,
3
- GitError as DugiteError,
4
- parseError,
5
- parseBadConfigValueErrorInfo,
6
- ExecError,
7
- } from './exec'
8
-
9
- import { assertNever } from '../lib/fatal-error'
10
- import * as GitPerf from '../lib/git-perf'
11
- import * as Path from 'path'
12
- import { isErrnoException } from '../lib/errno-exception'
13
- import { withTrampolineEnv } from '../lib/trampoline/trampoline-environment'
14
- import { kStringMaxLength } from 'buffer'
15
- import { withHooksEnv } from '../lib/hooks/with-hooks-env'
16
- import { coerceToString } from './coerce-to-string'
17
- import { pushTerminalChunk } from './push-terminal-chunk'
18
-
19
- export const isMaxBufferExceededError = (
20
- error: unknown
21
- ): error is ExecError & { code: 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER' } => {
22
- return (
23
- error instanceof ExecError &&
24
- error.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER'
25
- )
26
- }
27
-
28
- export type TerminalOutput = string | Buffer | Buffer[]
29
-
30
- export type TerminalOutputListener = (cb: (chunk: TerminalOutput) => void) => {
31
- unsubscribe: () => void
32
- }
33
-
34
- export type TerminalOutputCallback = (subscribe: TerminalOutputListener) => void
35
-
36
- export type HookProgress = {
37
- readonly hookName: string
38
- } & (
39
- | {
40
- readonly status: 'started'
41
- readonly abort: () => void
42
- }
43
- | {
44
- readonly status: 'finished' | 'failed'
45
- }
46
- )
47
-
48
- export type HookCallbackOptions = {
49
- readonly onHookProgress?: (progress: HookProgress) => void
50
- readonly onHookFailure?: (
51
- hookName: string,
52
- terminalOutput: TerminalOutput
53
- ) => Promise<'abort' | 'ignore'>
54
- readonly onTerminalOutputAvailable?: TerminalOutputCallback
55
- }
56
-
57
- /**
58
- * An extension of the execution options in dugite that
59
- * allows us to piggy-back our own configuration options in the
60
- * same object.
61
- */
62
- export interface IGitExecutionOptions
63
- extends HookCallbackOptions {
64
- readonly env?: Record<string, string | undefined>
65
- readonly stdin?: string
66
- readonly maxBuffer?: number
67
- readonly processCallback?: (process: any) => void
68
- readonly encoding?: BufferEncoding
69
- /**
70
- * The exit codes which indicate success to the
71
- * caller. Unexpected exit codes will be logged and an
72
- * error thrown. Defaults to 0 if undefined.
73
- */
74
- readonly successExitCodes?: ReadonlySet<number>
75
-
76
- /**
77
- * The git errors which are expected by the caller. Unexpected errors will
78
- * be logged and an error thrown.
79
- */
80
- readonly expectedErrors?: ReadonlySet<DugiteError>
81
-
82
- /** Should it track & report LFS progress? */
83
- readonly trackLFSProgress?: boolean
84
-
85
- /**
86
- * Whether the command about to run is part of a background task or not.
87
- * This affects error handling and UI such as credential prompts.
88
- */
89
- readonly isBackgroundTask?: boolean
90
-
91
- readonly interceptHooks?: string[]
92
- }
93
-
94
- /**
95
- * The result of using `git`. This wraps dugite's results to provide
96
- * the parsed error if one occurs.
97
- */
98
- export interface IGitResult {
99
- readonly stdout: string
100
- readonly stderr: string
101
- readonly exitCode: number
102
- /**
103
- * The parsed git error. This will be null when the exit code is included in
104
- * the `successExitCodes`, or when dugite was unable to parse the
105
- * error.
106
- */
107
- readonly gitError: DugiteError | null
108
-
109
- /** The human-readable error description, based on `gitError`. */
110
- readonly gitErrorDescription: string | null
111
-
112
- /**
113
- * The path that the Git command was executed from, i.e. the
114
- * process working directory (not to be confused with the Git
115
- * working directory which is... super confusing, I know)
116
- */
117
- readonly path: string
118
- }
119
-
120
- /** The result of shelling out to git using a string encoding (default) */
121
- export interface IGitStringResult extends IGitResult {
122
- /** The standard output from git. */
123
- readonly stdout: string
124
-
125
- /** The standard error output from git. */
126
- readonly stderr: string
127
- }
128
-
129
- export interface IGitStringExecutionOptions extends IGitExecutionOptions {
130
- readonly encoding?: BufferEncoding
131
- }
132
-
133
- export interface IGitBufferExecutionOptions extends Omit<IGitExecutionOptions, 'encoding'> {
134
- readonly encoding: 'buffer'
135
- }
136
-
137
- /** The result of shelling out to git using a buffer encoding */
138
- export interface IGitBufferResult extends Omit<IGitResult, 'stdout' | 'stderr'> {
139
- /** The standard output from git. */
140
- readonly stdout: Buffer
141
-
142
- /** The standard error output from git. */
143
- readonly stderr: Buffer
144
- }
145
-
146
- // Re-declare IGitResult with all properties needed
147
- export interface IGitFullResult extends IGitResult {
148
- readonly stdout: string
149
- readonly stderr: string
150
- readonly exitCode: number
151
- readonly gitError: DugiteError | null
152
- readonly gitErrorDescription: string | null
153
- readonly path: string
154
- }
155
-
156
- export class GitError extends Error {
157
- /** The result from the failed command. */
158
- public readonly result: IGitResult
159
-
160
- /** The args for the failed command. */
161
- public readonly args: ReadonlyArray<string>
162
-
163
- /**
164
- * Whether or not the error message is just the raw output of the git command.
165
- */
166
- public readonly isRawMessage: boolean
167
-
168
- public constructor(
169
- result: IGitResult,
170
- args: ReadonlyArray<string>,
171
- terminalOutput: string
172
- ) {
173
- let rawMessage = true
174
- let message
175
-
176
- if (result.gitErrorDescription) {
177
- message = `${result.path}: ${result.gitErrorDescription}`
178
- rawMessage = false
179
- } else if (terminalOutput.length > 0) {
180
- message = terminalOutput
181
- } else if (result.stderr.length) {
182
- message = coerceToString(result.stderr)
183
- } else if (result.stdout.length) {
184
- message = coerceToString(result.stdout)
185
- } else {
186
- message = `Unknown error (exit code ${result.exitCode})`
187
- rawMessage = false
188
- }
189
-
190
- super(message)
191
-
192
- this.name = 'GitError'
193
- this.result = result
194
- this.args = args
195
- this.isRawMessage = rawMessage
196
- }
197
- }
198
-
199
- export const isGitError = (
200
- e: unknown,
201
- parsedError?: DugiteError
202
- ): e is GitError => {
203
- return (
204
- e instanceof GitError &&
205
- (parsedError === undefined || e.result.gitError === parsedError)
206
- )
207
- }
208
-
209
- /**
210
- * Shell out to git with the given arguments, at the given path.
211
- *
212
- * @param args The arguments to pass to `git`.
213
- *
214
- * @param path The working directory path for the execution of the
215
- * command.
216
- *
217
- * @param name The name for the command based on its caller's
218
- * context. This will be used for performance
219
- * measurements and debugging.
220
- *
221
- * @param options Configuration options for the execution of git,
222
- * see IGitExecutionOptions for more information.
223
- *
224
- * Returns the result. If the command exits with a code not in
225
- * `successExitCodes` or an error not in `expectedErrors`, a `GitError` will be
226
- * thrown.
227
- */
228
- export async function git(
229
- args: string[],
230
- path: string,
231
- name: string,
232
- options?: IGitStringExecutionOptions
233
- ): Promise<IGitStringResult>
234
- export async function git(
235
- args: string[],
236
- path: string,
237
- name: string,
238
- options?: IGitBufferExecutionOptions
239
- ): Promise<IGitBufferResult>
240
- export async function git(
241
- args: string[],
242
- path: string,
243
- name: string,
244
- options?: any
245
- ): Promise<any> {
246
- const defaultOptions: IGitExecutionOptions = {
247
- successExitCodes: new Set([0]),
248
- expectedErrors: new Set(),
249
- maxBuffer: (options as any)?.encoding === 'buffer' ? Infinity : kStringMaxLength,
250
- }
251
-
252
- const opts = { ...defaultOptions, ...options }
253
-
254
- // The combined contents of stdout and stderr with some light processing
255
- // applied to remove redundant lines caused by Git's use of `\r` to "erase"
256
- // the current line while writing progress output. See createTerminalOutput.
257
- //
258
- // Note: The output is capped at a maximum of 256kb and the sole intent of
259
- // this property is to provide "terminal-like" output to the user when a Git
260
- // command fails.
261
- const terminalChunks: string[] = []
262
- const terminalCapacity = 256 * 1024
263
-
264
- // Keep at most 256kb of combined stderr and stdout output. This is used
265
- // to provide more context in error messages.
266
- opts.processCallback = (process: any) => {
267
- options?.onTerminalOutputAvailable?.(function (cb: any) {
268
- terminalChunks.forEach(chunk => cb(chunk))
269
-
270
- process.stdout?.on('data', cb)
271
- process.stderr?.on('data', cb)
272
-
273
- return {
274
- unsubscribe: () => {
275
- process.stdout?.off('data', cb)
276
- process.stderr?.off('data', cb)
277
- },
278
- }
279
- })
280
-
281
- const push = (chunk: Buffer | string) => {
282
- pushTerminalChunk(terminalChunks, terminalCapacity, chunk)
283
- }
284
-
285
- process.stdout?.on('data', push)
286
- process.stderr?.on('data', push)
287
-
288
- options?.processCallback?.(process)
289
- }
290
-
291
- return withHooksEnv(
292
- hooksEnv =>
293
- withTrampolineEnv(
294
- async env => {
295
- const commandName = `${name}: git ${args.join(' ')}`
296
-
297
- const result = await GitPerf.measure(commandName, () =>
298
- exec(args, path, {
299
- ...opts,
300
- env: {
301
- // Explicitly set TERM to 'dumb' so that if Desktop was launched
302
- // from a terminal or if the system environment variables
303
- // have TERM set Git won't consider us as a smart terminal.
304
- // See https://github.com/git/git/blob/a7312d1a2/editor.c#L11-L15
305
- TERM: 'dumb',
306
- ...opts.env,
307
- ...hooksEnv,
308
- ...env,
309
- },
310
- })
311
- ).catch(err => {
312
- // If this is an exception thrown by Node.js (as opposed to
313
- // dugite) let's keep the salient details but include the name of
314
- // the operation.
315
- if (isErrnoException(err)) {
316
- throw new Error(`Failed to execute ${name}: ${err.code}`)
317
- }
318
-
319
- if (isMaxBufferExceededError(err)) {
320
- throw new ExecError(
321
- `${err.message} for ${name}`,
322
- err.stdout,
323
- err.stderr,
324
- // Dugite stores the original Node error in the cause property, by
325
- // passing that along we ensure that all we're doing here is
326
- // changing the error message (and capping the stack but that's
327
- // okay since we know exactly where this error is coming from).
328
- // The null coalescing here is a safety net in case dugite's
329
- // behavior changes from underneath us.
330
- err.cause ?? err
331
- )
332
- }
333
-
334
- throw err
335
- })
336
-
337
- const exitCode = result.exitCode
338
-
339
- let gitError: DugiteError | null = null
340
- const acceptableExitCode = opts.successExitCodes
341
- ? opts.successExitCodes.has(exitCode)
342
- : false
343
- if (!acceptableExitCode) {
344
- gitError = parseError(coerceToString(result.stderr))
345
- if (gitError === null) {
346
- gitError = parseError(coerceToString(result.stdout))
347
- }
348
- }
349
-
350
- const gitErrorDescription =
351
- gitError !== null
352
- ? getDescriptionForError(gitError, coerceToString(result.stderr))
353
- : null
354
- const isBufferOp = (options as any)?.encoding === 'buffer'
355
- const gitResult = {
356
- ...result,
357
- stdout: isBufferOp ? result.stdout : coerceToString(result.stdout),
358
- stderr: isBufferOp ? result.stderr : coerceToString(result.stderr),
359
- gitError,
360
- gitErrorDescription,
361
- path,
362
- }
363
-
364
- let acceptableError = true
365
- if (gitError !== null && opts.expectedErrors) {
366
- acceptableError = opts.expectedErrors.has(gitError)
367
- }
368
-
369
- if ((gitError !== null && acceptableError) || acceptableExitCode) {
370
- return gitResult
371
- }
372
-
373
- // The caller should either handle this error, or expect that exit code.
374
- const errorMessage = new Array<string>()
375
- errorMessage.push(
376
- `\`git ${args.join(
377
- ' '
378
- )}\` exited with an unexpected code: ${exitCode}.`
379
- )
380
-
381
- const terminalOutput = terminalChunks.join('')
382
-
383
- if (terminalOutput.length > 0) {
384
- // Leave even less of the combined output in the log
385
- errorMessage.push(terminalOutput.slice(-1024))
386
- }
387
-
388
- if (gitError !== null) {
389
- errorMessage.push(
390
- `(The error was parsed as ${gitError}: ${gitErrorDescription})`
391
- )
392
- }
393
-
394
- console.error(errorMessage.join('\n'))
395
-
396
- const coercedResult: IGitResult = {
397
- ...gitResult,
398
- stdout: coerceToString(gitResult.stdout),
399
- stderr: coerceToString(gitResult.stderr),
400
- }
401
- throw new GitError(coercedResult, args, terminalOutput)
402
- },
403
- path,
404
- options?.isBackgroundTask ?? false,
405
- hooksEnv
406
- ),
407
- path,
408
- options
409
- )
410
- }
411
-
412
- /**
413
- * Determine whether the provided `error` is an authentication failure
414
- * as per our definition. Note that this is not an exhaustive list of
415
- * authentication failures, only a collection of errors that we treat
416
- * equally in terms of error message and presentation to the user.
417
- */
418
- export function isAuthFailureError(
419
- error: DugiteError
420
- ): error is
421
- | DugiteError.SSHAuthenticationFailed
422
- | DugiteError.SSHPermissionDenied
423
- | DugiteError.HTTPSAuthenticationFailed {
424
- switch (error) {
425
- case DugiteError.SSHAuthenticationFailed:
426
- case DugiteError.SSHPermissionDenied:
427
- case DugiteError.HTTPSAuthenticationFailed:
428
- return true
429
- }
430
- return false
431
- }
432
-
433
- /**
434
- * Determine whether the provided `error` is an error from Git indicating
435
- * that a configuration file write failed due to a lock file already
436
- * existing for that config file.
437
- */
438
- export function isConfigFileLockError(error: Error): error is GitError {
439
- return (
440
- error instanceof GitError &&
441
- error.result.gitError === DugiteError.ConfigLockFileAlreadyExists
442
- )
443
- }
444
-
445
- const lockFilePathRe = /^error: could not lock config file (.+?): File exists$/m
446
-
447
- /**
448
- * If the `result` is associated with an config lock file error (as determined
449
- * by `isConfigFileLockError`) this method will attempt to extract an absolute
450
- * path (i.e. rooted) to the configuration lock file in question from the Git
451
- * output.
452
- */
453
- export function parseConfigLockFilePathFromError(result: IGitResult) {
454
- const match = lockFilePathRe.exec(coerceToString(result.stderr))
455
-
456
- if (match === null) {
457
- return null
458
- }
459
-
460
- const normalized = match[1]
461
-
462
- // https://github.com/git/git/blob/232378479/lockfile.h#L117-L119
463
- return Path.resolve(result.path, `${normalized}.lock`)
464
- }
465
-
466
- export function getDescriptionForError(
467
- error: DugiteError,
468
- stderr: string
469
- ): string | null {
470
- if (isAuthFailureError(error)) {
471
- const menuHint = 'Settings'
472
- return `Authentication failed. Some common reasons include:
473
-
474
- - You are not logged in to your account: see ${menuHint}
475
- - You may need to log out and log back in to refresh your token.
476
- - You do not have permission to access this repository.
477
- - The repository is archived on GitHub. Check the repository settings to confirm you are still permitted to push commits.
478
- - If you use SSH authentication, check that your key is added to the ssh-agent and associated with your account.
479
- - If you use SSH authentication, ensure the host key verification passes for your repository hosting service.
480
- - If you used username / password authentication, you might need to use a Personal Access Token instead of your account password. Check the documentation of your repository hosting service.`
481
- }
482
-
483
- switch (error) {
484
- case DugiteError.BadConfigValue:
485
- const errorInfo = parseBadConfigValueErrorInfo(stderr)
486
- if (errorInfo === null) {
487
- return 'Unsupported git configuration value.'
488
- }
489
-
490
- return `Unsupported value '${errorInfo.value}' for git config key '${errorInfo.key}'`
491
- case DugiteError.SSHKeyAuditUnverified:
492
- return 'The SSH key is unverified.'
493
- case DugiteError.RemoteDisconnection:
494
- return 'The remote disconnected. Check your Internet connection and try again.'
495
- case DugiteError.HostDown:
496
- return 'The host is down. Check your Internet connection and try again.'
497
- case DugiteError.RebaseConflicts:
498
- return 'We found some conflicts while trying to rebase. Please resolve the conflicts before continuing.'
499
- case DugiteError.MergeConflicts:
500
- return 'We found some conflicts while trying to merge. Please resolve the conflicts and commit the changes.'
501
- case DugiteError.HTTPSRepositoryNotFound:
502
- case DugiteError.SSHRepositoryNotFound:
503
- return 'The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.'
504
- case DugiteError.PushNotFastForward:
505
- return 'The repository has been updated since you last pulled. Try pulling before pushing.'
506
- case DugiteError.BranchDeletionFailed:
507
- return 'Could not delete the branch. It was probably already deleted.'
508
- case DugiteError.DefaultBranchDeletionFailed:
509
- return `The branch is the repository's default branch and cannot be deleted.`
510
- case DugiteError.RevertConflicts:
511
- return 'To finish reverting, please merge and commit the changes.'
512
- case DugiteError.EmptyRebasePatch:
513
- return 'There aren’t any changes left to apply.'
514
- case DugiteError.NoMatchingRemoteBranch:
515
- return 'There aren’t any remote branches that match the current branch.'
516
- case DugiteError.NothingToCommit:
517
- return 'There are no changes to commit.'
518
- case DugiteError.NoSubmoduleMapping:
519
- return 'A submodule was removed from .gitmodules, but the folder still exists in the repository. Delete the folder, commit the change, then try again.'
520
- case DugiteError.SubmoduleRepositoryDoesNotExist:
521
- return 'A submodule points to a location which does not exist.'
522
- case DugiteError.InvalidSubmoduleSHA:
523
- return 'A submodule points to a commit which does not exist.'
524
- case DugiteError.LocalPermissionDenied:
525
- return 'Permission denied.'
526
- case DugiteError.InvalidMerge:
527
- return 'This is not something we can merge.'
528
- case DugiteError.InvalidRebase:
529
- return 'This is not something we can rebase.'
530
- case DugiteError.NonFastForwardMergeIntoEmptyHead:
531
- return 'The merge you attempted is not a fast-forward, so it cannot be performed on an empty branch.'
532
- case DugiteError.PatchDoesNotApply:
533
- return 'The requested changes conflict with one or more files in the repository.'
534
- case DugiteError.BranchAlreadyExists:
535
- return 'A branch with that name already exists.'
536
- case DugiteError.BadRevision:
537
- return 'Bad revision.'
538
- case DugiteError.NotAGitRepository:
539
- return 'This is not a git repository.'
540
- case DugiteError.ProtectedBranchForcePush:
541
- return 'This branch is protected from force-push operations.'
542
- case DugiteError.ProtectedBranchRequiresReview:
543
- return 'This branch is protected and any changes requires an approved review. Open a pull request with changes targeting this branch instead.'
544
- case DugiteError.PushWithFileSizeExceedingLimit:
545
- return "The push operation includes a file which exceeds GitHub's file size restriction of 100MB. Please remove the file from history and try again."
546
- case DugiteError.HexBranchNameRejected:
547
- return 'The branch name cannot be a 40-character string of hexadecimal characters, as this is the format that Git uses for representing objects.'
548
- case DugiteError.ForcePushRejected:
549
- return 'The force push has been rejected for the current branch.'
550
- case DugiteError.InvalidRefLength:
551
- return 'A ref cannot be longer than 255 characters.'
552
- case DugiteError.CannotMergeUnrelatedHistories:
553
- return 'Unable to merge unrelated histories in this repository.'
554
- case DugiteError.PushWithPrivateEmail:
555
- return 'Cannot push these commits as they contain an email address marked as private on GitHub. To push anyway, visit https://github.com/settings/emails, uncheck "Keep my email address private", then switch back to GitHub Desktop to push your commits. You can then enable the setting again.'
556
- case DugiteError.LFSAttributeDoesNotMatch:
557
- return 'Git LFS attribute found in global Git configuration does not match expected value.'
558
- case DugiteError.ProtectedBranchDeleteRejected:
559
- return 'This branch cannot be deleted from the remote repository because it is marked as protected.'
560
- case DugiteError.ProtectedBranchRequiredStatus:
561
- return 'The push was rejected by the remote server because a required status check has not been satisfied.'
562
- case DugiteError.BranchRenameFailed:
563
- return 'The branch could not be renamed.'
564
- case DugiteError.PathDoesNotExist:
565
- return 'The path does not exist on disk.'
566
- case DugiteError.InvalidObjectName:
567
- return 'The object was not found in the Git repository.'
568
- case DugiteError.OutsideRepository:
569
- return 'This path is not a valid path inside the repository.'
570
- case DugiteError.LockFileAlreadyExists:
571
- return 'A lock file already exists in the repository, which blocks this operation from completing.'
572
- case DugiteError.NoMergeToAbort:
573
- return 'There is no merge in progress, so there is nothing to abort.'
574
- case DugiteError.NoExistingRemoteBranch:
575
- return 'The remote branch does not exist.'
576
- case DugiteError.LocalChangesOverwritten:
577
- return 'Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.'
578
- case DugiteError.UnresolvedConflicts:
579
- return 'There are unresolved conflicts in the working directory.'
580
- case DugiteError.ConfigLockFileAlreadyExists:
581
- // Added in dugite 1.88.0 (https://github.com/desktop/dugite/pull/386)
582
- // in support of https://github.com/desktop/desktop/issues/8675 but we're
583
- // not using it yet. Returning a null message here means the stderr will
584
- // be used as the error message (or stdout if stderr is empty), i.e. the
585
- // same behavior as before the ConfigLockFileAlreadyExists was added
586
- return null
587
- case DugiteError.RemoteAlreadyExists:
588
- return null
589
- case DugiteError.TagAlreadyExists:
590
- return 'A tag with that name already exists'
591
- case DugiteError.MergeWithLocalChanges:
592
- case DugiteError.RebaseWithLocalChanges:
593
- case DugiteError.GPGFailedToSignData:
594
- case DugiteError.ConflictModifyDeletedInBranch:
595
- case DugiteError.MergeCommitNoMainlineOption:
596
- case DugiteError.UnsafeDirectory:
597
- case DugiteError.PathExistsButNotInRef:
598
- case DugiteError.PushWithSecretDetected:
599
- return null
600
- default:
601
- return assertNever(error, `Unknown error: ${error}`)
602
- }
603
- }
604
-
605
- /**
606
- * Returns the arguments to use on any git operation that can end up
607
- * triggering a rebase.
608
- */
609
- export function gitRebaseArguments() {
610
- return [
611
- // Explicitly set the rebase backend to merge.
612
- // We need to force this option to be sure that Desktop
613
- // uses the merge backend even if the user has the apply backend
614
- // configured, since this is the only one supported.
615
- // This can go away once git deprecates the apply backend.
616
- ...['-c', 'rebase.backend=merge'],
617
- ]
618
- }
619
-
620
- /**
621
- * Returns the SHA of the passed in IGitResult
622
- */
623
- export function parseCommitSHA(result: IGitStringResult): string {
624
- return result.stdout.split(']')[0].split(' ')[1]
625
- }
@@ -1,36 +0,0 @@
1
- import assert from 'assert'
2
- import { Transform, TransformOptions } from 'stream'
3
-
4
- type Options = Pick<TransformOptions, 'autoDestroy' | 'emitClose' | 'encoding'>
5
-
6
- export function createTailStream(capacity: number, options?: Options) {
7
- assert.ok(capacity > 0, 'The "capacity" argument must be greater than 0')
8
-
9
- const chunks: Buffer[] = []
10
- let length = 0
11
-
12
- return new Transform({
13
- ...options,
14
- decodeStrings: true,
15
- transform(chunk, _, cb) {
16
- chunks.push(chunk)
17
- length += chunk.length
18
-
19
- while (length > capacity) {
20
- const firstChunk = chunks[0]
21
- const overrun = length - capacity
22
-
23
- if (overrun >= firstChunk.length) {
24
- chunks.shift()
25
- length -= firstChunk.length
26
- } else {
27
- chunks[0] = firstChunk.subarray(overrun)
28
- length -= overrun
29
- }
30
- }
31
-
32
- cb()
33
- },
34
- flush: cb => cb(null, Buffer.concat(chunks)),
35
- })
36
- }