@statewalker/vcs-commands 0.4.0 → 0.6.0

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 (561) hide show
  1. package/README.md +123 -8
  2. package/dist/commands/add-command.d.ts +265 -34
  3. package/dist/commands/add-command.d.ts.map +1 -1
  4. package/dist/commands/add-patch/add-interactive.d.ts +46 -0
  5. package/dist/commands/add-patch/add-interactive.d.ts.map +1 -0
  6. package/dist/commands/add-patch/add-patch.d.ts +139 -0
  7. package/dist/commands/add-patch/add-patch.d.ts.map +1 -0
  8. package/dist/commands/add-patch/index.d.ts +6 -0
  9. package/dist/commands/add-patch/index.d.ts.map +1 -0
  10. package/dist/commands/add-patch/patch-backend.d.ts +80 -0
  11. package/dist/commands/add-patch/patch-backend.d.ts.map +1 -0
  12. package/dist/commands/add-patch/patch-modes.d.ts +71 -0
  13. package/dist/commands/add-patch/patch-modes.d.ts.map +1 -0
  14. package/dist/commands/add-patch/patch-session.d.ts +49 -0
  15. package/dist/commands/add-patch/patch-session.d.ts.map +1 -0
  16. package/dist/commands/am/am-command.d.ts +175 -0
  17. package/dist/commands/am/am-command.d.ts.map +1 -0
  18. package/dist/commands/am/index.d.ts +3 -0
  19. package/dist/commands/am/index.d.ts.map +1 -0
  20. package/dist/commands/am/mailinfo.d.ts +58 -0
  21. package/dist/commands/am/mailinfo.d.ts.map +1 -0
  22. package/dist/commands/am/patch-format.d.ts +24 -0
  23. package/dist/commands/am/patch-format.d.ts.map +1 -0
  24. package/dist/commands/apply/apply-command.d.ts +153 -0
  25. package/dist/commands/apply/apply-command.d.ts.map +1 -0
  26. package/dist/commands/apply/apply-engine.d.ts +195 -0
  27. package/dist/commands/apply/apply-engine.d.ts.map +1 -0
  28. package/dist/commands/apply/apply-parse.d.ts +86 -0
  29. package/dist/commands/apply/apply-parse.d.ts.map +1 -0
  30. package/dist/commands/apply/apply-types.d.ts +70 -0
  31. package/dist/commands/apply/apply-types.d.ts.map +1 -0
  32. package/dist/commands/apply/index.d.ts +6 -0
  33. package/dist/commands/apply/index.d.ts.map +1 -0
  34. package/dist/commands/apply/latin1.d.ts +32 -0
  35. package/dist/commands/apply/latin1.d.ts.map +1 -0
  36. package/dist/commands/apply/whitespace.d.ts +58 -0
  37. package/dist/commands/apply/whitespace.d.ts.map +1 -0
  38. package/dist/commands/attributes-source.d.ts +26 -0
  39. package/dist/commands/attributes-source.d.ts.map +1 -0
  40. package/dist/commands/backfill-command.d.ts +110 -0
  41. package/dist/commands/backfill-command.d.ts.map +1 -0
  42. package/dist/commands/bisect/bisect-checkout.d.ts +64 -0
  43. package/dist/commands/bisect/bisect-checkout.d.ts.map +1 -0
  44. package/dist/commands/bisect/bisect-command.d.ts +201 -0
  45. package/dist/commands/bisect/bisect-command.d.ts.map +1 -0
  46. package/dist/commands/bisect/bisect-engine.d.ts +219 -0
  47. package/dist/commands/bisect/bisect-engine.d.ts.map +1 -0
  48. package/dist/commands/bisect/bisect-graph.d.ts +127 -0
  49. package/dist/commands/bisect/bisect-graph.d.ts.map +1 -0
  50. package/dist/commands/bisect/bisect-quote.d.ts +27 -0
  51. package/dist/commands/bisect/bisect-quote.d.ts.map +1 -0
  52. package/dist/commands/bisect/index.d.ts +5 -0
  53. package/dist/commands/bisect/index.d.ts.map +1 -0
  54. package/dist/commands/blame-command.d.ts +122 -131
  55. package/dist/commands/blame-command.d.ts.map +1 -1
  56. package/dist/commands/branch-command.d.ts +52 -2
  57. package/dist/commands/branch-command.d.ts.map +1 -1
  58. package/dist/commands/branch-tracking.d.ts +98 -0
  59. package/dist/commands/branch-tracking.d.ts.map +1 -0
  60. package/dist/commands/checkout-command.d.ts +299 -34
  61. package/dist/commands/checkout-command.d.ts.map +1 -1
  62. package/dist/commands/checkout-paths.d.ts +124 -0
  63. package/dist/commands/checkout-paths.d.ts.map +1 -0
  64. package/dist/commands/cherry-pick-command.d.ts +50 -42
  65. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  66. package/dist/commands/clean-command.d.ts +67 -4
  67. package/dist/commands/clean-command.d.ts.map +1 -1
  68. package/dist/commands/clone-command.d.ts +179 -7
  69. package/dist/commands/clone-command.d.ts.map +1 -1
  70. package/dist/commands/commit-command.d.ts +311 -17
  71. package/dist/commands/commit-command.d.ts.map +1 -1
  72. package/dist/commands/core-config.d.ts +93 -0
  73. package/dist/commands/core-config.d.ts.map +1 -0
  74. package/dist/commands/date-format.d.ts +58 -0
  75. package/dist/commands/date-format.d.ts.map +1 -0
  76. package/dist/commands/describe-command.d.ts.map +1 -1
  77. package/dist/commands/diff-command.d.ts +377 -30
  78. package/dist/commands/diff-command.d.ts.map +1 -1
  79. package/dist/commands/diff-textconv.d.ts +40 -0
  80. package/dist/commands/diff-textconv.d.ts.map +1 -0
  81. package/dist/commands/fetch-command.d.ts +244 -23
  82. package/dist/commands/fetch-command.d.ts.map +1 -1
  83. package/dist/commands/format-patch-command.d.ts +164 -0
  84. package/dist/commands/format-patch-command.d.ts.map +1 -0
  85. package/dist/commands/fsck/fetch-fsck.d.ts +60 -0
  86. package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -0
  87. package/dist/commands/fsck/fsck-command.d.ts +225 -0
  88. package/dist/commands/fsck/fsck-command.d.ts.map +1 -0
  89. package/dist/commands/fsck/fsck-loose.d.ts +68 -0
  90. package/dist/commands/fsck/fsck-loose.d.ts.map +1 -0
  91. package/dist/commands/fsck/fsck-msg-ids.d.ts +122 -0
  92. package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -0
  93. package/dist/commands/fsck/fsck-object-checks.d.ts +148 -0
  94. package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -0
  95. package/dist/commands/fsck/fsck-object-table.d.ts +132 -0
  96. package/dist/commands/fsck/fsck-object-table.d.ts.map +1 -0
  97. package/dist/commands/fsck/fsck-pack.d.ts +115 -0
  98. package/dist/commands/fsck/fsck-pack.d.ts.map +1 -0
  99. package/dist/commands/fsck/index.d.ts +6 -0
  100. package/dist/commands/fsck/index.d.ts.map +1 -0
  101. package/dist/commands/fsck/verify-pack-command.d.ts +81 -0
  102. package/dist/commands/fsck/verify-pack-command.d.ts.map +1 -0
  103. package/dist/commands/gc-command.d.ts +43 -0
  104. package/dist/commands/gc-command.d.ts.map +1 -1
  105. package/dist/commands/git-date.d.ts +66 -0
  106. package/dist/commands/git-date.d.ts.map +1 -0
  107. package/dist/commands/git-describe.d.ts +67 -0
  108. package/dist/commands/git-describe.d.ts.map +1 -0
  109. package/dist/commands/git-hooks.d.ts +416 -0
  110. package/dist/commands/git-hooks.d.ts.map +1 -0
  111. package/dist/commands/git-ident.d.ts +128 -0
  112. package/dist/commands/git-ident.d.ts.map +1 -0
  113. package/dist/commands/hook-command.d.ts +96 -0
  114. package/dist/commands/hook-command.d.ts.map +1 -0
  115. package/dist/commands/index-adder.d.ts +231 -0
  116. package/dist/commands/index-adder.d.ts.map +1 -0
  117. package/dist/commands/index-host.d.ts +86 -0
  118. package/dist/commands/index-host.d.ts.map +1 -0
  119. package/dist/commands/index.d.ts +55 -0
  120. package/dist/commands/index.d.ts.map +1 -1
  121. package/dist/commands/index.js +3 -2
  122. package/dist/commands/init-command.d.ts +12 -1
  123. package/dist/commands/init-command.d.ts.map +1 -1
  124. package/dist/commands/local-clone.d.ts +60 -0
  125. package/dist/commands/local-clone.d.ts.map +1 -0
  126. package/dist/commands/local-transport.d.ts +117 -0
  127. package/dist/commands/local-transport.d.ts.map +1 -0
  128. package/dist/commands/log-command.d.ts +216 -24
  129. package/dist/commands/log-command.d.ts.map +1 -1
  130. package/dist/commands/log-graph.d.ts +120 -0
  131. package/dist/commands/log-graph.d.ts.map +1 -0
  132. package/dist/commands/log-output.d.ts +323 -0
  133. package/dist/commands/log-output.d.ts.map +1 -0
  134. package/dist/commands/ls-remote-command.d.ts +23 -7
  135. package/dist/commands/ls-remote-command.d.ts.map +1 -1
  136. package/dist/commands/mailmap.d.ts +31 -0
  137. package/dist/commands/mailmap.d.ts.map +1 -0
  138. package/dist/commands/merge-bases.d.ts +85 -0
  139. package/dist/commands/merge-bases.d.ts.map +1 -0
  140. package/dist/commands/merge-command.d.ts +209 -74
  141. package/dist/commands/merge-command.d.ts.map +1 -1
  142. package/dist/commands/merge-config.d.ts +13 -0
  143. package/dist/commands/merge-config.d.ts.map +1 -0
  144. package/dist/commands/merge-drivers.d.ts +130 -0
  145. package/dist/commands/merge-drivers.d.ts.map +1 -0
  146. package/dist/commands/merge-support.d.ts +252 -0
  147. package/dist/commands/merge-support.d.ts.map +1 -0
  148. package/dist/commands/message-cleanup.d.ts +86 -0
  149. package/dist/commands/message-cleanup.d.ts.map +1 -0
  150. package/dist/commands/mv-command.d.ts +94 -0
  151. package/dist/commands/mv-command.d.ts.map +1 -0
  152. package/dist/commands/notes-command.d.ts +256 -0
  153. package/dist/commands/notes-command.d.ts.map +1 -0
  154. package/dist/commands/notes-commands.d.ts +41 -0
  155. package/dist/commands/notes-commands.d.ts.map +1 -0
  156. package/dist/commands/notes-merge-command.d.ts +105 -0
  157. package/dist/commands/notes-merge-command.d.ts.map +1 -0
  158. package/dist/commands/notes-support.d.ts +125 -0
  159. package/dist/commands/notes-support.d.ts.map +1 -0
  160. package/dist/commands/notes-tree.d.ts +106 -0
  161. package/dist/commands/notes-tree.d.ts.map +1 -0
  162. package/dist/commands/object-id-input.d.ts +20 -0
  163. package/dist/commands/object-id-input.d.ts.map +1 -0
  164. package/dist/commands/octopus-merge.d.ts +59 -0
  165. package/dist/commands/octopus-merge.d.ts.map +1 -0
  166. package/dist/commands/ort-merge.d.ts +126 -0
  167. package/dist/commands/ort-merge.d.ts.map +1 -0
  168. package/dist/commands/ort-recursive.d.ts +53 -0
  169. package/dist/commands/ort-recursive.d.ts.map +1 -0
  170. package/dist/commands/pack-refs-command.d.ts +20 -0
  171. package/dist/commands/pack-refs-command.d.ts.map +1 -1
  172. package/dist/commands/patch-id.d.ts +41 -0
  173. package/dist/commands/patch-id.d.ts.map +1 -0
  174. package/dist/commands/pathspec-attributes.d.ts +64 -0
  175. package/dist/commands/pathspec-attributes.d.ts.map +1 -0
  176. package/dist/commands/pathspec.d.ts +324 -0
  177. package/dist/commands/pathspec.d.ts.map +1 -0
  178. package/dist/commands/post-index-change.d.ts +33 -0
  179. package/dist/commands/post-index-change.d.ts.map +1 -0
  180. package/dist/commands/pretty-format.d.ts +222 -0
  181. package/dist/commands/pretty-format.d.ts.map +1 -0
  182. package/dist/commands/promisor-remote.d.ts +80 -0
  183. package/dist/commands/promisor-remote.d.ts.map +1 -0
  184. package/dist/commands/pull-command.d.ts +41 -8
  185. package/dist/commands/pull-command.d.ts.map +1 -1
  186. package/dist/commands/push-command.d.ts +24 -8
  187. package/dist/commands/push-command.d.ts.map +1 -1
  188. package/dist/commands/read-tree-command.d.ts +112 -0
  189. package/dist/commands/read-tree-command.d.ts.map +1 -0
  190. package/dist/commands/rebase-command.d.ts +507 -75
  191. package/dist/commands/rebase-command.d.ts.map +1 -1
  192. package/dist/commands/rebase-todo.d.ts +130 -0
  193. package/dist/commands/rebase-todo.d.ts.map +1 -0
  194. package/dist/commands/ref-decoration-filter.d.ts +53 -0
  195. package/dist/commands/ref-decoration-filter.d.ts.map +1 -0
  196. package/dist/commands/reflog-messages.d.ts +98 -0
  197. package/dist/commands/reflog-messages.d.ts.map +1 -0
  198. package/dist/commands/remote-command.d.ts +146 -6
  199. package/dist/commands/remote-command.d.ts.map +1 -1
  200. package/dist/commands/remote-transport.d.ts +120 -0
  201. package/dist/commands/remote-transport.d.ts.map +1 -0
  202. package/dist/commands/reset-command.d.ts +161 -7
  203. package/dist/commands/reset-command.d.ts.map +1 -1
  204. package/dist/commands/restore-command.d.ts +103 -0
  205. package/dist/commands/restore-command.d.ts.map +1 -0
  206. package/dist/commands/rev-list-command.d.ts +78 -0
  207. package/dist/commands/rev-list-command.d.ts.map +1 -0
  208. package/dist/commands/rev-parse-command.d.ts +80 -0
  209. package/dist/commands/rev-parse-command.d.ts.map +1 -0
  210. package/dist/commands/revert-command.d.ts +46 -38
  211. package/dist/commands/revert-command.d.ts.map +1 -1
  212. package/dist/commands/revision-filenames.d.ts +95 -0
  213. package/dist/commands/revision-filenames.d.ts.map +1 -0
  214. package/dist/commands/revision-range.d.ts +67 -0
  215. package/dist/commands/revision-range.d.ts.map +1 -0
  216. package/dist/commands/revision-resolver.d.ts +321 -0
  217. package/dist/commands/revision-resolver.d.ts.map +1 -0
  218. package/dist/commands/rm-command.d.ts +69 -7
  219. package/dist/commands/rm-command.d.ts.map +1 -1
  220. package/dist/commands/sequencer-pick.d.ts +191 -0
  221. package/dist/commands/sequencer-pick.d.ts.map +1 -0
  222. package/dist/commands/sequencer-support.d.ts +125 -0
  223. package/dist/commands/sequencer-support.d.ts.map +1 -0
  224. package/dist/commands/serve-repository.d.ts +52 -0
  225. package/dist/commands/serve-repository.d.ts.map +1 -0
  226. package/dist/commands/sparse-checkout-command.d.ts +190 -0
  227. package/dist/commands/sparse-checkout-command.d.ts.map +1 -0
  228. package/dist/commands/sparse-checkout-support.d.ts +268 -0
  229. package/dist/commands/sparse-checkout-support.d.ts.map +1 -0
  230. package/dist/commands/stash-apply-command.d.ts +69 -13
  231. package/dist/commands/stash-apply-command.d.ts.map +1 -1
  232. package/dist/commands/stash-create-command.d.ts +214 -26
  233. package/dist/commands/stash-create-command.d.ts.map +1 -1
  234. package/dist/commands/stash-drop-command.d.ts +10 -2
  235. package/dist/commands/stash-drop-command.d.ts.map +1 -1
  236. package/dist/commands/stash-list-command.d.ts +2 -4
  237. package/dist/commands/stash-list-command.d.ts.map +1 -1
  238. package/dist/commands/stash-working-tree.d.ts +95 -0
  239. package/dist/commands/stash-working-tree.d.ts.map +1 -0
  240. package/dist/commands/status-command.d.ts +320 -28
  241. package/dist/commands/status-command.d.ts.map +1 -1
  242. package/dist/commands/status-format.d.ts +155 -0
  243. package/dist/commands/status-format.d.ts.map +1 -0
  244. package/dist/commands/status-header.d.ts +64 -0
  245. package/dist/commands/status-header.d.ts.map +1 -0
  246. package/dist/commands/strerror.d.ts +7 -0
  247. package/dist/commands/strerror.d.ts.map +1 -0
  248. package/dist/commands/submodule-config.d.ts +38 -0
  249. package/dist/commands/submodule-config.d.ts.map +1 -0
  250. package/dist/commands/submodule-summary-command.d.ts +80 -0
  251. package/dist/commands/submodule-summary-command.d.ts.map +1 -0
  252. package/dist/commands/submodule-summary.d.ts +150 -0
  253. package/dist/commands/submodule-summary.d.ts.map +1 -0
  254. package/dist/commands/switch-command.d.ts +132 -0
  255. package/dist/commands/switch-command.d.ts.map +1 -0
  256. package/dist/commands/tag-command.d.ts +23 -2
  257. package/dist/commands/tag-command.d.ts.map +1 -1
  258. package/dist/commands/tracking-info.d.ts +64 -0
  259. package/dist/commands/tracking-info.d.ts.map +1 -0
  260. package/dist/commands/trailers.d.ts +73 -0
  261. package/dist/commands/trailers.d.ts.map +1 -0
  262. package/dist/commands/tree-restore.d.ts +137 -6
  263. package/dist/commands/tree-restore.d.ts.map +1 -1
  264. package/dist/commands/untracked-cache-support.d.ts +53 -0
  265. package/dist/commands/untracked-cache-support.d.ts.map +1 -0
  266. package/dist/commands/worktree-add-command.d.ts +108 -0
  267. package/dist/commands/worktree-add-command.d.ts.map +1 -0
  268. package/dist/commands/worktree-list-command.d.ts +69 -0
  269. package/dist/commands/worktree-list-command.d.ts.map +1 -0
  270. package/dist/commands/worktree-lock-command.d.ts +44 -0
  271. package/dist/commands/worktree-lock-command.d.ts.map +1 -0
  272. package/dist/commands/worktree-overwrite-checks.d.ts +204 -0
  273. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -0
  274. package/dist/commands/worktree-prune-command.d.ts +48 -0
  275. package/dist/commands/worktree-prune-command.d.ts.map +1 -0
  276. package/dist/commands/worktree-remove-command.d.ts +59 -0
  277. package/dist/commands/worktree-remove-command.d.ts.map +1 -0
  278. package/dist/commands/worktree-repair-command.d.ts +35 -0
  279. package/dist/commands/worktree-repair-command.d.ts.map +1 -0
  280. package/dist/commands/worktree-support.d.ts +64 -0
  281. package/dist/commands/worktree-support.d.ts.map +1 -0
  282. package/dist/commands-DnmlfwGV.js +61620 -0
  283. package/dist/core-commands/add.command.impl.d.ts.map +1 -1
  284. package/dist/core-commands/index.d.ts +0 -3
  285. package/dist/core-commands/index.d.ts.map +1 -1
  286. package/dist/errors/add-errors.d.ts +55 -0
  287. package/dist/errors/add-errors.d.ts.map +1 -1
  288. package/dist/errors/checkout-errors.d.ts +29 -0
  289. package/dist/errors/checkout-errors.d.ts.map +1 -1
  290. package/dist/errors/command-errors.d.ts +77 -0
  291. package/dist/errors/command-errors.d.ts.map +1 -1
  292. package/dist/errors/commit-errors.d.ts +9 -0
  293. package/dist/errors/commit-errors.d.ts.map +1 -1
  294. package/dist/errors/git-api-error.d.ts +59 -2
  295. package/dist/errors/git-api-error.d.ts.map +1 -1
  296. package/dist/errors/index.d.ts +1 -0
  297. package/dist/errors/index.d.ts.map +1 -1
  298. package/dist/errors/index.js +371 -19
  299. package/dist/errors/rebase-errors.d.ts +9 -0
  300. package/dist/errors/rebase-errors.d.ts.map +1 -1
  301. package/dist/errors/ref-errors.d.ts +32 -0
  302. package/dist/errors/ref-errors.d.ts.map +1 -1
  303. package/dist/errors/transport-errors.d.ts +12 -2
  304. package/dist/errors/transport-errors.d.ts.map +1 -1
  305. package/dist/errors/worktree-errors.d.ts +35 -0
  306. package/dist/errors/worktree-errors.d.ts.map +1 -0
  307. package/dist/git-command-DxvwPrPB.js +7612 -0
  308. package/dist/git-command.d.ts +422 -32
  309. package/dist/git-command.d.ts.map +1 -1
  310. package/dist/git.d.ts +326 -5
  311. package/dist/git.d.ts.map +1 -1
  312. package/dist/index.d.ts +1 -1
  313. package/dist/index.d.ts.map +1 -1
  314. package/dist/index.js +5 -5
  315. package/dist/remote-config/index.d.ts +1 -0
  316. package/dist/remote-config/index.d.ts.map +1 -1
  317. package/dist/remote-config/remote-config-store.d.ts +123 -3
  318. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  319. package/dist/remote-config/remote-refs.d.ts +41 -0
  320. package/dist/remote-config/remote-refs.d.ts.map +1 -0
  321. package/dist/rename/detect-renames.d.ts +148 -0
  322. package/dist/rename/detect-renames.d.ts.map +1 -0
  323. package/dist/rename/git-similarity.d.ts +44 -0
  324. package/dist/rename/git-similarity.d.ts.map +1 -0
  325. package/dist/rename/index.d.ts +2 -0
  326. package/dist/rename/index.d.ts.map +1 -1
  327. package/dist/results/binary-patch.d.ts +11 -0
  328. package/dist/results/binary-patch.d.ts.map +1 -0
  329. package/dist/results/blame-format.d.ts +55 -0
  330. package/dist/results/blame-format.d.ts.map +1 -0
  331. package/dist/results/cherry-pick-result.d.ts +10 -0
  332. package/dist/results/cherry-pick-result.d.ts.map +1 -1
  333. package/dist/results/clone-result.d.ts +16 -0
  334. package/dist/results/clone-result.d.ts.map +1 -1
  335. package/dist/results/combined-diff.d.ts +77 -0
  336. package/dist/results/combined-diff.d.ts.map +1 -0
  337. package/dist/results/diff-entry.d.ts +32 -0
  338. package/dist/results/diff-entry.d.ts.map +1 -1
  339. package/dist/results/diff-formatter.d.ts +34 -60
  340. package/dist/results/diff-formatter.d.ts.map +1 -1
  341. package/dist/results/diff-order.d.ts +25 -0
  342. package/dist/results/diff-order.d.ts.map +1 -0
  343. package/dist/results/diff-output.d.ts +249 -0
  344. package/dist/results/diff-output.d.ts.map +1 -0
  345. package/dist/results/fetch-result.d.ts +24 -1
  346. package/dist/results/fetch-result.d.ts.map +1 -1
  347. package/dist/results/index.d.ts +5 -0
  348. package/dist/results/index.d.ts.map +1 -1
  349. package/dist/results/index.js +2 -252
  350. package/dist/results/merge-result.d.ts +15 -1
  351. package/dist/results/merge-result.d.ts.map +1 -1
  352. package/dist/results/pull-result.d.ts +12 -3
  353. package/dist/results/pull-result.d.ts.map +1 -1
  354. package/dist/results/push-result.d.ts +42 -0
  355. package/dist/results/push-result.d.ts.map +1 -1
  356. package/dist/results/quote-path.d.ts +27 -0
  357. package/dist/results/quote-path.d.ts.map +1 -0
  358. package/dist/results/rebase-result.d.ts +28 -1
  359. package/dist/results/rebase-result.d.ts.map +1 -1
  360. package/dist/results/revert-result.d.ts +10 -0
  361. package/dist/results/revert-result.d.ts.map +1 -1
  362. package/dist/results/stash-result.d.ts +5 -0
  363. package/dist/results/stash-result.d.ts.map +1 -1
  364. package/dist/results/status-result.d.ts +143 -18
  365. package/dist/results/status-result.d.ts.map +1 -1
  366. package/dist/results-BZGa2Z3I.js +2934 -0
  367. package/dist/transport-command.d.ts +56 -1
  368. package/dist/transport-command.d.ts.map +1 -1
  369. package/package.json +15 -10
  370. package/src/commands/add-command.ts +1291 -224
  371. package/src/commands/add-patch/add-interactive.ts +941 -0
  372. package/src/commands/add-patch/add-patch.ts +1169 -0
  373. package/src/commands/add-patch/index.ts +5 -0
  374. package/src/commands/add-patch/patch-backend.ts +239 -0
  375. package/src/commands/add-patch/patch-modes.ts +249 -0
  376. package/src/commands/add-patch/patch-session.ts +159 -0
  377. package/src/commands/am/am-command.ts +1111 -0
  378. package/src/commands/am/index.ts +2 -0
  379. package/src/commands/am/mailinfo.ts +1015 -0
  380. package/src/commands/am/patch-format.ts +121 -0
  381. package/src/commands/apply/apply-command.ts +832 -0
  382. package/src/commands/apply/apply-engine.ts +1603 -0
  383. package/src/commands/apply/apply-parse.ts +1209 -0
  384. package/src/commands/apply/apply-types.ts +112 -0
  385. package/src/commands/apply/index.ts +5 -0
  386. package/src/commands/apply/latin1.ts +171 -0
  387. package/src/commands/apply/whitespace.ts +260 -0
  388. package/src/commands/attributes-source.ts +96 -0
  389. package/src/commands/backfill-command.ts +694 -0
  390. package/src/commands/bisect/bisect-checkout.ts +217 -0
  391. package/src/commands/bisect/bisect-command.ts +788 -0
  392. package/src/commands/bisect/bisect-engine.ts +1079 -0
  393. package/src/commands/bisect/bisect-graph.ts +595 -0
  394. package/src/commands/bisect/bisect-quote.ts +92 -0
  395. package/src/commands/bisect/index.ts +4 -0
  396. package/src/commands/blame-command.ts +711 -986
  397. package/src/commands/branch-command.ts +354 -32
  398. package/src/commands/branch-tracking.ts +331 -0
  399. package/src/commands/checkout-command.ts +1426 -297
  400. package/src/commands/checkout-paths.ts +784 -0
  401. package/src/commands/cherry-pick-command.ts +156 -396
  402. package/src/commands/clean-command.ts +532 -85
  403. package/src/commands/clone-command.ts +826 -55
  404. package/src/commands/commit-command.ts +1781 -166
  405. package/src/commands/core-config.ts +196 -0
  406. package/src/commands/date-format.ts +668 -0
  407. package/src/commands/describe-command.ts +2 -0
  408. package/src/commands/diff-command.ts +1898 -110
  409. package/src/commands/diff-textconv.ts +50 -0
  410. package/src/commands/fetch-command.ts +1038 -79
  411. package/src/commands/format-patch-command.ts +969 -0
  412. package/src/commands/fsck/fetch-fsck.ts +229 -0
  413. package/src/commands/fsck/fsck-command.ts +3347 -0
  414. package/src/commands/fsck/fsck-loose.ts +287 -0
  415. package/src/commands/fsck/fsck-msg-ids.ts +176 -0
  416. package/src/commands/fsck/fsck-object-checks.ts +1044 -0
  417. package/src/commands/fsck/fsck-object-table.ts +363 -0
  418. package/src/commands/fsck/fsck-pack.ts +604 -0
  419. package/src/commands/fsck/index.ts +5 -0
  420. package/src/commands/fsck/verify-pack-command.ts +249 -0
  421. package/src/commands/gc-command.ts +147 -1
  422. package/src/commands/git-date.ts +895 -0
  423. package/src/commands/git-describe.ts +316 -0
  424. package/src/commands/git-hooks.ts +1472 -0
  425. package/src/commands/git-ident.ts +344 -0
  426. package/src/commands/hook-command.ts +247 -0
  427. package/src/commands/index-adder.ts +706 -0
  428. package/src/commands/index-host.ts +291 -0
  429. package/src/commands/index.ts +83 -0
  430. package/src/commands/init-command.ts +60 -11
  431. package/src/commands/local-clone.ts +183 -0
  432. package/src/commands/local-transport.ts +762 -0
  433. package/src/commands/log-command.ts +1915 -170
  434. package/src/commands/log-graph.ts +671 -0
  435. package/src/commands/log-output.ts +1359 -0
  436. package/src/commands/ls-remote-command.ts +101 -58
  437. package/src/commands/mailmap.ts +129 -0
  438. package/src/commands/merge-bases.ts +296 -0
  439. package/src/commands/merge-command.ts +1386 -491
  440. package/src/commands/merge-config.ts +25 -0
  441. package/src/commands/merge-drivers.ts +306 -0
  442. package/src/commands/merge-support.ts +1198 -0
  443. package/src/commands/message-cleanup.ts +275 -0
  444. package/src/commands/mv-command.ts +976 -0
  445. package/src/commands/notes-command.ts +890 -0
  446. package/src/commands/notes-commands.ts +87 -0
  447. package/src/commands/notes-merge-command.ts +768 -0
  448. package/src/commands/notes-support.ts +402 -0
  449. package/src/commands/notes-tree.ts +602 -0
  450. package/src/commands/object-id-input.ts +27 -0
  451. package/src/commands/octopus-merge.ts +377 -0
  452. package/src/commands/ort-merge.ts +1660 -0
  453. package/src/commands/ort-recursive.ts +160 -0
  454. package/src/commands/pack-refs-command.ts +39 -22
  455. package/src/commands/patch-id.ts +196 -0
  456. package/src/commands/pathspec-attributes.ts +162 -0
  457. package/src/commands/pathspec.ts +1199 -0
  458. package/src/commands/post-index-change.ts +62 -0
  459. package/src/commands/pretty-format.ts +1431 -0
  460. package/src/commands/promisor-remote.ts +298 -0
  461. package/src/commands/pull-command.ts +207 -22
  462. package/src/commands/push-command.ts +236 -23
  463. package/src/commands/read-tree-command.ts +857 -0
  464. package/src/commands/rebase-command.ts +3808 -371
  465. package/src/commands/rebase-todo.ts +584 -0
  466. package/src/commands/ref-decoration-filter.ts +118 -0
  467. package/src/commands/reflog-messages.ts +177 -0
  468. package/src/commands/remote-command.ts +500 -19
  469. package/src/commands/remote-transport.ts +383 -0
  470. package/src/commands/reset-command.ts +828 -91
  471. package/src/commands/restore-command.ts +350 -0
  472. package/src/commands/rev-list-command.ts +167 -0
  473. package/src/commands/rev-parse-command.ts +277 -0
  474. package/src/commands/revert-command.ts +152 -399
  475. package/src/commands/revision-filenames.ts +254 -0
  476. package/src/commands/revision-range.ts +222 -0
  477. package/src/commands/revision-resolver.ts +1379 -0
  478. package/src/commands/rm-command.ts +613 -67
  479. package/src/commands/sequencer-pick.ts +869 -0
  480. package/src/commands/sequencer-support.ts +869 -0
  481. package/src/commands/serve-repository.ts +125 -0
  482. package/src/commands/sparse-checkout-command.ts +1389 -0
  483. package/src/commands/sparse-checkout-support.ts +793 -0
  484. package/src/commands/stash-apply-command.ts +692 -124
  485. package/src/commands/stash-create-command.ts +752 -89
  486. package/src/commands/stash-drop-command.ts +67 -6
  487. package/src/commands/stash-list-command.ts +10 -4
  488. package/src/commands/stash-working-tree.ts +387 -0
  489. package/src/commands/status-command.ts +1426 -97
  490. package/src/commands/status-format.ts +775 -0
  491. package/src/commands/status-header.ts +330 -0
  492. package/src/commands/strerror.ts +29 -0
  493. package/src/commands/submodule-config.ts +94 -0
  494. package/src/commands/submodule-summary-command.ts +334 -0
  495. package/src/commands/submodule-summary.ts +446 -0
  496. package/src/commands/switch-command.ts +402 -0
  497. package/src/commands/tag-command.ts +129 -41
  498. package/src/commands/tracking-info.ts +201 -0
  499. package/src/commands/trailers.ts +417 -0
  500. package/src/commands/tree-restore.ts +344 -15
  501. package/src/commands/untracked-cache-support.ts +194 -0
  502. package/src/commands/worktree-add-command.ts +458 -0
  503. package/src/commands/worktree-list-command.ts +208 -0
  504. package/src/commands/worktree-lock-command.ts +96 -0
  505. package/src/commands/worktree-overwrite-checks.ts +641 -0
  506. package/src/commands/worktree-prune-command.ts +99 -0
  507. package/src/commands/worktree-remove-command.ts +186 -0
  508. package/src/commands/worktree-repair-command.ts +59 -0
  509. package/src/commands/worktree-support.ts +214 -0
  510. package/src/core-commands/add.command.impl.ts +9 -5
  511. package/src/core-commands/index.ts +0 -8
  512. package/src/errors/add-errors.ts +45 -0
  513. package/src/errors/checkout-errors.ts +46 -2
  514. package/src/errors/command-errors.ts +101 -1
  515. package/src/errors/commit-errors.ts +18 -2
  516. package/src/errors/git-api-error.ts +82 -2
  517. package/src/errors/index.ts +1 -0
  518. package/src/errors/merge-errors.ts +2 -2
  519. package/src/errors/rebase-errors.ts +12 -0
  520. package/src/errors/ref-errors.ts +56 -2
  521. package/src/errors/remote-errors.ts +2 -2
  522. package/src/errors/stash-errors.ts +1 -1
  523. package/src/errors/transport-errors.ts +20 -4
  524. package/src/errors/worktree-errors.ts +49 -0
  525. package/src/git-command.ts +1218 -118
  526. package/src/git.ts +552 -11
  527. package/src/index.ts +1 -1
  528. package/src/remote-config/index.ts +1 -0
  529. package/src/remote-config/remote-config-store.ts +326 -16
  530. package/src/remote-config/remote-refs.ts +119 -0
  531. package/src/rename/detect-renames.ts +711 -0
  532. package/src/rename/git-similarity.ts +116 -0
  533. package/src/rename/index.ts +2 -0
  534. package/src/results/binary-patch.ts +401 -0
  535. package/src/results/blame-format.ts +239 -0
  536. package/src/results/cherry-pick-result.ts +10 -0
  537. package/src/results/clone-result.ts +18 -0
  538. package/src/results/combined-diff.ts +585 -0
  539. package/src/results/diff-entry.ts +35 -0
  540. package/src/results/diff-formatter.ts +152 -288
  541. package/src/results/diff-order.ts +64 -0
  542. package/src/results/diff-output.ts +1051 -0
  543. package/src/results/fetch-result.ts +24 -1
  544. package/src/results/index.ts +5 -0
  545. package/src/results/merge-result.ts +15 -1
  546. package/src/results/pull-result.ts +12 -3
  547. package/src/results/push-result.ts +43 -0
  548. package/src/results/quote-path.ts +103 -0
  549. package/src/results/rebase-result.ts +37 -0
  550. package/src/results/revert-result.ts +10 -0
  551. package/src/results/stash-result.ts +6 -0
  552. package/src/results/status-result.ts +288 -27
  553. package/src/transport-command.ts +139 -2
  554. package/dist/commands-BpeXZTC3.js +0 -10278
  555. package/dist/core-commands/checkout.command.d.ts +0 -103
  556. package/dist/core-commands/checkout.command.d.ts.map +0 -1
  557. package/dist/core-commands/checkout.command.impl.d.ts +0 -110
  558. package/dist/core-commands/checkout.command.impl.d.ts.map +0 -1
  559. package/dist/status-result-BapZoQaR.js +0 -411
  560. package/src/core-commands/checkout.command.impl.ts +0 -564
  561. package/src/core-commands/checkout.command.ts +0 -125
