@statewalker/vcs-commands 0.13.0 → 0.15.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 (304) hide show
  1. package/dist/commands/add-command.d.ts.map +1 -1
  2. package/dist/commands/add-patch/patch-backend.d.ts +1 -1
  3. package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
  4. package/dist/commands/archive/archive-command.d.ts +6 -2
  5. package/dist/commands/archive/archive-command.d.ts.map +1 -1
  6. package/dist/commands/archive/remote-archive-command.d.ts +27 -2
  7. package/dist/commands/archive/remote-archive-command.d.ts.map +1 -1
  8. package/dist/commands/archive/upload-archive-writer.d.ts +11 -5
  9. package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -1
  10. package/dist/commands/branch-command.d.ts +14 -2
  11. package/dist/commands/branch-command.d.ts.map +1 -1
  12. package/dist/commands/bundle/bundle-format.d.ts +6 -1
  13. package/dist/commands/bundle/bundle-format.d.ts.map +1 -1
  14. package/dist/commands/bundle/bundle-uri-host.d.ts +12 -1
  15. package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -1
  16. package/dist/commands/bundle/bundle-uri.d.ts +7 -1
  17. package/dist/commands/bundle/bundle-uri.d.ts.map +1 -1
  18. package/dist/commands/bundle/bundle-verify.d.ts +4 -1
  19. package/dist/commands/bundle/bundle-verify.d.ts.map +1 -1
  20. package/dist/commands/cat-file/batch-format.d.ts +8 -12
  21. package/dist/commands/cat-file/batch-format.d.ts.map +1 -1
  22. package/dist/commands/cat-file/cat-file-command.d.ts +39 -5
  23. package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -1
  24. package/dist/commands/check-ignore-command.d.ts.map +1 -1
  25. package/dist/commands/checkout-command.d.ts +4 -0
  26. package/dist/commands/checkout-command.d.ts.map +1 -1
  27. package/dist/commands/checkout-paths.d.ts +9 -0
  28. package/dist/commands/checkout-paths.d.ts.map +1 -1
  29. package/dist/commands/cherry-pick-command.d.ts +3 -0
  30. package/dist/commands/cherry-pick-command.d.ts.map +1 -1
  31. package/dist/commands/clean-interactive.d.ts +0 -9
  32. package/dist/commands/clean-interactive.d.ts.map +1 -1
  33. package/dist/commands/clone-command.d.ts +17 -0
  34. package/dist/commands/clone-command.d.ts.map +1 -1
  35. package/dist/commands/column/column-config.d.ts +23 -0
  36. package/dist/commands/column/column-config.d.ts.map +1 -0
  37. package/dist/commands/column/column-layout.d.ts +129 -0
  38. package/dist/commands/column/column-layout.d.ts.map +1 -0
  39. package/dist/commands/column/index.d.ts +3 -0
  40. package/dist/commands/column/index.d.ts.map +1 -0
  41. package/dist/commands/column-command.d.ts +59 -0
  42. package/dist/commands/column-command.d.ts.map +1 -0
  43. package/dist/commands/comment-char-config.d.ts +15 -0
  44. package/dist/commands/comment-char-config.d.ts.map +1 -1
  45. package/dist/commands/commit-command.d.ts +30 -2
  46. package/dist/commands/commit-command.d.ts.map +1 -1
  47. package/dist/commands/config-command.d.ts +12 -0
  48. package/dist/commands/config-command.d.ts.map +1 -1
  49. package/dist/commands/credential-helper.d.ts +214 -0
  50. package/dist/commands/credential-helper.d.ts.map +1 -0
  51. package/dist/commands/default-branch.d.ts +33 -3
  52. package/dist/commands/default-branch.d.ts.map +1 -1
  53. package/dist/commands/diff-color-config.d.ts +4 -0
  54. package/dist/commands/diff-color-config.d.ts.map +1 -1
  55. package/dist/commands/diff-command.d.ts +12 -0
  56. package/dist/commands/diff-command.d.ts.map +1 -1
  57. package/dist/commands/fast-export/fast-export-command.d.ts +89 -2
  58. package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -1
  59. package/dist/commands/fast-export/fast-import-command.d.ts +113 -8
  60. package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -1
  61. package/dist/commands/fast-export/fast-stream-support.d.ts +0 -9
  62. package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -1
  63. package/dist/commands/fetch-command.d.ts +23 -1
  64. package/dist/commands/fetch-command.d.ts.map +1 -1
  65. package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -1
  66. package/dist/commands/git-hooks.d.ts +31 -3
  67. package/dist/commands/git-hooks.d.ts.map +1 -1
  68. package/dist/commands/history-command.d.ts +173 -7
  69. package/dist/commands/history-command.d.ts.map +1 -1
  70. package/dist/commands/index-host.d.ts +19 -0
  71. package/dist/commands/index-host.d.ts.map +1 -1
  72. package/dist/commands/index-refresh.d.ts +36 -0
  73. package/dist/commands/index-refresh.d.ts.map +1 -0
  74. package/dist/commands/index.d.ts +9 -0
  75. package/dist/commands/index.d.ts.map +1 -1
  76. package/dist/commands/index.js +7 -6
  77. package/dist/commands/init-command.d.ts +20 -0
  78. package/dist/commands/init-command.d.ts.map +1 -1
  79. package/dist/commands/local-transport.d.ts +40 -2
  80. package/dist/commands/local-transport.d.ts.map +1 -1
  81. package/dist/commands/log-command.d.ts +7 -0
  82. package/dist/commands/log-command.d.ts.map +1 -1
  83. package/dist/commands/log-output.d.ts +11 -0
  84. package/dist/commands/log-output.d.ts.map +1 -1
  85. package/dist/commands/ls-tree-command.d.ts +10 -0
  86. package/dist/commands/ls-tree-command.d.ts.map +1 -1
  87. package/dist/commands/maintenance-schedule-command.d.ts +122 -0
  88. package/dist/commands/maintenance-schedule-command.d.ts.map +1 -0
  89. package/dist/commands/merge-command.d.ts +13 -1
  90. package/dist/commands/merge-command.d.ts.map +1 -1
  91. package/dist/commands/merge-index-command.d.ts +42 -0
  92. package/dist/commands/merge-index-command.d.ts.map +1 -0
  93. package/dist/commands/merge-one-file.d.ts +129 -0
  94. package/dist/commands/merge-one-file.d.ts.map +1 -0
  95. package/dist/commands/merge-support.d.ts +40 -4
  96. package/dist/commands/merge-support.d.ts.map +1 -1
  97. package/dist/commands/object-disk-info.d.ts +35 -0
  98. package/dist/commands/object-disk-info.d.ts.map +1 -0
  99. package/dist/commands/octopus-merge.d.ts +3 -3
  100. package/dist/commands/octopus-merge.d.ts.map +1 -1
  101. package/dist/commands/plumbing-input.d.ts.map +1 -1
  102. package/dist/commands/promisor-remote-reply.d.ts +31 -4
  103. package/dist/commands/promisor-remote-reply.d.ts.map +1 -1
  104. package/dist/commands/promisor-remote.d.ts +8 -1
  105. package/dist/commands/promisor-remote.d.ts.map +1 -1
  106. package/dist/commands/pull-command.d.ts +55 -7
  107. package/dist/commands/pull-command.d.ts.map +1 -1
  108. package/dist/commands/push-command.d.ts +18 -1
  109. package/dist/commands/push-command.d.ts.map +1 -1
  110. package/dist/commands/range-diff/range-diff-command.d.ts +37 -1
  111. package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -1
  112. package/dist/commands/rebase-command.d.ts +13 -1
  113. package/dist/commands/rebase-command.d.ts.map +1 -1
  114. package/dist/commands/ref-filter/for-each-ref-command.d.ts +3 -2
  115. package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -1
  116. package/dist/commands/ref-filter/index.d.ts +1 -0
  117. package/dist/commands/ref-filter/index.d.ts.map +1 -1
  118. package/dist/commands/ref-filter/peel-limit.d.ts +8 -0
  119. package/dist/commands/ref-filter/peel-limit.d.ts.map +1 -0
  120. package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -1
  121. package/dist/commands/ref-filter/ref-format.d.ts +26 -1
  122. package/dist/commands/ref-filter/ref-format.d.ts.map +1 -1
  123. package/dist/commands/ref-filter/ref-listing-command.d.ts +9 -0
  124. package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -1
  125. package/dist/commands/remote-transport.d.ts +27 -0
  126. package/dist/commands/remote-transport.d.ts.map +1 -1
  127. package/dist/commands/repack-command.d.ts +18 -2
  128. package/dist/commands/repack-command.d.ts.map +1 -1
  129. package/dist/commands/repo-command.d.ts +2 -7
  130. package/dist/commands/repo-command.d.ts.map +1 -1
  131. package/dist/commands/reset-command.d.ts +4 -1
  132. package/dist/commands/reset-command.d.ts.map +1 -1
  133. package/dist/commands/restore-command.d.ts.map +1 -1
  134. package/dist/commands/rev-list-command.d.ts +65 -0
  135. package/dist/commands/rev-list-command.d.ts.map +1 -1
  136. package/dist/commands/revert-command.d.ts +3 -0
  137. package/dist/commands/revert-command.d.ts.map +1 -1
  138. package/dist/commands/revision-filenames.d.ts.map +1 -1
  139. package/dist/commands/revision-range.d.ts +17 -0
  140. package/dist/commands/revision-range.d.ts.map +1 -1
  141. package/dist/commands/revision-resolver.d.ts +12 -0
  142. package/dist/commands/revision-resolver.d.ts.map +1 -1
  143. package/dist/commands/serve-repository.d.ts +21 -4
  144. package/dist/commands/serve-repository.d.ts.map +1 -1
  145. package/dist/commands/served-lazy-fetch.d.ts +61 -0
  146. package/dist/commands/served-lazy-fetch.d.ts.map +1 -0
  147. package/dist/commands/signing.d.ts +37 -4
  148. package/dist/commands/signing.d.ts.map +1 -1
  149. package/dist/commands/split-cmdline.d.ts +6 -0
  150. package/dist/commands/split-cmdline.d.ts.map +1 -0
  151. package/dist/commands/status-color-config.d.ts +33 -0
  152. package/dist/commands/status-color-config.d.ts.map +1 -0
  153. package/dist/commands/status-command.d.ts +15 -0
  154. package/dist/commands/status-command.d.ts.map +1 -1
  155. package/dist/commands/status-format.d.ts +46 -4
  156. package/dist/commands/status-format.d.ts.map +1 -1
  157. package/dist/commands/tag-command.d.ts +15 -1
  158. package/dist/commands/tag-command.d.ts.map +1 -1
  159. package/dist/commands/tree-restore.d.ts +14 -0
  160. package/dist/commands/tree-restore.d.ts.map +1 -1
  161. package/dist/commands/verify-command.d.ts +22 -2
  162. package/dist/commands/verify-command.d.ts.map +1 -1
  163. package/dist/commands/worktree-add-command.d.ts.map +1 -1
  164. package/dist/commands/worktree-overwrite-checks.d.ts +31 -6
  165. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
  166. package/dist/{commands-CPceUCP2.js → commands-DT3VEv50.js} +15168 -16842
  167. package/dist/errors/commit-errors.d.ts +37 -1
  168. package/dist/errors/commit-errors.d.ts.map +1 -1
  169. package/dist/errors/git-api-error.d.ts +6 -0
  170. package/dist/errors/git-api-error.d.ts.map +1 -1
  171. package/dist/errors/index.js +44 -3
  172. package/dist/{fsck-tbrPZX2q.js → fsck-BZ508Elg.js} +2 -2
  173. package/dist/git-command.d.ts +33 -1
  174. package/dist/git-command.d.ts.map +1 -1
  175. package/dist/git.d.ts +104 -1
  176. package/dist/git.d.ts.map +1 -1
  177. package/dist/index.js +8 -7
  178. package/dist/{remote-transport-C0OSJtor.js → local-transport-D98U6p4d.js} +228 -692
  179. package/dist/{maintenance-run-command-UiSIaeP8.js → maintenance-run-command-DZFnbnbo.js} +2366 -108
  180. package/dist/remote-config/remote-config-store.d.ts +6 -0
  181. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  182. package/dist/remote-transport-zvSqwpOB.js +4865 -0
  183. package/dist/results/cherry-pick-result.d.ts +4 -3
  184. package/dist/results/cherry-pick-result.d.ts.map +1 -1
  185. package/dist/results/diff-output.d.ts +7 -0
  186. package/dist/results/diff-output.d.ts.map +1 -1
  187. package/dist/results/diff-words.d.ts +14 -3
  188. package/dist/results/diff-words.d.ts.map +1 -1
  189. package/dist/results/index.js +1 -1
  190. package/dist/results/line-prefix-sink.d.ts +50 -0
  191. package/dist/results/line-prefix-sink.d.ts.map +1 -0
  192. package/dist/results/merge-result.d.ts +4 -3
  193. package/dist/results/merge-result.d.ts.map +1 -1
  194. package/dist/results/rebase-result.d.ts +5 -0
  195. package/dist/results/rebase-result.d.ts.map +1 -1
  196. package/dist/results/revert-result.d.ts +4 -3
  197. package/dist/results/revert-result.d.ts.map +1 -1
  198. package/dist/{results-CkS1p1CH.js → results-rF81cQse.js} +1788 -247
  199. package/dist/transport-command.d.ts +13 -0
  200. package/dist/transport-command.d.ts.map +1 -1
  201. package/package.json +21 -13
  202. package/src/commands/add-command.ts +15 -2
  203. package/src/commands/add-patch/patch-backend.ts +6 -44
  204. package/src/commands/archive/archive-command.ts +7 -3
  205. package/src/commands/archive/remote-archive-command.ts +45 -4
  206. package/src/commands/archive/upload-archive-writer.ts +34 -22
  207. package/src/commands/branch-command.ts +57 -4
  208. package/src/commands/bundle/bundle-format.ts +10 -2
  209. package/src/commands/bundle/bundle-uri-host.ts +71 -11
  210. package/src/commands/bundle/bundle-uri.ts +11 -4
  211. package/src/commands/bundle/bundle-verify.ts +4 -1
  212. package/src/commands/cat-file/batch-format.ts +17 -18
  213. package/src/commands/cat-file/cat-file-command.ts +182 -48
  214. package/src/commands/check-ignore-command.ts +110 -21
  215. package/src/commands/checkout-command.ts +149 -21
  216. package/src/commands/checkout-index-command.ts +2 -1
  217. package/src/commands/checkout-paths.ts +13 -0
  218. package/src/commands/cherry-pick-command.ts +9 -0
  219. package/src/commands/clean-interactive.ts +20 -74
  220. package/src/commands/clone-command.ts +102 -11
  221. package/src/commands/column/column-config.ts +63 -0
  222. package/src/commands/column/column-layout.ts +396 -0
  223. package/src/commands/column/index.ts +2 -0
  224. package/src/commands/column-command.ts +171 -0
  225. package/src/commands/comment-char-config.ts +42 -0
  226. package/src/commands/commit-command.ts +93 -18
  227. package/src/commands/config-command.ts +28 -0
  228. package/src/commands/credential-helper.ts +807 -0
  229. package/src/commands/default-branch.ts +57 -5
  230. package/src/commands/diff-color-config.ts +23 -10
  231. package/src/commands/diff-command.ts +25 -2
  232. package/src/commands/fast-export/fast-export-command.ts +661 -35
  233. package/src/commands/fast-export/fast-import-command.ts +694 -94
  234. package/src/commands/fast-export/fast-stream-support.ts +18 -1
  235. package/src/commands/fetch-command.ts +116 -16
  236. package/src/commands/fsck/fsck-object-checks.ts +3 -1
  237. package/src/commands/git-hooks.ts +96 -5
  238. package/src/commands/history-command.ts +952 -20
  239. package/src/commands/index-host.ts +51 -0
  240. package/src/commands/index-refresh.ts +121 -0
  241. package/src/commands/index.ts +9 -0
  242. package/src/commands/init-command.ts +57 -4
  243. package/src/commands/legacy-remotes.ts +4 -20
  244. package/src/commands/local-transport.ts +183 -18
  245. package/src/commands/log-command.ts +39 -1
  246. package/src/commands/log-output.ts +31 -4
  247. package/src/commands/ls-tree-command.ts +20 -12
  248. package/src/commands/maintenance-schedule-command.ts +418 -0
  249. package/src/commands/merge-command.ts +42 -8
  250. package/src/commands/merge-index-command.ts +202 -0
  251. package/src/commands/merge-one-file.ts +451 -0
  252. package/src/commands/merge-support.ts +169 -15
  253. package/src/commands/object-disk-info.ts +169 -0
  254. package/src/commands/octopus-merge.ts +37 -128
  255. package/src/commands/plumbing-input.ts +3 -1
  256. package/src/commands/promisor-remote-reply.ts +338 -56
  257. package/src/commands/promisor-remote.ts +39 -6
  258. package/src/commands/pull-command.ts +173 -27
  259. package/src/commands/push-command.ts +55 -6
  260. package/src/commands/range-diff/range-diff-command.ts +86 -3
  261. package/src/commands/read-tree-command.ts +2 -2
  262. package/src/commands/rebase-command.ts +46 -1
  263. package/src/commands/ref-filter/for-each-ref-command.ts +4 -3
  264. package/src/commands/ref-filter/index.ts +1 -0
  265. package/src/commands/ref-filter/peel-limit.ts +7 -0
  266. package/src/commands/ref-filter/ref-filter.ts +68 -7
  267. package/src/commands/ref-filter/ref-format.ts +85 -11
  268. package/src/commands/ref-filter/ref-listing-command.ts +30 -0
  269. package/src/commands/remote-command.ts +2 -2
  270. package/src/commands/remote-transport.ts +66 -3
  271. package/src/commands/repack-command.ts +75 -9
  272. package/src/commands/repo-command.ts +6 -70
  273. package/src/commands/reset-command.ts +11 -1
  274. package/src/commands/restore-command.ts +1 -0
  275. package/src/commands/rev-list-command.ts +205 -3
  276. package/src/commands/revert-command.ts +9 -0
  277. package/src/commands/revision-filenames.ts +32 -4
  278. package/src/commands/revision-range.ts +2 -2
  279. package/src/commands/revision-resolver.ts +21 -1
  280. package/src/commands/serve-repository.ts +42 -11
  281. package/src/commands/served-lazy-fetch.ts +164 -0
  282. package/src/commands/signing.ts +103 -12
  283. package/src/commands/split-cmdline.ts +32 -0
  284. package/src/commands/status-color-config.ts +92 -0
  285. package/src/commands/status-command.ts +50 -2
  286. package/src/commands/status-format.ts +198 -50
  287. package/src/commands/tag-command.ts +57 -2
  288. package/src/commands/tree-restore.ts +17 -0
  289. package/src/commands/verify-command.ts +84 -12
  290. package/src/commands/worktree-add-command.ts +2 -0
  291. package/src/commands/worktree-overwrite-checks.ts +75 -14
  292. package/src/errors/commit-errors.ts +52 -2
  293. package/src/errors/git-api-error.ts +7 -0
  294. package/src/git-command.ts +105 -4
  295. package/src/git.ts +153 -0
  296. package/src/remote-config/remote-config-store.ts +16 -0
  297. package/src/results/cherry-pick-result.ts +4 -3
  298. package/src/results/diff-output.ts +8 -0
  299. package/src/results/diff-words.ts +160 -32
  300. package/src/results/line-prefix-sink.ts +102 -0
  301. package/src/results/merge-result.ts +4 -3
  302. package/src/results/rebase-result.ts +5 -0
  303. package/src/results/revert-result.ts +4 -3
  304. package/src/transport-command.ts +79 -3