@@ -0,0 +1,416 @@
1
+ /**
2
+ * git's hooks (githooks(5), hook.c): finding a hook as `find_hook` does and running it
3
+ * through the host's {@link HookRunner}.
4
+ *
5
+ * ```typescript
6
+ * const hooks = new HookSession(workingCopy);
7
+ * const result = await hooks.run("pre-commit", { env: { GIT_INDEX_FILE: ".git/index" } });
8
+ * if (result && result.exitCode !== 0) throw new Error("pre-commit refused the commit");
9
+ * hooks.output; // what the hook wrote (git relays it on stderr), and any hints
10
+ * ```
11
+ *
12
+ * A hook is a file named after it in `core.hooksPath` (relative to the worktree top, the git
13
+ * directory when bare; `~/` the home directory) or else in `$GIT_DIR/hooks` (the common git
14
+ * directory of a linked worktree). It counts only when executable: a file that is not gets
15
+ * git's `advice.ignoredHook` hint, once per hook name. Without a runner on the host
16
+ * environment (`GitHostEnvironment.hookRunner`), nothing is looked up and no hook runs.
17
+ *
18
+ * Every hook runs in the worktree top (the git directory when bare) with `GIT_PREFIX` empty,
19
+ * as git's setup exports it, plus the variables of the call; its stdout goes to its stderr
20
+ * unless the call asks otherwise (`RUN_HOOKS_OPT_INIT`'s `stdout_to_stderr`).
21
+ */
22
+ import type { RefTransactionHook } from "@statewalker/vcs-core";
23
+ import type { FilesApi } from "@statewalker/vcs-utils/files";
24
+ import { type GitHostEnvironment, type HookRunner, type WorkingCopy } from "@statewalker/vcs-working-tree";
25
+ /** What a hook is given beyond its name. */
26
+ export interface HookCallOptions {
27
+ /** Arguments after the script */
28
+ args?: string[];
29
+ /** What the hook reads on stdin (text is written as UTF-8) */
30
+ stdin?: string | Uint8Array;
31
+ /** Variables set for the hook (GIT_INDEX_FILE, GIT_EDITOR, ...) */
32
+ env?: Record<string, string>;
33
+ /** Keep the hook's stdout apart (default false: sent to stderr, as git's hooks) */
34
+ keepStdout?: boolean;
35
+ /**
36
+ * The directory the hook runs in, a path of the repository's FilesApi, in place of the
37
+ * worktree top (git's `opt.dir`: `worktree add` runs post-checkout in the new worktree);
38
+ * the hook is then named by its absolute path, as git names it there
39
+ */
40
+ dir?: string;
41
+ /**
42
+ * Whether git's setup exported `GIT_PREFIX` (default true: the commands that run in a
43
+ * repository; `clone` and the receive side do not)
44
+ */
45
+ prefix?: boolean;
46
+ /**
47
+ * Variables the hook runs without, the host's own and the session's included (git's
48
+ * `opt.env` entries without a value: `worktree add` unsets `GIT_DIR` and `GIT_WORK_TREE`)
49
+ */
50
+ unsetEnv?: string[];
51
+ }
52
+ /** What running a hook gave: its exit code and output as text. */
53
+ export interface HookResult {
54
+ exitCode: number;
55
+ stdout: string;
56
+ stderr: string;
57
+ }
58
+ /**
59
+ * A hook started by {@link HookSession.start}: its stdin and stdout, and its exit. The shape
60
+ * of the transport's `ProcReceiveProcess`.
61
+ */
62
+ export interface StartedHook {
63
+ /** false: it takes its whole stdin before it runs (the runner has no `start`) */
64
+ readonly interactive: boolean;
65
+ write(data: Uint8Array): Promise<void>;
66
+ closeStdin(): Promise<void>;
67
+ readonly stdout: AsyncIterable<Uint8Array>;
68
+ closeStdout(): void;
69
+ /** Waits for it to exit (its stderr kept in the session's output): its exit code */
70
+ wait(): Promise<number>;
71
+ /** Stops it, where the runner can (`HookProcess.kill`) */
72
+ kill?(): void;
73
+ }
74
+ /** A hook found: where it is, for the runner and for git's messages. */
75
+ export interface FoundHook {
76
+ /** The path git names it by, relative to the hook's directory or absolute */
77
+ path: string;
78
+ /** Its path in the repository's FilesApi, when it lies there */
79
+ filesPath?: string;
80
+ /** Its absolute path on the host, when known */
81
+ hostPath?: string;
82
+ }
83
+ /** The hook runner of a working copy's host environment, if any. */
84
+ export declare function hookRunnerOf(workingCopy: WorkingCopy): HookRunner | undefined;
85
+ /** Where the repository's files are, for hooks: its FilesApi, worktree top and git dirs. */
86
+ export interface HookLayout {
87
+ files: FilesApi;
88
+ /** The worktree top ("" for the FilesApi root) */
89
+ top: string;
90
+ /** The git directory */
91
+ gitDir: string;
92
+ /** Where the hook runs: the worktree top, the git directory when bare */
93
+ cwd: string;
94
+ bare: boolean;
95
+ /**
96
+ * The git directory as git exports it to hooks (`GIT_DIR`): where the worktree's `.git` is
97
+ * a gitfile (a linked worktree, a submodule), the real path of the git directory it names
98
+ * (setup.c, `read_gitfile_gently`'s `real_pathdup`); `.` in a bare repository (discovered
99
+ * from its top, where hooks run); absent for a `.git` directory, which git does not export
100
+ */
101
+ gitDirEnv?: string;
102
+ }
103
+ /**
104
+ * The repository a {@link HookSession} runs hooks of: where its files are, its settings and
105
+ * the host's environment (the runner). A working copy gives all three (see
106
+ * {@link hookHostOf}); the receive side of a local push gives the remote repository's.
107
+ */
108
+ export interface HookHost {
109
+ layout(): Promise<HookLayout | undefined>;
110
+ configValue(key: string): string | undefined;
111
+ environment(): GitHostEnvironment | undefined;
112
+ /**
113
+ * The `hook.<name>.<variable>` settings (event, command, enabled) in the configuration's
114
+ * order, for git 2.5x's configured hooks; absent: none are configured
115
+ */
116
+ hookSettings?(): HookSetting[];
117
+ /**
118
+ * Variables of the host every hook of this repository runs without unless a call sets them
119
+ * itself: the receive side of a local push, which git starts with `local_repo_env` cleared
120
+ * ({@link LOCAL_REPO_ENV}, connect.c)
121
+ */
122
+ unsetEnv?: readonly string[];
123
+ }
124
+ /**
125
+ * environment.c's `local_repo_env` (git 2.43 and 2.56): the variables naming the local
126
+ * repository, which connect.c removes from the environment of a receive-pack or upload-pack
127
+ * it starts for a local (or `ext::`, `ssh` on the same host) remote, so the remote's hooks
128
+ * never see the pushing repository's objects, config or index.
129
+ */
130
+ export declare const LOCAL_REPO_ENV: readonly string[];
131
+ /** One `hook.<name>.<variable>` setting (git 2.5x's configured hooks). */
132
+ export interface HookSetting {
133
+ /** The hook's friendly name (`<name>`) */
134
+ name: string;
135
+ variable: "event" | "command" | "enabled";
136
+ /** The value as git reads it (unquoted); undefined for a variable without `=` */
137
+ value: string | undefined;
138
+ /** The file it was read from, as the host names it (absent where the config cannot tell) */
139
+ file?: string;
140
+ /** Its line in that file, from 1 */
141
+ line?: number;
142
+ /** The scope of that file (git's `config_scope_name`: `local`, `global`, ...) */
143
+ scope?: string;
144
+ }
145
+ /** The hook host of a working copy. */
146
+ export declare function hookHostOf(workingCopy: WorkingCopy): HookHost;
147
+ /**
148
+ * The `hook.<name>.<variable>` settings (event, command, enabled) among a configuration's
149
+ * entries in the order git reads them (an opened repository's `listWithOrigin`, else `list`
150
+ * without origins): the hook settings of a repository a push reaches.
151
+ */
152
+ export declare function hookSettingsFromEntries(entries: ReadonlyArray<{
153
+ key: string;
154
+ value: string | null;
155
+ file?: string;
156
+ line?: number;
157
+ scope?: string;
158
+ }>): HookSetting[];
159
+ /** Whether `name` is one of git's hooks (hook.c `is_known_hook`, hook-list.h). */
160
+ export declare function isKnownHook(name: string): boolean;
161
+ /**
162
+ * What git 2.5x dies with (or warns of) on reading the configured hooks, which it does on
163
+ * looking up any hook (hook.c `hook_config_lookup_all`, `build_hook_config_map`): a
164
+ * variable without `=` (`error: missing value for ...`, then git's `bad config variable`), a
165
+ * friendly name that is a known hook name, a name of some event with no command (unless
166
+ * disabled). Returns the fatal message (undefined when none) and git's warnings (a friendly
167
+ * name equal to its event; a disabled one without a command).
168
+ */
169
+ export declare function hookSettingsCheck(settings: readonly HookSetting[]): {
170
+ fatal?: string;
171
+ warnings: string[];
172
+ };
173
+ /** One configured hook of an event, as git 2.5x's `list_hooks` keeps it (`git hook list`). */
174
+ export interface ConfiguredHookEntry {
175
+ /** Its friendly name (`hook.<name>`) */
176
+ name: string;
177
+ /** Its `hook.<name>.command` (absent: only a disabled hook may have none) */
178
+ command?: string;
179
+ /** `hook.<name>.enabled=false` */
180
+ disabled: boolean;
181
+ /** The whole event is disabled (`hook.<event>.enabled=false`, `<event>` no friendly name) */
182
+ eventDisabled: boolean;
183
+ /** The scope of its last event line (`local`, `global`, ...), where the config tells */
184
+ scope?: string;
185
+ }
186
+ /**
187
+ * git 2.5x's configured hooks of `event` (hook.c `build_hook_config_map`,
188
+ * `list_hooks_add_configured`): the friendly names whose `hook.<name>.event` names it, in the
189
+ * order of their last such line (an empty value drops the name from every event), each with
190
+ * its last `hook.<name>.command`, whether `hook.<name>.enabled=false` disables it and whether
191
+ * the event itself is disabled (`hook.<event>.enabled=false`, `<event>` not a friendly name).
192
+ * Disabled ones are kept, as `git hook list` shows them; none of them runs.
193
+ */
194
+ export declare function configuredHookEntries(settings: readonly HookSetting[], event: string): ConfiguredHookEntry[];
195
+ /**
196
+ * git 2.5x's configured hooks of `event` that run (see {@link configuredHookEntries}): those
197
+ * neither disabled nor of a disabled event. A name with no command is left out (git refuses
198
+ * to run any hook then, see {@link hookSettingsCheck}).
199
+ */
200
+ export declare function configuredHooks(settings: readonly HookSetting[], event: string): Array<{
201
+ name: string;
202
+ command: string;
203
+ }>;
204
+ /** One hook `git hook list` lists: a configured one or the hooks directory's script. */
205
+ export type HookListEntry = ({
206
+ kind: "configured";
207
+ } & ConfiguredHookEntry) | {
208
+ kind: "traditional";
209
+ /** The script's path as git names it (`.git/hooks/pre-commit`) */
210
+ path: string;
211
+ };
212
+ /**
213
+ * The hooks one command runs, with git's per-process memory of the hints given and the
214
+ * output the hooks wrote (git relays it on its stderr, the hints included).
215
+ */
216
+ export declare class HookSession {
217
+ /** The hook names whose `advice.ignoredHook` hint was given (git's `advise_given`) */
218
+ private readonly advised;
219
+ /** What the hooks wrote, and the hints, in order */
220
+ private readonly chunks;
221
+ /** What the hooks whose stdout git keeps apart (pre-push) wrote there */
222
+ private readonly stdoutChunks;
223
+ private readonly host;
224
+ /** Variables every hook of this session gets, below each call's own (see {@link withEnv}) */
225
+ private processEnv;
226
+ constructor(source: WorkingCopy | HookHost);
227
+ /**
228
+ * A session sharing this one's output and hints whose hooks all get `env` too (below each
229
+ * call's own variables): the hooks of a git command git runs as a child process with
230
+ * variables set, as a sequencer's `git commit` with GIT_REFLOG_ACTION.
231
+ */
232
+ withEnv(env: Record<string, string>): HookSession;
233
+ private get runner();
234
+ /**
235
+ * The committer variables the host sets (`GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL`), as
236
+ * the host environment's `committer` gives them: what git's http-backend checks before
237
+ * naming the pushing user the committer of its children.
238
+ */
239
+ get hostCommitter(): {
240
+ name?: string;
241
+ email?: string;
242
+ };
243
+ /**
244
+ * The host's `GIT_ALTERNATE_OBJECT_DIRECTORIES` (the host environment's
245
+ * `alternateObjectDirectories`): what a quarantined pre-receive gets the repository's
246
+ * objects appended to, as tmp-objdir.c's `env_append` appends them.
247
+ */
248
+ get hostAlternateObjectDirectories(): string | undefined;
249
+ /** Whether hooks can run at all: the host environment has a runner. */
250
+ get enabled(): boolean;
251
+ /** The runner's git version (default 2.56). */
252
+ get compatibility(): "2.43" | "2.56";
253
+ /** Everything the hooks wrote (stderr, and stdout sent there) and the hints, as git shows it. */
254
+ get output(): string;
255
+ /** What the hooks whose stdout git keeps on its own stdout wrote there (pre-push). */
256
+ get stdout(): string;
257
+ /** Text added to the output, as git writes its own messages between the hooks' output. */
258
+ append(text: string): void;
259
+ /**
260
+ * A file of the git directory as git names it to hooks (`git_path`): relative to the
261
+ * directory the hooks run in (`.git/index`, `.git/COMMIT_EDITMSG`), else absolute.
262
+ * `absolute` names it by its host path where there is one, as git names a lock file
263
+ * (lockfile.c resolves the path it locks: `index.lock` of `commit -a`).
264
+ */
265
+ gitPath(name: string, absolute?: boolean): Promise<string>;
266
+ /** A file of the git directory as the repository's FilesApi names it (no layout: none). */
267
+ gitFile(name: string): Promise<{
268
+ files: FilesApi;
269
+ path: string;
270
+ } | undefined>;
271
+ /**
272
+ * A file of the repository's common directory (the main git directory of a linked
273
+ * worktree: `objects/`, `packed-refs`) as the repository's FilesApi names it.
274
+ */
275
+ commonGitFile(name: string): Promise<{
276
+ files: FilesApi;
277
+ path: string;
278
+ } | undefined>;
279
+ /**
280
+ * A path of the repository's FilesApi as hooks are told it: its absolute host path where the
281
+ * files have one (as git names `GIT_QUARANTINE_PATH`), else relative to the directory the
282
+ * hooks run in; as given without a layout.
283
+ */
284
+ hookPathOf(filesPath: string): Promise<string>;
285
+ /**
286
+ * The bytes of a file a git option names (`git hook run --to-stdin=<path>`): a relative
287
+ * path from the directory git runs in (the worktree top, the git directory when bare),
288
+ * through the repository's FilesApi; an absolute one through it when it lies there, else
289
+ * through the host. Undefined when it cannot be read.
290
+ */
291
+ readFileAt(path: string): Promise<Uint8Array | undefined>;
292
+ /**
293
+ * The git directory's absolute host path, where the repository's files have one: its real
294
+ * path (symbolic links followed), as git names it after a `getcwd` (clone's GIT_DIR, the
295
+ * receive side's `absolute_path` in the git directory), or with `{ real: false }` as the
296
+ * host names it, as git's `absolute_path` of `.git` from the top keeps the logical `$PWD`
297
+ * (lockfile.c's "Unable to create" message).
298
+ */
299
+ hostGitDir(options?: {
300
+ real?: boolean;
301
+ }): Promise<string | undefined>;
302
+ /** Whether `name` exists as an executable hook (git's `hook_exists`), giving no hint. */
303
+ exists(name: string): Promise<boolean>;
304
+ /**
305
+ * The hooks of `name` git runs, in order (hook.c `list_hooks`): the configured ones (git
306
+ * 2.5x, see {@link configuredHooks}), then the hooks directory's script ({@link find}).
307
+ */
308
+ private list;
309
+ /**
310
+ * Every hook of `name` git 2.5x's `list_hooks` keeps, in order (`git hook list`): the
311
+ * configured ones, disabled ones included (see {@link configuredHookEntries}; none under
312
+ * 2.43), then the hooks directory's script ({@link find}, its hint given). Throws git's
313
+ * fatal error for a broken `hook.*` configuration.
314
+ */
315
+ listAll(name: string): Promise<HookListEntry[]>;
316
+ /** Whether the configured hooks' warnings were given (git gives them once per process). */
317
+ private settingsChecked;
318
+ /**
319
+ * git 2.5x's checks of the configured hooks on a hook's lookup ({@link hookSettingsCheck}):
320
+ * its warnings once, its fatal error thrown (on every lookup, as each git process dies).
321
+ */
322
+ private checkSettings;
323
+ /**
324
+ * The hook `name` (git's `find_hook`): undefined when absent or not executable; the latter
325
+ * gives the `advice.ignoredHook` hint (once per name) unless `advise` is false.
326
+ */
327
+ find(name: string, advise?: boolean): Promise<FoundHook | undefined>;
328
+ /**
329
+ * Runs the hook `name` (git's `run_hooks_opt`): undefined when there is none (or no
330
+ * runner), else its exit code and output. Its output is kept in {@link output}.
331
+ */
332
+ run(name: string, options?: HookCallOptions): Promise<HookResult | undefined>;
333
+ /**
334
+ * Starts the hook `name` found as git's `find_hook` finds it (the hooks directory's script
335
+ * alone: no configured hook, as receive-pack's proc-receive), its stdin and stdout piped to
336
+ * the caller. Undefined when there is none (or no runner). Its stderr is kept in
337
+ * {@link output} and handed to `onStderr` as it comes where the runner streams it (git's
338
+ * `copy_to_sideband`), else once it exited; either way all of it before `wait()` resolves.
339
+ *
340
+ * A runner that cannot start a hook it talks to (no `HookRunner.start`) gets a process that
341
+ * takes the whole stdin first (`interactive: false`): the hook runs once its stdin is closed.
342
+ */
343
+ start(name: string, options?: HookCallOptions & {
344
+ onStderr?: (text: string) => Promise<void> | void;
345
+ }): Promise<StartedHook | undefined>;
346
+ /** The invocation of one hook of `name` (see {@link runOne}). */
347
+ private invocationOf;
348
+ /** Runs one hook of `name` (see {@link run}). */
349
+ private runOne;
350
+ }
351
+ /** git's null object id of the length of `like` (sha1 when none is known). */
352
+ export declare function nullIdLike(like?: string): string;
353
+ /**
354
+ * The post-checkout hook (githooks(5)): the HEAD left and the one checked out (git's null id
355
+ * for none) and `1` for a branch switch, `0` for a path checkout. Its exit code (0 when no
356
+ * hook ran) becomes the command's exit status in git.
357
+ */
358
+ export declare function runPostCheckoutHook(hooks: HookSession, oldId: string | undefined, newId: string | undefined, branchSwitch: boolean, env?: Record<string, string>,
359
+ /** The directory it runs in (a FilesApi path), in place of the worktree top */
360
+ dir?: string,
361
+ /** Whether git's setup exported `GIT_PREFIX` (not for clone) */
362
+ prefix?: boolean,
363
+ /** Variables the hook runs without (`worktree add`: `GIT_DIR`, `GIT_WORK_TREE`) */
364
+ unsetEnv?: string[]): Promise<number>;
365
+ /** What the sequencer's hooks write: `COMMIT_EDITMSG` and the rest of the git directory's state. */
366
+ export interface SequencerHookState {
367
+ read(path: string): Promise<string | undefined>;
368
+ write(path: string, content: string): Promise<void>;
369
+ }
370
+ /**
371
+ * try_to_commit's prepare-commit-msg (sequencer.c `run_prepare_commit_msg_hook`): when the
372
+ * hook exists, the message written to COMMIT_EDITMSG, the hook told `message`, and the file's
373
+ * text taken back as the commit's message. A failing hook throws git's "'prepare-commit-msg'
374
+ * hook failed". Without the hook, the message as it is.
375
+ */
376
+ export declare function sequencerPrepareMessage(hooks: HookSession, state: SequencerHookState, message: string): Promise<string>;
377
+ /** try_to_commit's post-commit hook (`run_commit_hook(0, index_file, ..., "post-commit")`). */
378
+ export declare function sequencerPostCommit(hooks: HookSession): Promise<void>;
379
+ /**
380
+ * git's reference-transaction hook (refs.c `run_transaction_hook`) for a ref store's
381
+ * transactions: told `preparing` (2.5x), `prepared`, `committed` or `aborted` with an
382
+ * `<old> <new> <ref>` line per update (git 2.43 lists a symbolic ref the update went
383
+ * through, HEAD, ahead of the ref it names; 2.5x leaves it out); a refusal in `preparing`
384
+ * or `prepared` aborts the transaction. Calls about a transaction only the other git
385
+ * version makes (`context.only`) are left out.
386
+ */
387
+ export declare function refTransactionHookOf(hooks: HookSession,
388
+ /** How the hook runs beyond its state and stdin (the receive side: GIT_DIR, no prefix) */
389
+ runOptions?: Pick<HookCallOptions, "env" | "prefix">): RefTransactionHook;
390
+ /** How a sequencer runs `git commit` (sequencer.c `run_git_commit`), for its hooks. */
391
+ export interface GitCommitHookRun {
392
+ /** VERIFY_MSG: pre-commit and commit-msg run (else `git commit -n`) */
393
+ verify: boolean;
394
+ /** EDIT_MSG (`-e`): an editor runs, so the hooks get no `GIT_EDITOR=:` */
395
+ editor: boolean;
396
+ /** prepare-commit-msg's arguments after the message file (`message`, `commit HEAD`) */
397
+ hookArgs: string[];
398
+ /** Variables of the `git commit` run (`GIT_REFLOG_ACTION`) */
399
+ env?: Record<string, string>;
400
+ }
401
+ /**
402
+ * The hooks of a `git commit` a sequencer runs, up to the commit (builtin/commit.c
403
+ * `prepare_to_commit`): pre-commit (with VERIFY_MSG), `template` written to COMMIT_EDITMSG
404
+ * for prepare-commit-msg, the editor over what it left (`edit`), then commit-msg (with
405
+ * VERIFY_MSG). The file's text once they ran; a refusing hook throws {@link HookFailedError}.
406
+ */
407
+ export declare function gitCommitMessageHooks(hooks: HookSession, state: SequencerHookState, template: string, run: GitCommitHookRun, edit: (text: string) => string | Promise<string>): Promise<string>;
408
+ /**
409
+ * The hooks of a `git commit` a sequencer runs, once HEAD has moved: post-commit, then for an
410
+ * amend post-rewrite told `amend` with `<old> <new>` (commit_post_rewrite).
411
+ */
412
+ export declare function gitCommitAfterHooks(hooks: HookSession, run: GitCommitHookRun, amended?: {
413
+ from: string;
414
+ to: string;
415
+ }): Promise<void>;
416
+ //# sourceMappingURL=git-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-hooks.d.ts","sourceRoot":"","sources":["../../src/commands/git-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EAIvB,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAMvC,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,mFAAmF;IACnF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAA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;GAGG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,gBAAgB,EACrB,OAAO,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CAUf"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * The author and committer of the commits (and the tagger of the tags) our commands write,
3
+ * resolved as git's `ident.c` resolves them, so that the same commands run with the same
4
+ * environment give the same object ids as native git.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * const env = { readFile: async () => undefined, committer: { date: "1700000000 +0100" } };
9
+ * const config = { value: (key: string) => ({ "user.name": "Ada", "user.email": "ada@example.com" })[key] };
10
+ * resolveCommitterIdent(env, config);
11
+ * // { name: "Ada", email: "ada@example.com", timestamp: 1700000000, tzOffset: "+0100" }
12
+ * ```
13
+ *
14
+ * The order, per field, is git's `fmt_ident`:
15
+ *
16
+ * - the name and email: `GIT_AUTHOR_*` / `GIT_COMMITTER_*` (the host environment's `author` /
17
+ * `committer`), then `author.name` / `committer.name` (and `.email`), then `user.name` /
18
+ * `user.email`, then `$EMAIL` for the email (the host environment's `defaultEmail`). A
19
+ * variable set to an empty string counts; an empty `author.*` / `committer.*` does not.
20
+ * Any `*.email` key in the configuration, even empty, even the other role's, stops the
21
+ * email there: `user.email`, else empty (`<>`). Likewise `*.name` for the name;
22
+ * - with `user.useConfigOnly`, a commit or tag refuses an identity the configuration does not
23
+ * give, with git's message ({@link IdentityUnknownError});
24
+ * - a commit or tag refuses an empty name and a name of crud only ({@link InvalidIdentError});
25
+ * - the date: `GIT_AUTHOR_DATE` / `GIT_COMMITTER_DATE` in any form {@link parseGitDate} reads,
26
+ * else the clock with the local timezone offset.
27
+ *
28
+ * Where git would ask the system (the user's full name from passwd, `user@host`), a portable
29
+ * host knows nothing: the name or email of the command's other identity is used when it was
30
+ * given one explicitly (a commit with only `setAuthor` is committed by that author, dated
31
+ * now), else {@link DEFAULT_IDENT}'s, the identity the ref stores write in reflogs. Never
32
+ * "Unknown", and never an error where git fails to guess.
33
+ */
34
+ import type { PersonIdent } from "@statewalker/vcs-core";
35
+ import type { GitHostEnvironment, WorkingCopy } from "@statewalker/vcs-working-tree";
36
+ import { GitApiError } from "../errors/index.js";
37
+ export { localTimezoneOffset, parseGitDate } from "./git-date.js";
38
+ /** The identity of a commit nobody is configured for (the ref stores' reflog identity). */
39
+ export declare const DEFAULT_IDENT: {
40
+ readonly name: "webrun-vcs";
41
+ readonly email: "vcs@localhost";
42
+ };
43
+ /** What the resolver reads of the configuration: a value by its key, undefined when unset. */
44
+ export interface IdentConfig {
45
+ value(key: string): string | undefined;
46
+ }
47
+ /** Whose identity: git's `WANT_AUTHOR_IDENT` / `WANT_COMMITTER_IDENT`. */
48
+ export type IdentRole = "author" | "committer";
49
+ /** How an identity is resolved. */
50
+ export interface ResolveIdentOptions {
51
+ /** The clock, in seconds, when the variables give no date (default: now) */
52
+ now?: number;
53
+ /**
54
+ * The name and email used where git would ask the system (the full name from passwd,
55
+ * `user@host`): a command's other, explicitly given identity; {@link DEFAULT_IDENT}
56
+ * otherwise. Never its date: the date is the variables' or the clock's.
57
+ */
58
+ fallback?: Pick<PersonIdent, "name" | "email">;
59
+ /**
60
+ * git's `IDENT_STRICT` (default true, as for commits and tags): `user.useConfigOnly`
61
+ * refuses an identity the configuration does not give, and an empty name or one of crud
62
+ * only is refused ({@link InvalidIdentError}). Reflog lines are not strict.
63
+ */
64
+ strict?: boolean;
65
+ }
66
+ /**
67
+ * git's refusal of an identity it may not guess (`user.useConfigOnly`): the hint git prints
68
+ * and its `fatal:` line, as the message.
69
+ */
70
+ export declare class IdentityUnknownError extends GitApiError {
71
+ readonly role: IdentRole;
72
+ constructor(role: IdentRole, what: "name" | "email");
73
+ }
74
+ /**
75
+ * git's refusal of a name a commit or tag may not carry (`IDENT_STRICT`): an empty one
76
+ * (`empty ident name (for <email>) not allowed`, after the hint when the name came from
77
+ * `user.name`), or one of crud only (`name consists only of disallowed characters: <name>`).
78
+ */
79
+ export declare class InvalidIdentError extends GitApiError {
80
+ readonly role: IdentRole;
81
+ readonly reason: "empty" | "crud";
82
+ /**
83
+ * @param detail the email (for an empty name) or the name (crud only), as given
84
+ * @param hint whether git prints its hint first (the name came from the default)
85
+ */
86
+ constructor(role: IdentRole, reason: "empty" | "crud", detail: string, hint: boolean);
87
+ }
88
+ /** git's refusal of a `GIT_AUTHOR_DATE` / `GIT_COMMITTER_DATE` it cannot read. */
89
+ export declare class InvalidDateError extends GitApiError {
90
+ readonly date: string;
91
+ constructor(date: string);
92
+ }
93
+ /**
94
+ * A name or email as git writes it (`strbuf_addstr_without_crud`): crud trimmed from both
95
+ * ends, `<`, `>` and newlines dropped inside.
96
+ */
97
+ export declare function withoutCrud(text: string): string;
98
+ /**
99
+ * git's `fmt_ident` for `role` (not strict unless asked): the identity named by the
100
+ * environment and the configuration, undefined when neither names anyone (no name, email
101
+ * or date): a caller then decides (the reflog's store identity). A field git would guess
102
+ * from the system is {@link DEFAULT_IDENT}'s.
103
+ */
104
+ export declare function findIdent(role: IdentRole, environment: GitHostEnvironment | undefined, config: IdentConfig | undefined, options?: Omit<ResolveIdentOptions, "fallback">): PersonIdent | undefined;
105
+ /**
106
+ * The committer of a commit or the tagger of a tag made now, as git's
107
+ * `git_committer_info(IDENT_STRICT)` resolves it (see the module comment for the order).
108
+ */
109
+ export declare function resolveCommitterIdent(environment: GitHostEnvironment | undefined, config: IdentConfig | undefined, options?: ResolveIdentOptions): PersonIdent;
110
+ /**
111
+ * The author of a commit made now, as git's `git_author_info(IDENT_STRICT)` resolves it
112
+ * (see the module comment for the order).
113
+ */
114
+ export declare function resolveAuthorIdent(environment: GitHostEnvironment | undefined, config: IdentConfig | undefined, options?: ResolveIdentOptions): PersonIdent;
115
+ /**
116
+ * The date of an identity made now for `role`: `GIT_AUTHOR_DATE` / `GIT_COMMITTER_DATE`, else
117
+ * `now` (default the clock) in the local offset. git's date of `commit --author=<who>`.
118
+ */
119
+ export declare function resolveIdentDate(role: IdentRole, environment: GitHostEnvironment | undefined, now?: number): Pick<PersonIdent, "timestamp" | "tzOffset">;
120
+ /** The host environment a working copy's configuration carries, if any. */
121
+ export declare function hostEnvironmentOf(workingCopy: WorkingCopy): GitHostEnvironment | undefined;
122
+ /** The configuration of a working copy as the resolver reads it. */
123
+ export declare function identConfigOf(workingCopy: WorkingCopy): IdentConfig | undefined;
124
+ /** {@link resolveCommitterIdent} on a working copy's environment and configuration. */
125
+ export declare function committerIdentOf(workingCopy: WorkingCopy, options?: ResolveIdentOptions): PersonIdent;
126
+ /** {@link resolveAuthorIdent} on a working copy's environment and configuration. */
127
+ export declare function authorIdentOf(workingCopy: WorkingCopy, options?: ResolveIdentOptions): PersonIdent;
128
+ //# sourceMappingURL=git-ident.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-ident.d.ts","sourceRoot":"","sources":["../../src/commands/git-ident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,2FAA2F;AAC3F,eAAO,MAAM,aAAa;aAAK,IAAI,EAAE,YAAY;aAAE,KAAK,EAAE,eAAe;CAAW,CAAC;AAErF,8FAA8F;AAC9F,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE/C,mCAAmC;AACnC,MAAM,WA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GAAE,mBAAwB,GAChC,WAAW,CAEb;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,kBAAkB,GAAG,SAAS,EAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,GAAE,mBAAwB,GAChC,WAAW,CAEb;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,kBAAkB,GAAG,SAAS,EAC3C,GAAG,CAAC,EAAE,MAAM,GACX,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAAC,CAS7C;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,kBAAkB,GAAG,SAAS,CAE1F;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAE/E;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,OAAO,GAAE,mBAAwB,GAChC,WAAW,CAEb;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAC3B,WAAW,EAAE,WAAW,EACxB,OAAO,GAAE,mBAAwB,GAChC,WAAW,CAEb"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * `git hook run` and `git hook list` (builtin/hook.c) as library commands.
3
+ *
4
+ * ```typescript
5
+ * const result = await git.hookRun("pre-commit").setArgs(["--check"]).call();
6
+ * result.exitCode; // the hooks' exit codes or'ed together, 1 when there is none
7
+ * result.output; // what git writes on stderr: the hooks' output and git's messages
8
+ *
9
+ * const listed = await git.hookList("pre-commit").setShowScope(true).call();
10
+ * listed.stdout; // "local\tlint\nhook from hookdir\n"
11
+ * ```
12
+ */
13
+ import { GitCommand } from "../git-command.js";
14
+ import { type HookListEntry } from "./git-hooks.js";
15
+ /** What {@link HookRunCommand} gave. */
16
+ export interface HookRunResult {
17
+ /**
18
+ * git's exit status: the hooks' exit codes or'ed together (0 when they all succeed or,
19
+ * with `setIgnoreMissing`, none exists), 1 for a missing or unknown hook, 128 where git
20
+ * dies (a broken `hook.*` configuration, a `--to-stdin` file it cannot open)
21
+ */
22
+ exitCode: number;
23
+ /** Whether a hook ran */
24
+ ran: boolean;
25
+ /**
26
+ * git's stderr: what the hooks wrote (their stdout included, as `git hook run` sends it
27
+ * there), git's hints and warnings, and its `error:` / `fatal:` line
28
+ */
29
+ output: string;
30
+ }
31
+ /**
32
+ * Run a hook, as `git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [--
33
+ * <hook-args>]`.
34
+ *
35
+ * The hooks of the name run as git's `run_hooks_opt` runs them, through the host
36
+ * environment's hook runner: git 2.5x's configured hooks (`hook.<name>.event` /
37
+ * `.command` / `.enabled`) first, then the hooks directory's script, each in the worktree
38
+ * top (the git directory when bare), their output gathered in {@link HookRunResult.output}
39
+ * (and {@link getHookOutput}). A missing hook is git's "cannot find a hook named" error
40
+ * (exit 1) unless `setIgnoreMissing`; git 2.5x refuses a name that is not one of git's
41
+ * hooks unless `setAllowUnknownHookName` (2.43 runs any name). The `--to-stdin` file is
42
+ * read for each hook only when one runs; a relative path is from the directory git runs
43
+ * in (the worktree top).
44
+ */
45
+ export declare class HookRunCommand extends GitCommand<HookRunResult> {
46
+ private name?;
47
+ private args;
48
+ private ignoreMissing;
49
+ private toStdin?;
50
+ private allowUnknown;
51
+ /** The hook to run (`<hook-name>`). */
52
+ setHookName(name: string): this;
53
+ /** The arguments given to each hook (`-- <hook-args>`). */
54
+ setArgs(args: string[]): this;
55
+ /** `--ignore-missing`: no hook of the name is no error. */
56
+ setIgnoreMissing(ignore: boolean): this;
57
+ /** `--to-stdin=<path>`: the file each hook reads on stdin. */
58
+ setToStdin(path: string | undefined): this;
59
+ /** `--allow-unknown-hook-name` (git 2.5x): run a name that is not one of git's hooks. */
60
+ setAllowUnknownHookName(allow: boolean): this;
61
+ call(): Promise<HookRunResult>;
62
+ }
63
+ /** What {@link HookListCommand} gave. */
64
+ export interface HookListResult {
65
+ /** git's exit status: 0, or 1 when no hook was found or the name is unknown */
66
+ exitCode: number;
67
+ /** The hooks of the event in the order they run (disabled configured ones included) */
68
+ hooks: HookListEntry[];
69
+ /** git's stdout: a line (`-z`: a NUL-ended record) per hook */
70
+ stdout: string;
71
+ /** git's stderr: its hints, warnings and `error:` line */
72
+ output: string;
73
+ }
74
+ /**
75
+ * List the hooks of an event, as git 2.5x's `git hook list [-z] [--show-scope] <hook-name>`:
76
+ * a configured hook by its friendly name (`disabled\t` or `event-disabled\t` before it when
77
+ * it does not run, its config scope first with `setShowScope`), the hooks directory's script
78
+ * as `hook from hookdir`. No hook is git's "no hooks found" warning (exit 1). git 2.43 has no
79
+ * `git hook list`: the command throws its usage error there.
80
+ */
81
+ export declare class HookListCommand extends GitCommand<HookListResult> {
82
+ private name?;
83
+ private nul;
84
+ private showScope;
85
+ private allowUnknown;
86
+ /** The event whose hooks to list (`<hook-name>`). */
87
+ setHookName(name: string): this;
88
+ /** `-z`: end each record with NUL instead of a newline. */
89
+ setNullTerminated(nul: boolean): this;
90
+ /** `--show-scope`: the config scope (`local`, `global`, ...) before each configured hook. */
91
+ setShowScope(show: boolean): this;
92
+ /** `--allow-unknown-hook-name`: list a name that is not one of git's hooks. */
93
+ setAllowUnknownHookName(allow: boolean): this;
94
+ call(): Promise<HookListResult>;
95
+ }
96
+ //# sourceMappingURL=hook-command.d.ts.map