@@ -50,6 +50,12 @@ import {
50
50
  type StatusSide,
51
51
  submoduleToken,
52
52
  } from "../results/status-result.js";
53
+ import {
54
+ applyColumnOption,
55
+ columnConfigOf,
56
+ finalizeColopts,
57
+ terminalColumnsOf,
58
+ } from "./column/index.js";
53
59
  import { coreBool, worktreeModeTrust } from "./core-config.js";
54
60
  import { DiffCommand } from "./diff-command.js";
55
61
  import { hostEnvironmentOf } from "./git-ident.js";
@@ -65,6 +71,7 @@ import {
65
71
  untrackedScanPathspec,
66
72
  } from "./pathspec.js";
67
73
  import { PathspecAttributes } from "./pathspec-attributes.js";
74
+ import { readStatusColors } from "./status-color-config.js";
68
75
  import {
69
76
  type CommitWhence,
70
77
  formatStatusText,
@@ -593,6 +600,21 @@ export class StatusCommand extends GitCommand<Status> {
593
600
  ? !cfgBool(config, "status.aheadBehind", true)
594
601
  : false;
595
602
  const showStash = options.showStash ?? cfgBool(config, "status.showStash", false);
603
+ // git_status_config: the colors (a bad slot dies before anything is read, the commit
604
+ // template's run too); never in a file (the commit template: GIT_COLOR_NEVER)
605
+ const palette = readStatusColors(this.workingCopy, {
606
+ ...(options.color !== undefined ? { color: options.color } : {}),
607
+ ...(options.colorCompatibility ? { compatibility: options.colorCompatibility } : {}),
608
+ });
609
+ const colors = options.toFile ? undefined : palette;
610
+ // git_status_config's column.ui/column.status (a bad value dies), then --column; the
611
+ // commit template's s.colopts is 0
612
+ let colopts: number | undefined;
613
+ if (options.commitTemplate !== true) {
614
+ colopts = columnConfigOf(this.workingCopy, "status");
615
+ if (options.column !== undefined) colopts = applyColumnOption(colopts, options.column);
616
+ colopts = finalizeColopts(colopts);
617
+ }
596
618
  const status = await this.call();
597
619
  const hints = options.hints ?? cfgBool(config, "advice.statusHints", true);
598
620
  const commentPrefix =
@@ -621,6 +643,7 @@ export class StatusCommand extends GitCommand<Status> {
621
643
  worktreeChanges: info.worktreeChanges,
622
644
  referenceId,
623
645
  commentPrefix,
646
+ headerColor: colors?.header ?? "",
624
647
  });
625
648
  }
626
649
  const summaryLimit = resolvedFormat === "long" ? this.submoduleSummaryLimit() : 0;
@@ -646,6 +669,11 @@ export class StatusCommand extends GitCommand<Status> {
646
669
  aheadBehindQuick: quick,
647
670
  ...(verbose !== undefined ? { verbose } : {}),
648
671
  ...(submoduleSummary ? { submoduleSummary } : {}),
672
+ ...(colors ? { colors } : {}),
673
+ ...(options.colorCompatibility ? { compatibility: options.colorCompatibility } : {}),
674
+ ...(colopts
675
+ ? { colopts, termColumns: terminalColumnsOf(this.workingCopy, options.columns) }
676
+ : {}),
649
677
  });
650
678
  return {
651
679
  ...out,
@@ -752,10 +780,15 @@ export class StatusCommand extends GitCommand<Status> {
752
780
  worktreeChanges: boolean;
753
781
  referenceId: ObjectId | undefined;
754
782
  commentPrefix: string | undefined;
783
+ /** The header's color (`-vv`'s headers are status_printf_ln in it) */
784
+ headerColor: string;
755
785
  },
756
786
  ): Promise<string> {
757
- const p = (text: string) =>
758
- o.commentPrefix !== undefined ? `${o.commentPrefix}${text ? ` ${text}` : ""}\n` : `${text}\n`;
787
+ const p = (text: string) => {
788
+ const line =
789
+ o.commentPrefix !== undefined ? `${o.commentPrefix}${text ? ` ${text}` : ""}` : text;
790
+ return o.headerColor ? `${o.headerColor}${line}\x1b[m\n` : `${line}\n`;
791
+ };
759
792
  let out = "";
760
793
  if (o.toFile && !o.cutLineAdded) out += cutLine(o.commentPrefix ?? "#");
761
794
  const twoLevels = level > 1;
@@ -1592,6 +1625,21 @@ export interface StatusCallTextOptions {
1592
1625
  toFile?: boolean;
1593
1626
  /** The cut line was written already (`s->added_cut_line`) */
1594
1627
  cutLineAdded?: boolean;
1628
+ /**
1629
+ * A color option over `color.status`/`color.ui` (true is `always`); the long and short
1630
+ * formats only, never in a file ({@link toFile}). `auto` is no color (no terminal).
1631
+ */
1632
+ color?: boolean | "always" | "never" | "auto";
1633
+ /** 2.43 knows no `#rgb` colors and leaves `-s -z`'s `??`/`!!` uncolored (default 2.56) */
1634
+ colorCompatibility?: "2.43" | "2.56";
1635
+ /**
1636
+ * `--column` (`true`: `always`), `--column=<options>` or `--no-column` (`false`) over
1637
+ * `column.ui`/`column.status`: the long format's untracked and ignored lists in columns
1638
+ * (`auto` never: no terminal). The commit template never lays out.
1639
+ */
1640
+ column?: string | boolean;
1641
+ /** The terminal's width columns fill (`$COLUMNS`; default the host's, else 80) */
1642
+ columns?: number;
1595
1643
  }
1596
1644
 
1597
1645
  /** What `StatusCommand.callText` gives: the text, the status, and git's warnings. */
@@ -16,6 +16,7 @@ import { compareGitPaths } from "@statewalker/vcs-utils/encoding";
16
16
  import { quoteCStyleBody } from "../results/quote-path.js";
17
17
  import type { Status, StatusFileEntry } from "../results/status-result.js";
18
18
  import { formatStatusPorcelain, submoduleToken } from "../results/status-result.js";
19
+ import { columnActive, printColumns } from "./column/index.js";
19
20
  import type { IgnoredMode, UntrackedFilesMode } from "./status-command.js";
20
21
  import type { TrackingStat } from "./tracking-info.js";
21
22
 
@@ -76,6 +77,61 @@ export interface StatusHeader {
76
77
  /** Where the commit comes from (`enum commit_whence`): the hints of the headers depend on it. */
77
78
  export type CommitWhence = "commit" | "merge" | "cherry-pick" | "rebase-pick";
78
79
 
80
+ /**
81
+ * wt-status.c's color slots (`enum color_wt_status`, builtin/commit.c's `color_status_slots`):
82
+ * each an escape sequence ("" for none). `branch` undefined is git's NIL: the header's.
83
+ */
84
+ export interface StatusColors {
85
+ header: string;
86
+ /** `updated` (alias `added`) */
87
+ updated: string;
88
+ changed: string;
89
+ untracked: string;
90
+ noBranch: string;
91
+ unmerged: string;
92
+ localBranch: string;
93
+ remoteBranch: string;
94
+ /** undefined: GIT_COLOR_NIL, the header's color */
95
+ branch?: string;
96
+ }
97
+
98
+ /** wt-status.c's `default_wt_status_colors`. */
99
+ export const DEFAULT_STATUS_COLORS: Readonly<StatusColors> = Object.freeze({
100
+ header: "",
101
+ updated: "\x1b[32m",
102
+ changed: "\x1b[31m",
103
+ untracked: "\x1b[31m",
104
+ noBranch: "\x1b[31m",
105
+ unmerged: "\x1b[31m",
106
+ localBranch: "\x1b[32m",
107
+ remoteBranch: "\x1b[31m",
108
+ });
109
+
110
+ const COLOR_RESET = "\x1b[m";
111
+
112
+ /** color.c's `color_print_strbuf`: the text between the color and a reset, if any color. */
113
+ function paint(color: string, text: string): string {
114
+ return color ? `${color}${text}${COLOR_RESET}` : text;
115
+ }
116
+
117
+ /** The colors of the human formats, all "" without a palette (`want_color` false). */
118
+ function slotsOf(colors: StatusColors | undefined): Required<StatusColors> {
119
+ if (!colors) {
120
+ return {
121
+ header: "",
122
+ updated: "",
123
+ changed: "",
124
+ untracked: "",
125
+ noBranch: "",
126
+ unmerged: "",
127
+ localBranch: "",
128
+ remoteBranch: "",
129
+ branch: "",
130
+ };
131
+ }
132
+ return { ...colors, branch: colors.branch ?? colors.header };
133
+ }
134
+
79
135
  /** The format and options of {@link formatStatusText}. */
80
136
  export interface StatusTextOptions {
81
137
  format: "long" | "short" | "porcelain" | "porcelain-v2";
@@ -117,6 +173,20 @@ export interface StatusTextOptions {
117
173
  * under their headers (wt_longstatus_print_submodule_summary)
118
174
  */
119
175
  submoduleSummary?: { staged: string; unstaged: string };
176
+ /**
177
+ * The palette of the long and short formats (`color.status`); undefined: no color.
178
+ * Porcelain v1 and v2 never color.
179
+ */
180
+ colors?: StatusColors;
181
+ /** git 2.43 leaves `-s -z`'s `??` and `!!` uncolored (default 2.56) */
182
+ compatibility?: "2.43" | "2.56";
183
+ /**
184
+ * The long format's untracked and ignored lists in columns (`--column`, `column.status`):
185
+ * the finalized `colopts`; undefined or inactive: one path per line
186
+ */
187
+ colopts?: number;
188
+ /** term_columns for {@link colopts} (default 80) */
189
+ termColumns?: number;
120
190
  }
121
191
 
122
192
  /** The text and whether the status has something to commit (`s->committable`). */
@@ -240,15 +310,17 @@ function shortStatus(status: Status, header: StatusHeader, options: StatusTextOp
240
310
  const z = options.z === true;
241
311
  const fully = options.quotePath ?? true;
242
312
  const short = options.format === "short";
313
+ // wt_porcelain_print: GIT_COLOR_NEVER
314
+ const c = slotsOf(short ? options.colors : undefined);
243
315
  const eol = z ? "\0" : "\n";
244
316
  let out = "";
245
- if (options.branch) out += shortTracking(header, options) + eol;
317
+ if (options.branch) out += shortTracking(header, options, c) + eol;
246
318
  const { change, untracked, ignored } = lists(status);
247
319
  const q = (p: string) => (z ? p : quotePath(p, true, fully));
248
320
  for (const e of change) {
249
321
  const mask = stagemask(e);
250
322
  if (mask) {
251
- out += `${UNMERGED_KEYS[mask]} ${q(e.path)}${eol}`;
323
+ out += `${paint(c.unmerged, UNMERGED_KEYS[mask] as string)} ${q(e.path)}${eol}`;
252
324
  continue;
253
325
  }
254
326
  let y: string = e.worktree;
@@ -258,7 +330,8 @@ function shortStatus(status: Status, header: StatusHeader, options: StatusTextOp
258
330
  else if (e.submoduleModified) y = "m";
259
331
  else if (e.submoduleUntracked) y = "?";
260
332
  }
261
- const x = e.index;
333
+ const x = e.index === " " ? " " : paint(c.updated, e.index);
334
+ if (y !== " ") y = paint(c.changed, y);
262
335
  if (z) {
263
336
  out += `${x}${y} ${e.path}\0`;
264
337
  if (e.renamedFrom !== undefined) out += `${e.renamedFrom}\0`;
@@ -267,32 +340,45 @@ function shortStatus(status: Status, header: StatusHeader, options: StatusTextOp
267
340
  out += `${x}${y} ${from}${q(e.path)}\n`;
268
341
  }
269
342
  }
270
- for (const p of untracked) out += `?? ${q(p)}${eol}`;
271
- for (const p of ignored) out += `!! ${q(p)}${eol}`;
343
+ // 2.43's wt_shortstatus_other colors the sign only without -z
344
+ const sign = (s: string) => (z && options.compatibility === "2.43" ? s : paint(c.untracked, s));
345
+ for (const p of untracked) out += `${sign("??")} ${q(p)}${eol}`;
346
+ for (const p of ignored) out += `${sign("!!")} ${q(p)}${eol}`;
272
347
  return out;
273
348
  }
274
349
 
275
350
  const isSubmodule = (e: StatusFileEntry) => submoduleToken(e)[0] === "S";
276
351
 
277
352
  /** wt_shortstatus_print_tracking: `## branch...upstream [ahead N, behind M]` (no eol). */
278
- function shortTracking(header: StatusHeader, options: StatusTextOptions): string {
279
- let out = "## ";
353
+ function shortTracking(
354
+ header: StatusHeader,
355
+ options: StatusTextOptions,
356
+ c: Required<StatusColors>,
357
+ ): string {
358
+ const h = (text: string) => paint(c.header, text);
359
+ let out = h("## ");
280
360
  if (!header.branch) return out;
281
- if (header.isInitial) out += "No commits yet on ";
282
- if (header.branch === "HEAD") return `${out}HEAD (no branch)`;
283
- out += header.branch.replace(/^refs\/heads\//, "");
361
+ if (header.isInitial) out += h("No commits yet on ");
362
+ if (header.branch === "HEAD") return out + paint(c.noBranch, "HEAD (no branch)");
363
+ out += paint(c.localBranch, header.branch.replace(/^refs\/heads\//, ""));
284
364
  const t = header.tracking;
285
365
  if (!t || (t.result < 0 && !t.base)) return out;
286
366
  const gone = t.result < 0;
287
- out += `...${t.short ?? t.base}`;
367
+ out += h("...") + paint(c.remoteBranch, t.short ?? (t.base as string));
288
368
  if (!gone && t.result === 0) return out;
289
- out += " [";
290
- if (gone) out += "gone";
291
- else if (options.aheadBehindQuick) out += "different";
292
- else if (!t.ahead) out += `behind ${t.behind}`;
293
- else if (!t.behind) out += `ahead ${t.ahead}`;
294
- else out += `ahead ${t.ahead}, behind ${t.behind}`;
295
- return `${out}]`;
369
+ out += h(" [");
370
+ if (gone) out += h("gone");
371
+ else if (options.aheadBehindQuick) out += h("different");
372
+ else if (!t.ahead) out += h("behind ") + paint(c.remoteBranch, `${t.behind}`);
373
+ else if (!t.behind) out += h("ahead ") + paint(c.localBranch, `${t.ahead}`);
374
+ else {
375
+ out +=
376
+ h("ahead ") +
377
+ paint(c.localBranch, `${t.ahead}`) +
378
+ h(", behind ") +
379
+ paint(c.remoteBranch, `${t.behind}`);
380
+ }
381
+ return out + h("]");
296
382
  }
297
383
 
298
384
  /** wt_porcelain_v2_print. */
@@ -353,14 +439,29 @@ function commentedLines(text: string, prefix: string): string {
353
439
  */
354
440
  export class StatusPrinter {
355
441
  out = "";
356
- constructor(private readonly prefix: string | undefined) {}
357
-
358
- private vprintf(atBol: boolean, text: string, trail: string | undefined) {
442
+ /**
443
+ * @param prefix the comment-line string, undefined: lines are not commented
444
+ * @param color the color of lines printed without one of their own (git's callers pass
445
+ * the header's), "" for none
446
+ */
447
+ constructor(
448
+ private readonly prefix: string | undefined,
449
+ private readonly color = "",
450
+ ) {}
451
+
452
+ private vprintf(
453
+ atBol: boolean,
454
+ text: string,
455
+ trail: string | undefined,
456
+ color: string = this.color,
457
+ ) {
359
458
  if (text === "") {
459
+ let sb = "";
360
460
  if (this.prefix !== undefined) {
361
- this.out += this.prefix;
362
- if (trail === undefined) this.out += " ";
461
+ sb += this.prefix;
462
+ if (trail === undefined) sb += " ";
363
463
  }
464
+ this.out += paint(color, sb);
364
465
  if (trail !== undefined) this.out += trail;
365
466
  return;
366
467
  }
@@ -374,7 +475,7 @@ export class StatusPrinter {
374
475
  if (text[line] !== "\n" && text[line] !== "\t") buf += " ";
375
476
  }
376
477
  buf += eol >= 0 ? text.slice(line, eol) : text.slice(line);
377
- this.out += buf;
478
+ this.out += paint(color, buf);
378
479
  if (eol < 0) break;
379
480
  this.out += "\n";
380
481
  line = eol + 1;
@@ -383,14 +484,17 @@ export class StatusPrinter {
383
484
  if (trail !== undefined) this.out += trail;
384
485
  }
385
486
 
386
- ln(text: string) {
387
- this.vprintf(true, text, "\n");
487
+ /** status_printf_ln (in `color`, else the printer's) */
488
+ ln(text: string, color?: string) {
489
+ this.vprintf(true, text, "\n", color);
388
490
  }
389
- printf(text: string) {
390
- this.vprintf(true, text, undefined);
491
+ /** status_printf */
492
+ printf(text: string, color?: string) {
493
+ this.vprintf(true, text, undefined, color);
391
494
  }
392
- more(text: string) {
393
- this.vprintf(false, text, undefined);
495
+ /** status_printf_more */
496
+ more(text: string, color?: string) {
497
+ this.vprintf(false, text, undefined, color);
394
498
  }
395
499
  raw(text: string) {
396
500
  this.out += text;
@@ -404,7 +508,18 @@ function longStatus(
404
508
  options: StatusTextOptions,
405
509
  info: { committable: boolean; workdirDirty: boolean },
406
510
  ): string {
407
- const p = new StatusPrinter(options.commentPrefix);
511
+ const c = slotsOf(options.colors);
512
+ const p = new StatusPrinter(options.commentPrefix, c.header);
513
+ const columns =
514
+ options.colopts !== undefined
515
+ ? {
516
+ colopts: options.colopts,
517
+ termColumns: options.termColumns ?? 80,
518
+ header: c.header,
519
+ comment: options.commentPrefix !== undefined,
520
+ colored: options.colors !== undefined,
521
+ }
522
+ : undefined;
408
523
  const hints = options.hints ?? true;
409
524
  const fully = options.quotePath ?? true;
410
525
  const q = (path: string) => quotePath(path, false, fully);
@@ -418,7 +533,9 @@ function longStatus(
418
533
  if (header.branch) {
419
534
  let onWhat = "On branch ";
420
535
  let branchName = header.branch;
536
+ let branchStatusColor = c.header;
421
537
  if (branchName === "HEAD") {
538
+ branchStatusColor = c.noBranch;
422
539
  if (state.rebaseInProgress || state.rebaseInteractiveInProgress) {
423
540
  onWhat = state.rebaseInteractiveInProgress
424
541
  ? "interactive rebase in progress; onto "
@@ -433,14 +550,17 @@ function longStatus(
433
550
  }
434
551
  } else branchName = branchName.replace(/^refs\/heads\//, "");
435
552
  p.printf("");
436
- p.more(onWhat);
437
- p.more(`${branchName}\n`);
553
+ p.more(onWhat, branchStatusColor);
554
+ p.more(`${branchName}\n`, c.branch);
438
555
  if (!header.isInitial && header.trackingText) {
439
- // wt_longstatus_print_tracking
556
+ // wt_longstatus_print_tracking: color_fprintf_ln in the header's color
440
557
  for (const line of header.trackingText.split("\n").slice(0, -1)) {
441
- p.raw(`${options.commentPrefix !== undefined ? `${options.commentPrefix} ` : ""}${line}\n`);
558
+ const text = `${options.commentPrefix !== undefined ? `${options.commentPrefix} ` : ""}${line}`;
559
+ p.raw(`${paint(c.header, text)}\n`);
442
560
  }
443
- p.raw(options.commentPrefix !== undefined ? `${options.commentPrefix}\n` : "\n");
561
+ p.raw(
562
+ options.commentPrefix !== undefined ? `${paint(c.header, options.commentPrefix)}\n` : "\n",
563
+ );
444
564
  }
445
565
  }
446
566
 
@@ -534,7 +654,7 @@ function longStatus(
534
654
  if (updated.length > 0) {
535
655
  p.ln("Changes to be committed:");
536
656
  if (hints) unstageHint();
537
- for (const e of updated) changeLine(p, e, "updated", q);
657
+ for (const e of updated) changeLine(p, e, "updated", q, c.updated);
538
658
  trailer();
539
659
  }
540
660
 
@@ -566,7 +686,7 @@ function longStatus(
566
686
  for (const e of unmerged) {
567
687
  const how = UNMERGED_LABELS[stagemask(e)] as string;
568
688
  p.printf("\t");
569
- p.more(`${how}${" ".repeat(UNMERGED_LABEL_WIDTH - how.length)}${q(e.path)}\n`);
689
+ p.more(`${how}${" ".repeat(UNMERGED_LABEL_WIDTH - how.length)}${q(e.path)}\n`, c.unmerged);
570
690
  }
571
691
  trailer();
572
692
  }
@@ -588,7 +708,7 @@ function longStatus(
588
708
  p.ln(" (commit or discard the untracked or modified content in submodules)");
589
709
  }
590
710
  }
591
- for (const e of changed) changeLine(p, e, "changed", q);
711
+ for (const e of changed) changeLine(p, e, "changed", q, c.changed);
592
712
  trailer();
593
713
  }
594
714
 
@@ -605,18 +725,21 @@ function longStatus(
605
725
 
606
726
  const untrackedMode = options.untracked ?? "normal";
607
727
  if (untrackedMode !== "no") {
608
- otherSection(p, untracked, "Untracked files", "add", hints, q);
728
+ otherSection(p, untracked, "Untracked files", "add", hints, q, c.untracked, columns);
609
729
  if ((options.ignored ?? "no") !== "no") {
610
- otherSection(p, ignored, "Ignored files", "add -f", hints, q);
730
+ otherSection(p, ignored, "Ignored files", "add -f", hints, q, c.untracked, columns);
611
731
  }
612
732
  } else if (info.committable) {
613
- p.ln(`Untracked files not listed${hints ? " (use -u option to show untracked files)" : ""}`);
733
+ p.ln(
734
+ `Untracked files not listed${hints ? " (use -u option to show untracked files)" : ""}`,
735
+ "",
736
+ );
614
737
  }
615
738
 
616
739
  if (options.verbose !== undefined) p.raw(options.verbose);
617
740
 
618
741
  if (!info.committable) {
619
- if (options.amend) p.ln("No changes");
742
+ if (options.amend) p.ln("No changes", "");
620
743
  else if (options.nowarn) {
621
744
  // nothing
622
745
  } else if (info.workdirDirty) {
@@ -643,7 +766,7 @@ function longStatus(
643
766
  }
644
767
  if (options.showStash && (header.stashCount ?? 0) > 0) {
645
768
  const n = header.stashCount as number;
646
- p.ln(`Your stash currently has ${n} ${n === 1 ? "entry" : "entries"}`);
769
+ p.ln(`Your stash currently has ${n} ${n === 1 ? "entry" : "entries"}`, "");
647
770
  }
648
771
  return p.out;
649
772
  }
@@ -654,6 +777,7 @@ function changeLine(
654
777
  e: StatusFileEntry,
655
778
  kind: "updated" | "changed",
656
779
  q: (path: string) => string,
780
+ color: string,
657
781
  ) {
658
782
  const status = kind === "updated" ? e.index : e.worktree;
659
783
  let extra = "";
@@ -672,12 +796,17 @@ function changeLine(
672
796
  renamed
673
797
  ? `${what}${pad}${q(e.renamedFrom as string)} -> ${q(e.path)}`
674
798
  : `${what}${pad}${q(e.path)}`,
799
+ color,
675
800
  );
676
801
  if (extra) p.more(extra);
677
- p.more("\n");
802
+ p.more("\n", "");
678
803
  }
679
804
 
680
- /** wt_longstatus_print_other (no columns). */
805
+ /**
806
+ * wt_longstatus_print_other: the paths one per line, or laid out by `column.status`
807
+ * (`columns`: the finalized `colopts` and the terminal's width) after `<header>[#]\t<color>`,
808
+ * each line ending in a reset when colored.
809
+ */
681
810
  function otherSection(
682
811
  p: StatusPrinter,
683
812
  paths: string[],
@@ -685,15 +814,34 @@ function otherSection(
685
814
  how: string,
686
815
  hints: boolean,
687
816
  q: (path: string) => string,
817
+ color: string,
818
+ columns?: {
819
+ colopts: number;
820
+ termColumns: number;
821
+ header: string;
822
+ comment: boolean;
823
+ colored: boolean;
824
+ },
688
825
  ) {
689
826
  if (paths.length === 0) return;
690
827
  p.ln(`${what}:`);
691
828
  if (hints) p.ln(` (use "git ${how} <file>..." to include in what will be committed)`);
692
- for (const path of paths) {
693
- p.printf("\t");
694
- p.more(`${q(path)}\n`);
829
+ if (columns && columnActive(columns.colopts)) {
830
+ p.raw(
831
+ printColumns(paths.map(q), columns.colopts, {
832
+ padding: 1,
833
+ indent: `${columns.header}${columns.comment ? "#" : ""}\t${color}`,
834
+ ...(columns.colored ? { nl: `${COLOR_RESET}\n` } : {}),
835
+ termColumns: columns.termColumns,
836
+ }),
837
+ );
838
+ } else {
839
+ for (const path of paths) {
840
+ p.printf("\t");
841
+ p.more(`${q(path)}\n`, color);
842
+ }
695
843
  }
696
- p.ln("");
844
+ p.ln("", "");
697
845
  }
698
846
 
699
847
  /** show_rebase_information: an interactive rebase's done and remaining commands. */
@@ -19,6 +19,17 @@ import {
19
19
  } from "../errors/index.js";
20
20
  import { type CommandCommits, GitCommand } from "../git-command.js";
21
21
  import { RemoteConfigStore } from "../remote-config/index.js";
22
+ import {
23
+ applyColumnOption,
24
+ ColumnOptionError,
25
+ columnActive,
26
+ columnConfigOf,
27
+ explicitlyEnableColumn,
28
+ finalizeColopts,
29
+ printColumns,
30
+ terminalColumnsOf,
31
+ } from "./column/index.js";
32
+ import { readLines } from "./column-command.js";
22
33
  import type { CommitEditor } from "./commit-command.js";
23
34
  import { abbrevLengths } from "./core-config.js";
24
35
  import { OperationState } from "./merge-support.js";
@@ -938,7 +949,11 @@ export interface TagListResult {
938
949
  * [--format=<format>] [--omit-empty] [--[no-]color] [-i] [<pattern>...]`, on git's ref
939
950
  * filter: {@link call} gives the refs the filters keep, in name order; {@link callText}
940
951
  * gives git's output (`tag.sort` and `--sort` keys, `versionsort.suffix`, `-n<num>`'s
941
- * annotations as builtin/tag.c's `list_tags` formats them).
952
+ * annotations as builtin/tag.c's `list_tags` formats them). `setColumn` and
953
+ * `column.ui`/`column.tag` lay the output out in columns as the `git column` child of
954
+ * builtin/tag.c does (padding 2; `auto` never: no terminal), {@link setColumns} wide (else the
955
+ * host's `$COLUMNS`, else 80); `-n` turns a configured layout off and dies with an explicit
956
+ * `--column`.
942
957
  *
943
958
  * @example
944
959
  * ```typescript
@@ -970,6 +985,26 @@ export class ListTagCommand extends RefListingCommand<Ref[]> {
970
985
  private merged: string[] = [];
971
986
  private noMerged: string[] = [];
972
987
  private compatibility: "2.43" | "2.56" = "2.56";
988
+ private columnOptions: (string | boolean)[] = [];
989
+ private columns?: number;
990
+
991
+ /**
992
+ * `--column` (`true`: `always`), `--column=<options>` (`column`, `row`, `plain`, `dense`,
993
+ * `nodense`, `always`, `never`, `auto`) or `--no-column` (`false`), over `column.ui` and
994
+ * `column.tag`; each call applies after the previous ones, as git's options do.
995
+ */
996
+ setColumn(option: string | boolean = true): this {
997
+ this.checkCallable();
998
+ this.columnOptions.push(option);
999
+ return this;
1000
+ }
1001
+
1002
+ /** The terminal's width columns fill (`$COLUMNS`; default the host's, else 80). */
1003
+ setColumns(columns: number): this {
1004
+ this.checkCallable();
1005
+ this.columns = columns;
1006
+ return this;
1007
+ }
973
1008
 
974
1009
  /** `<pattern>...`: tags whose name (after `refs/tags/`) matches one of these globs. */
975
1010
  setPatterns(...patterns: string[]): this {
@@ -1133,8 +1168,21 @@ export class ListTagCommand extends RefListingCommand<Ref[]> {
1133
1168
  this.checkCallable();
1134
1169
  this.setCallable(false);
1135
1170
  const config = RemoteConfigStore.from(this.workingCopy);
1171
+ // git_tag_config: column.ui and column.tag die on a value git refuses
1172
+ let colopts = columnConfigOf(this.workingCopy, "tag");
1173
+ for (const option of this.columnOptions) colopts = applyColumnOption(colopts, option);
1136
1174
  // parse_options resolves --contains & co. in its callbacks, before anything else
1137
1175
  const filter = await this.filterOptions();
1176
+ colopts = finalizeColopts(colopts);
1177
+ if (this.lines !== undefined && this.lines !== -1) {
1178
+ if (explicitlyEnableColumn(colopts)) {
1179
+ throw new ColumnOptionError(
1180
+ "fatal: options '--column' and '-n' cannot be used together",
1181
+ 128,
1182
+ );
1183
+ }
1184
+ colopts = 0;
1185
+ }
1138
1186
  // repo_config: tag.sort keys, else "refname"; --sort appends, --no-sort clears
1139
1187
  const configured = config.values("tag.sort");
1140
1188
  const sortKeys = this.configSort
@@ -1192,7 +1240,14 @@ export class ListTagCommand extends RefListingCommand<Ref[]> {
1192
1240
  isBaseTips,
1193
1241
  });
1194
1242
  return {
1195
- output: result.output,
1243
+ // run_column_filter: the listing piped through `git column --raw-mode=<colopts>
1244
+ // --padding=2`, which reads it line by line
1245
+ output: columnActive(colopts)
1246
+ ? printColumns(readLines(result.output), colopts, {
1247
+ padding: 2,
1248
+ termColumns: terminalColumnsOf(this.workingCopy, this.columns),
1249
+ })
1250
+ : result.output,
1196
1251
  lines: result.lines,
1197
1252
  tags: result.items.map((i) => ({ refname: i.refname, objectId: i.objectId })),
1198
1253
  warnings: [...baseWarnings, ...result.warnings],
@@ -331,6 +331,7 @@ async function writePlan(
331
331
  createParents: true,
332
332
  ...(options.replaceInTheWay ? { replaceInTheWay: true } : {}),
333
333
  ...(options.discardUntracked ? { discardUntracked: true } : {}),
334
+ metadata: { ...options.metadata, blob: objectId },
334
335
  });
335
336
  options.progress?.tick();
336
337
  }
@@ -368,6 +369,19 @@ export interface TreeWriteOptions {
368
369
  attributes?: ContentAttributesContext | false;
369
370
  /** Ticked once per file written and per gitlink created ("Updating files") */
370
371
  progress?: ProgressTask;
372
+ /**
373
+ * git's checkout metadata of the restore (unpack-trees' `o->meta`): the ref and the
374
+ * tree-ish checked out, handed with each file's blob to a long-running filter process
375
+ */
376
+ metadata?: CheckoutRef;
377
+ }
378
+
379
+ /** The ref and tree-ish of git's checkout metadata (`init_checkout_metadata`). */
380
+ export interface CheckoutRef {
381
+ /** The ref checked out, when it was named by one (`refs/heads/main`) */
382
+ ref?: string;
383
+ /** The commit (or tree) checked out */
384
+ treeish?: string;
371
385
  }
372
386
 
373
387
  /**
@@ -437,6 +451,8 @@ export interface FreshCheckoutTarget {
437
451
  pathRules?: WorktreePathOptions;
438
452
  /** clone's `--progress`: "Updating files", one unit per file and gitlink written */
439
453
  progress?: ProgressMonitor;
454
+ /** git's checkout metadata (the ref and commit checked out), for a filter process */
455
+ metadata?: CheckoutRef;
440
456
  }
441
457
 
442
458
  /**
@@ -482,6 +498,7 @@ export async function checkoutFreshTree(
482
498
  symlinks: target.symlinks,
483
499
  gitlinks: true,
484
500
  progress,
501
+ ...(target.metadata ? { metadata: target.metadata } : {}),
485
502
  });
486
503
  progress.stop();
487
504
  // the index records what was written (the worktree's stat of each file, a link's own