@statewalker/vcs-commands 0.3.2 → 0.5.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 (133) hide show
  1. package/README.md +19 -0
  2. package/dist/commands/add-command.d.ts +0 -6
  3. package/dist/commands/add-command.d.ts.map +1 -1
  4. package/dist/commands/blame-command.d.ts +14 -0
  5. package/dist/commands/blame-command.d.ts.map +1 -1
  6. package/dist/commands/branch-command.d.ts.map +1 -1
  7. package/dist/commands/checkout-command.d.ts +7 -24
  8. package/dist/commands/checkout-command.d.ts.map +1 -1
  9. package/dist/commands/clean-command.d.ts +34 -4
  10. package/dist/commands/clean-command.d.ts.map +1 -1
  11. package/dist/commands/clone-command.d.ts +61 -21
  12. package/dist/commands/clone-command.d.ts.map +1 -1
  13. package/dist/commands/core-config.d.ts +16 -0
  14. package/dist/commands/core-config.d.ts.map +1 -0
  15. package/dist/commands/fetch-command.d.ts +104 -37
  16. package/dist/commands/fetch-command.d.ts.map +1 -1
  17. package/dist/commands/index.d.ts +1 -0
  18. package/dist/commands/index.d.ts.map +1 -1
  19. package/dist/commands/index.js +2 -2
  20. package/dist/commands/init-command.d.ts.map +1 -1
  21. package/dist/commands/merge-command.d.ts +15 -2
  22. package/dist/commands/merge-command.d.ts.map +1 -1
  23. package/dist/commands/push-command.d.ts +58 -25
  24. package/dist/commands/push-command.d.ts.map +1 -1
  25. package/dist/commands/remote-command.d.ts +115 -6
  26. package/dist/commands/remote-command.d.ts.map +1 -1
  27. package/dist/commands/reset-command.d.ts.map +1 -1
  28. package/dist/commands/stash-apply-command.d.ts +35 -13
  29. package/dist/commands/stash-apply-command.d.ts.map +1 -1
  30. package/dist/commands/stash-create-command.d.ts +59 -25
  31. package/dist/commands/stash-create-command.d.ts.map +1 -1
  32. package/dist/commands/stash-drop-command.d.ts +8 -2
  33. package/dist/commands/stash-drop-command.d.ts.map +1 -1
  34. package/dist/commands/stash-list-command.d.ts +2 -4
  35. package/dist/commands/stash-list-command.d.ts.map +1 -1
  36. package/dist/commands/stash-working-tree.d.ts +72 -0
  37. package/dist/commands/stash-working-tree.d.ts.map +1 -0
  38. package/dist/commands/status-command.d.ts +29 -22
  39. package/dist/commands/status-command.d.ts.map +1 -1
  40. package/dist/commands/tag-command.d.ts.map +1 -1
  41. package/dist/commands/tree-restore.d.ts +52 -5
  42. package/dist/commands/tree-restore.d.ts.map +1 -1
  43. package/dist/commands/worktree-overwrite-checks.d.ts +64 -0
  44. package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -0
  45. package/dist/{commands-COO4tJhv.js → commands-CsLNyvZ1.js} +3370 -1057
  46. package/dist/core-commands/add.command.impl.d.ts +0 -4
  47. package/dist/core-commands/add.command.impl.d.ts.map +1 -1
  48. package/dist/core-commands/index.d.ts +1 -3
  49. package/dist/core-commands/index.d.ts.map +1 -1
  50. package/dist/core-commands/store-worktree-file.d.ts +6 -0
  51. package/dist/core-commands/store-worktree-file.d.ts.map +1 -0
  52. package/dist/errors/checkout-errors.d.ts +13 -0
  53. package/dist/errors/checkout-errors.d.ts.map +1 -1
  54. package/dist/errors/index.js +18 -1
  55. package/dist/git-command.d.ts +10 -1
  56. package/dist/git-command.d.ts.map +1 -1
  57. package/dist/git.d.ts +21 -3
  58. package/dist/git.d.ts.map +1 -1
  59. package/dist/index.js +4 -4
  60. package/dist/remote-config/index.d.ts +1 -0
  61. package/dist/remote-config/index.d.ts.map +1 -1
  62. package/dist/remote-config/remote-config-store.d.ts +22 -0
  63. package/dist/remote-config/remote-config-store.d.ts.map +1 -1
  64. package/dist/remote-config/remote-refs.d.ts +37 -0
  65. package/dist/remote-config/remote-refs.d.ts.map +1 -0
  66. package/dist/results/clone-result.d.ts +6 -0
  67. package/dist/results/clone-result.d.ts.map +1 -1
  68. package/dist/results/diff-formatter.d.ts +14 -7
  69. package/dist/results/diff-formatter.d.ts.map +1 -1
  70. package/dist/results/fetch-result.d.ts +16 -1
  71. package/dist/results/fetch-result.d.ts.map +1 -1
  72. package/dist/results/index.js +28 -23
  73. package/dist/results/push-result.d.ts +9 -2
  74. package/dist/results/push-result.d.ts.map +1 -1
  75. package/dist/results/status-result.d.ts +91 -20
  76. package/dist/results/status-result.d.ts.map +1 -1
  77. package/dist/{status-result-BwAyxq6R.js → status-result-BpyUK1Sg.js} +115 -5
  78. package/dist/transport-command.d.ts +12 -0
  79. package/dist/transport-command.d.ts.map +1 -1
  80. package/package.json +14 -12
  81. package/src/commands/add-command.ts +23 -30
  82. package/src/commands/blame-command.ts +41 -0
  83. package/src/commands/branch-command.ts +2 -53
  84. package/src/commands/checkout-command.ts +205 -127
  85. package/src/commands/clean-command.ts +187 -81
  86. package/src/commands/clone-command.ts +334 -137
  87. package/src/commands/core-config.ts +41 -0
  88. package/src/commands/fetch-command.ts +536 -211
  89. package/src/commands/gc-command.ts +1 -1
  90. package/src/commands/index.ts +1 -0
  91. package/src/commands/init-command.ts +108 -11
  92. package/src/commands/merge-command.ts +60 -27
  93. package/src/commands/pack-refs-command.ts +2 -2
  94. package/src/commands/push-command.ts +242 -308
  95. package/src/commands/reflog-command.ts +2 -2
  96. package/src/commands/remote-command.ts +429 -19
  97. package/src/commands/reset-command.ts +18 -5
  98. package/src/commands/stash-apply-command.ts +632 -97
  99. package/src/commands/stash-create-command.ts +142 -62
  100. package/src/commands/stash-drop-command.ts +53 -5
  101. package/src/commands/stash-list-command.ts +10 -4
  102. package/src/commands/stash-working-tree.ts +243 -0
  103. package/src/commands/status-command.ts +197 -91
  104. package/src/commands/tag-command.ts +2 -53
  105. package/src/commands/tree-restore.ts +143 -18
  106. package/src/commands/worktree-overwrite-checks.ts +215 -0
  107. package/src/core-commands/add.command.impl.ts +15 -20
  108. package/src/core-commands/index.ts +1 -8
  109. package/src/core-commands/store-worktree-file.ts +5 -0
  110. package/src/errors/checkout-errors.ts +20 -0
  111. package/src/git-command.ts +42 -1
  112. package/src/git.ts +30 -2
  113. package/src/remote-config/index.ts +1 -0
  114. package/src/remote-config/remote-config-store.ts +95 -8
  115. package/src/remote-config/remote-refs.ts +103 -0
  116. package/src/results/clone-result.ts +6 -0
  117. package/src/results/diff-formatter.ts +31 -38
  118. package/src/results/fetch-result.ts +16 -1
  119. package/src/results/push-result.ts +9 -2
  120. package/src/results/status-result.ts +212 -29
  121. package/src/transport-command.ts +18 -0
  122. package/dist/core-commands/checkout.command.d.ts +0 -103
  123. package/dist/core-commands/checkout.command.d.ts.map +0 -1
  124. package/dist/core-commands/checkout.command.impl.d.ts +0 -114
  125. package/dist/core-commands/checkout.command.impl.d.ts.map +0 -1
  126. package/dist/pack-import/index.d.ts +0 -8
  127. package/dist/pack-import/index.d.ts.map +0 -1
  128. package/dist/pack-import/pack-import.d.ts +0 -11
  129. package/dist/pack-import/pack-import.d.ts.map +0 -1
  130. package/src/core-commands/checkout.command.impl.ts +0 -586
  131. package/src/core-commands/checkout.command.ts +0 -125
  132. package/src/pack-import/index.ts +0 -8
  133. package/src/pack-import/pack-import.ts +0 -24
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
@@ -1,2 +1,2 @@
1
- import { A as DiffCommand, B as CheckoutCommand, C as MergeCommand, D as InitCommand, E as RevFilter, F as FetchCommand, G as ListBranchCommand, H as CheckoutStatus, I as TagOption, K as RenameBranchCommand, M as DescribeCommand, N as CommitCommand, P as CloneCommand, R as CleanCommand, S as PackRefsCommand, T as LogCommand, U as CreateBranchCommand, V as CheckoutStage, W as DeleteBranchCommand, X as AddCommand, Y as BlameCommand, _ as ReflogCommand, a as StashDropCommand, b as PushCommand, c as STASH_REF, d as RevertCommand, f as ResetCommand, g as RemoteSetUrlCommand, h as RemoteRemoveCommand, i as StatusCommand, j as formatDiffEntry, k as GarbageCollectCommand, l as StashListCommand, m as RemoteListCommand, n as ListTagCommand, o as StashCreateCommand, p as RemoteAddCommand, r as TagCommand, s as StashApplyCommand, t as DeleteTagCommand, u as RmCommand, v as RebaseCommand, w as LsRemoteCommand, x as PullCommand, y as RebaseOperation, z as CherryPickCommand } from "../commands-COO4tJhv.js";
2
- export { AddCommand, BlameCommand, CheckoutCommand, CheckoutStage, CheckoutStatus, CherryPickCommand, CleanCommand, CloneCommand, CommitCommand, CreateBranchCommand, DeleteBranchCommand, DeleteTagCommand, DescribeCommand, DiffCommand, FetchCommand, GarbageCollectCommand, InitCommand, ListBranchCommand, ListTagCommand, LogCommand, LsRemoteCommand, MergeCommand, PackRefsCommand, PullCommand, PushCommand, RebaseCommand, RebaseOperation, ReflogCommand, RemoteAddCommand, RemoteListCommand, RemoteRemoveCommand, RemoteSetUrlCommand, RenameBranchCommand, ResetCommand, RevFilter, RevertCommand, RmCommand, STASH_REF, StashApplyCommand, StashCreateCommand, StashDropCommand, StashListCommand, StatusCommand, TagCommand, TagOption, formatDiffEntry };
1
+ import { A as InitCommand, B as toTagMode, C as PushCommand, D as LsRemoteCommand, E as MergeCommand, F as DescribeCommand, G as CheckoutCommand, I as CommitCommand, J as CreateBranchCommand, K as CheckoutStage, L as CloneCommand, M as GarbageCollectCommand, N as DiffCommand, O as LogCommand, P as formatDiffEntry, R as FetchCommand, S as RebaseOperation, T as PackRefsCommand, U as CleanCommand, V as toTrackingRefUpdate, W as CherryPickCommand, X as ListBranchCommand, Y as DeleteBranchCommand, Z as RenameBranchCommand, _ as RemoteRenameCommand, a as StashDropCommand, b as ReflogCommand, c as StashApplyCommand, d as RmCommand, et as BlameCommand, f as RevertCommand, g as RemoteRemoveCommand, h as RemoteListCommand, i as StatusCommand, k as RevFilter, l as STASH_REF, m as RemoteAddCommand, n as ListTagCommand, o as StashCreateCommand, p as ResetCommand, q as CheckoutStatus, r as TagCommand, s as WorkingCopyStashProvider, t as DeleteTagCommand, tt as AddCommand, u as StashListCommand, v as RemoteSetHeadCommand, w as PullCommand, x as RebaseCommand, y as RemoteSetUrlCommand, z as TagOption } from "../commands-CsLNyvZ1.js";
2
+ export { AddCommand, BlameCommand, CheckoutCommand, CheckoutStage, CheckoutStatus, CherryPickCommand, CleanCommand, CloneCommand, CommitCommand, CreateBranchCommand, DeleteBranchCommand, DeleteTagCommand, DescribeCommand, DiffCommand, FetchCommand, GarbageCollectCommand, InitCommand, ListBranchCommand, ListTagCommand, LogCommand, LsRemoteCommand, MergeCommand, PackRefsCommand, PullCommand, PushCommand, RebaseCommand, RebaseOperation, ReflogCommand, RemoteAddCommand, RemoteListCommand, RemoteRemoveCommand, RemoteRenameCommand, RemoteSetHeadCommand, RemoteSetUrlCommand, RenameBranchCommand, ResetCommand, RevFilter, RevertCommand, RmCommand, STASH_REF, StashApplyCommand, StashCreateCommand, StashDropCommand, StashListCommand, StatusCommand, TagCommand, TagOption, WorkingCopyStashProvider, formatDiffEntry, toTagMode, toTrackingRefUpdate };
@@ -1 +1 @@
1
- {"version":3,"file":"init-command.d.ts","sourceRoot":"","sources":["../../src/commands/init-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGnG,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK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CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAKzC;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAoKhC;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
@@ -47,6 +47,7 @@ export declare class MergeCommand extends GitCommand<MergeResult> {
47
47
  private squash;
48
48
  private commit;
49
49
  private message?;
50
+ private bigFileThreshold;
50
51
  /**
51
52
  * Add a commit/branch to merge.
52
53
  *
@@ -87,6 +88,17 @@ export declare class MergeCommand extends GitCommand<MergeResult> {
87
88
  * @param contentStrategy Content merge strategy
88
89
  */
89
90
  setContentMergeStrategy(contentStrategy: ContentMergeStrategy): this;
91
+ /**
92
+ * Set the size above which files are binary to the content merge (git's
93
+ * `core.bigFileThreshold`, default 50 MiB).
94
+ *
95
+ * A binary file (over the threshold, or a NUL byte in its first 8000 bytes) is
96
+ * never content-merged and never loaded: as git does, OURS and THEIRS take that
97
+ * side's file whole, and UNION reports a conflict.
98
+ *
99
+ * @param threshold Size in bytes
100
+ */
101
+ setBigFileThreshold(threshold: number): this;
90
102
  /**
91
103
  * Set squash mode.
92
104
  *
@@ -138,9 +150,10 @@ export declare class MergeCommand extends GitCommand<MergeResult> {
138
150
  */
139
151
  private tryContentMerge;
140
152
  /**
141
- * Collect all bytes from a blob into a single Uint8Array.
153
+ * The blobs' contents, each read once; nothing when one is binary or over the
154
+ * threshold (then the rest are not read). A missing id is empty content.
142
155
  */
143
- private collectBlobContent;
156
+ private loadTexts;
144
157
  /**
145
158
  * Convert ContentMergeStrategy to utils MergeContentStrategy.
146
159
  */
@@ -1 +1 @@
1
- {"version":3,"file":"merge-command.d.ts","sourceRoot":"","sources":["../../src/commands/merge-command.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,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AO,GAAG,IAAI,CAI/B;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,CAoDjC;IAED;;OAEG;YACW,aAAa;IA0C3B;;OAEG;YACW,OAAO;IA2HrB;;OAEG;YACW,UAAU;IAiCxB;;;;OAIG;YACW,kBAAkB;IA6DhC;;;;OAIG;YACW,eAAe;IA0D7B;;;OAGG;YACW,SAAS;IAmBvB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAW9B;;OAEG;YACW,kBAAkB;IAoBhC;;OAEG;IACH,OAAO,CAAC,UAAU;IA8BlB;;OAEG;IACH,OAAO,CAAC,SAAS;IAMjB;;OAEG;YACW,oBAAoB;IAiDlC;;OAEG;YACW,kBAAkB;CAgBjC"}
@@ -51,6 +51,10 @@ export declare class PushCommand extends TransportCommand<PushResult> {
51
51
  private useBitmaps;
52
52
  private pushOptions;
53
53
  private receivePack?;
54
+ private prune;
55
+ private streamRequestBody?;
56
+ /** Leases (an entry without a ref: every other pushed ref at its tracking value) */
57
+ private leases?;
54
58
  /**
55
59
  * Set the remote to push to.
56
60
  *
@@ -88,6 +92,31 @@ export declare class PushCommand extends TransportCommand<PushResult> {
88
92
  * Whether force push is enabled.
89
93
  */
90
94
  isForce(): boolean;
95
+ /**
96
+ * `--force-with-lease`: allow a non-fast-forward of `ref` only while the remote ref still
97
+ * has `expect` (`""` or the zero id: it must not exist). Without `expect` the remote ref's
98
+ * remote-tracking value is expected (`refs/remotes/<remote>/...`). Without `ref` every pushed
99
+ * ref (that no explicit lease names) is leased at its remote-tracking value; `expect` may be
100
+ * a revision or an abbreviated id. A lease that does not hold is
101
+ * REJECTED_REMOTE_CHANGED; {@link setForce} overrides it, as in git.
102
+ *
103
+ * @param ref The remote ref (full or short name)
104
+ * @param expect The value it must have
105
+ */
106
+ setForceWithLease(ref?: string, expect?: string): this;
107
+ /**
108
+ * Stream the smart-HTTP request body (default: outside browsers, where supported); `false`
109
+ * collects it first, so the request has a `Content-Length` (servers or proxies that refuse
110
+ * chunked requests).
111
+ */
112
+ setStreamRequestBody(stream: boolean): this;
113
+ /** Whether the request body streams (undefined: the transport decides). */
114
+ isStreamRequestBody(): boolean | undefined;
115
+ /**
116
+ * `--prune`: delete remote refs a pattern refspec's destination covers whose local source is
117
+ * gone (with `+refs/*:refs/*`, `--mirror`).
118
+ */
119
+ setPrune(prune: boolean): this;
91
120
  /**
92
121
  * Set atomic push mode.
93
122
  *
@@ -170,11 +199,21 @@ export declare class PushCommand extends TransportCommand<PushResult> {
170
199
  */
171
200
  getReceivePack(): string | undefined;
172
201
  /**
173
- * Execute the push operation.
202
+ * Execute the push.
203
+ *
204
+ * Runs the transport's push client (git's send-pack): the refspecs are mapped onto the
205
+ * remote refs as `git push` does (short names, `HEAD`, patterns, `:dst` deletes); each ref
206
+ * is checked first (fast-forward, "fetch first", tags, `--force-with-lease`) and refused
207
+ * refs are not sent; the pack is thin against the remote refs here. Once the server accepts
208
+ * a ref, the remote-tracking ref of a named remote follows it (`refs/remotes/<remote>/…`).
174
209
  *
175
- * @returns Push result with updated refs
210
+ * Without refspecs (nor `setPushAll`/`setPushTags`), the configured `remote.<name>.push`
211
+ * refspecs are used, else `push.default` decides (default `simple`: the current branch to
212
+ * its upstream of the same name on its own remote, to the same name elsewhere; see
213
+ * `buildRefSpecs`). A detached HEAD is refused.
214
+ *
215
+ * @returns Push result with each remote ref's status
176
216
  * @throws InvalidRemoteError if remote cannot be resolved
177
- * @throws PushRejectedException if push is rejected
178
217
  */
179
218
  call(): Promise<PushResult>;
180
219
  /**
@@ -190,31 +229,25 @@ export declare class PushCommand extends TransportCommand<PushResult> {
190
229
  */
191
230
  private resolveRemoteUrl;
192
231
  /**
193
- * Build refspecs for the push.
194
- */
195
- private buildRefSpecs;
196
- /**
197
- * Get objects to push.
232
+ * The refspecs to push: the explicit ones, `--all` (every branch), `--tags` (every tag);
233
+ * else the remote's configured push refspecs; else what `push.default` says (git's
234
+ * builtin/push.c `setup_default_push_refspecs`, default `simple`):
198
235
  *
199
- * Returns objects reachable from newIds but not from oldIds.
200
- */
201
- private getObjectsToPush;
202
- /**
203
- * Collect all commits reachable from a given commit.
204
- */
205
- private collectReachableCommits;
206
- /**
207
- * Yield tree and blob objects recursively.
236
+ * - `simple`: the current branch to its upstream of the same name when pushing to the
237
+ * branch's own remote (refused without an upstream, or with one of another name); to the
238
+ * same name when pushing elsewhere (a URL, another remote)
239
+ * - `current`: the current branch to the same name
240
+ * - `upstream` (`tracking`): the current branch to its upstream, on its remote only
241
+ * - `matching`: `:` (the branches both sides have)
242
+ * - `nothing`: refused
243
+ *
244
+ * A detached HEAD is refused, except with `matching`.
208
245
  */
209
- private yieldTreeObjects;
246
+ private buildRefSpecs;
210
247
  /**
211
- * Load an object for pushing.
212
- *
213
- * Serializes objects to raw Git format based on type:
214
- * - type 1 (commit): serialize via serializeCommit()
215
- * - type 2 (tree): serialize via serializeTree()
216
- * - type 3 (blob): load raw content from blob store
248
+ * The remote-tracking ref of a remote ref (`refs/heads/main` → `refs/remotes/origin/main`)
249
+ * through the named remote's fetch refspecs; none for a URL.
217
250
  */
218
- private loadObjectForPush;
251
+ private trackingRefMapper;
219
252
  }
220
253
  //# sourceMappingURL=push-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"push-command.d.ts","sourceRoot":"","sources":["../../src/commands/push-command.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,UAAU,EAAoC,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAuD3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,WAAY,SAAQ,gBAAgB,CAAC,UAAU,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,KAAK,CAAS;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OAAO,GAAG,IAAI,CAInC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAIvC;IAED;;OAEG;IACH,YAAY,IAAI,OAAO,CAEtB;IAED;;;;;;;OAOG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAItC;IAED;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE,CAEzB;IAED;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAIxC;IAED;;OAEG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CA2EhC;IAED;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC,CAqBvC;IAED;;;;;;OAMG;YACW,gBAAgB;IAS9B;;;;;;;;;;;;;;OAcG;YACW,aAAa;IAyE3B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAY1B"}
@@ -1,5 +1,6 @@
1
1
  import { GitCommand } from "../git-command.js";
2
2
  import { type RemoteConfig } from "../remote-config/index.js";
3
+ import { TransportCommand } from "../transport-command.js";
3
4
  export type { RemoteConfig };
4
5
  /**
5
6
  * Add a remote to the repository.
@@ -70,6 +71,14 @@ export declare class RemoteAddCommand extends GitCommand<RemoteConfig> {
70
71
  *
71
72
  * Based on JGit's RemoteRemoveCommand.
72
73
  *
74
+ * As git's builtin/remote.c `rm`: the branches whose upstream is the remote lose
75
+ * `branch.<b>.remote` and `branch.<b>.merge`, those pushing to it `branch.<b>.pushRemote`;
76
+ * the remote-tracking refs its fetch refspecs map to (under `refs/remotes/`, and not mapped
77
+ * by another remote too) are deleted with their reflogs, `refs/remotes/<name>/HEAD`
78
+ * included; `remote.pushDefault` naming it is unset; the `[remote "<name>"]` section goes.
79
+ * Local branches a refspec maps to are kept, and git's note naming them is in
80
+ * {@link getMessages}. A remote without a config section is refused, as git refuses it.
81
+ *
73
82
  * @example
74
83
  * ```typescript
75
84
  * await git.remoteRemove()
@@ -77,8 +86,9 @@ export declare class RemoteAddCommand extends GitCommand<RemoteConfig> {
77
86
  * .call();
78
87
  * ```
79
88
  */
80
- export declare class RemoteRemoveCommand extends GitCommand<RemoteConfig | undefined> {
89
+ export declare class RemoteRemoveCommand extends GitCommand<RemoteConfig> {
81
90
  private remoteName?;
91
+ private messages;
82
92
  /**
83
93
  * Set the remote name to remove.
84
94
  *
@@ -89,15 +99,61 @@ export declare class RemoteRemoveCommand extends GitCommand<RemoteConfig | undef
89
99
  * Get the remote name.
90
100
  */
91
101
  getRemoteName(): string | undefined;
102
+ /**
103
+ * What git prints after the removal (on stderr): the note on local branches a refspec
104
+ * maps to, which are not removed. Empty until {@link call} has run.
105
+ */
106
+ getMessages(): string[];
92
107
  /**
93
108
  * Execute the remote remove operation.
94
109
  *
95
- * Drops both halves of a remote: its config section and its tracking refs.
96
- * A remote that has only one of the two is still removable.
97
- *
98
- * @returns Removed remote config, or undefined if not found
110
+ * @returns Removed remote config
111
+ * @throws RemoteNotFoundError when the remote has no config section (git: "No such
112
+ * remote: '<name>'"); nothing is changed then
99
113
  */
100
- call(): Promise<RemoteConfig | undefined>;
114
+ call(): Promise<RemoteConfig>;
115
+ }
116
+ /** What {@link RemoteRenameCommand} did. */
117
+ export interface RemoteRenameResult {
118
+ /** The remote under its new name */
119
+ remote: RemoteConfig;
120
+ /**
121
+ * git's warnings: each fetch refspec that does not write under `refs/remotes/<old>/`
122
+ * is kept as it is ("Not updating non-default fetch refspec ...")
123
+ */
124
+ warnings: string[];
125
+ }
126
+ /**
127
+ * Rename a remote.
128
+ *
129
+ * Equivalent to `git remote rename <old> <new>`.
130
+ *
131
+ * As git's builtin/remote.c `mv`: the `[remote "<old>"]` section is renamed in place; each
132
+ * fetch refspec writing under `refs/remotes/<old>/` is rewritten to `refs/remotes/<new>/`,
133
+ * the others kept with git's warning; `branch.<b>.remote` and `branch.<b>.pushRemote`
134
+ * naming the remote are updated. When a refspec was rewritten, the refs under
135
+ * `refs/remotes/<old>/` move to `refs/remotes/<new>/` in one batch, each with its reflog
136
+ * and a `remote: renamed <old ref> to <new ref>` line, symbolic refs (`HEAD`) re-pointed
137
+ * at the moved refs, and `remote.pushDefault` follows the new name.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * const { remote, warnings } = await git.remoteRename().setOldName("origin").setNewName("upstream").call();
142
+ * ```
143
+ */
144
+ export declare class RemoteRenameCommand extends GitCommand<RemoteRenameResult> {
145
+ private oldName?;
146
+ private newName?;
147
+ /** Set the remote to rename. */
148
+ setOldName(name: string): this;
149
+ /** Set the remote's new name. */
150
+ setNewName(name: string): this;
151
+ /**
152
+ * @throws RemoteNotFoundError if the remote has no config section (git: "No such remote: '<old>'")
153
+ * @throws RemoteAlreadyExistsError if the new name is taken (git: "remote <new> already exists.")
154
+ * @throws InvalidArgumentError for an invalid new name (git: "'<new>' is not a valid remote name")
155
+ */
156
+ call(): Promise<RemoteRenameResult>;
101
157
  }
102
158
  /**
103
159
  * List remotes in the repository.
@@ -202,4 +258,57 @@ export declare class RemoteSetUrlCommand extends GitCommand<RemoteConfig> {
202
258
  /** Whether any `refs/remotes/<name>/*` ref exists. */
203
259
  private hasTrackingRefs;
204
260
  }
261
+ /**
262
+ * Point `refs/remotes/<name>/HEAD` at one of the remote's tracking branches, or delete it.
263
+ *
264
+ * Equivalent to `git remote set-head <name> <branch>`, `git remote set-head <name> -a`
265
+ * and `git remote set-head <name> -d`. The symbolic ref names the remote's default branch,
266
+ * so the remote name alone resolves to that branch (`git log origin`); `git clone` creates
267
+ * it. With {@link setAuto} the remote is asked which branch its HEAD is (its HEAD symref,
268
+ * or else the one branch at HEAD's commit). As git 2.48+, setting it on a remote whose
269
+ * `remote.<name>.followRemoteHEAD` is `always` turns that into `warn`, so the next fetch
270
+ * does not undo the choice.
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * await git.remoteSetHead().setRemoteName("origin").setBranch("develop").call();
275
+ * await git.remoteSetHead().setRemoteName("origin").setAuto(true).call();
276
+ * await git.remoteSetHead().setRemoteName("origin").setDelete(true).call();
277
+ * ```
278
+ */
279
+ export declare class RemoteSetHeadCommand extends TransportCommand<string | undefined> {
280
+ private remoteName?;
281
+ private branch?;
282
+ private deleteHead;
283
+ private auto;
284
+ private messages;
285
+ /** Set the remote whose HEAD is set. */
286
+ setRemoteName(name: string): this;
287
+ /** Set the branch (`develop`, or `refs/remotes/origin/develop`) HEAD names. */
288
+ setBranch(branch: string): this;
289
+ /** Delete `refs/remotes/<name>/HEAD` instead (`-d`). */
290
+ setDelete(deleteHead: boolean): this;
291
+ /**
292
+ * What `git remote set-head -a` prints (git 2.48+): `'origin/HEAD' is now created and
293
+ * points to 'main'`, `… is unchanged and points to …`, `… has changed from 'a' and now
294
+ * points to 'b'`, and so on. Empty without {@link setAuto}, or before {@link call}.
295
+ */
296
+ getMessages(): string[];
297
+ /** Ask the remote which branch its HEAD is, and point at that one (`-a`). */
298
+ setAuto(auto: boolean): this;
299
+ /**
300
+ * @returns The tracking ref HEAD now names, or undefined after a delete
301
+ * @throws RefNotFoundError if the tracking branch does not exist (git: "Not a valid ref: <ref>")
302
+ * @throws RefNotFoundError with `-a` when the remote HEAD names no branch (git: "Cannot
303
+ * determine remote HEAD"), or several ("Multiple remote HEAD branches. Please choose
304
+ * one explicitly with:" and a `git remote set-head` line for each)
305
+ */
306
+ call(): Promise<string | undefined>;
307
+ /**
308
+ * The remote's HEAD branches, as git's get_remote_ref_states (GET_HEAD_NAMES) finds them:
309
+ * every ref listed, then the branch HEAD's symref names, or else every branch at HEAD's
310
+ * commit (git's guess_remote_head with all matches).
311
+ */
312
+ private remoteHeads;
313
+ }
205
314
  //# sourceMappingURL=remote-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-command.d.ts","sourceRoot":"","sources":["../../src/commands/remote-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,M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AEG;YACW,UAAU;IA8CxB;;OAEG;YACW,QAAQ;IAYtB;;OAEG;YACW,mBAAmB;IAQjC;;;;;;;;;;;;;;OAcG;YACW,gBAAgB;IAyB9B;;OAEG;YACW,YAAY;IAQ1B;;OAEG;YACW,mBAAmB;CA0BlC"}
1
+ {"version":3,"file":"reset-command.d.ts","sourceRoot":"","sources":["../../src/commands/reset-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,YAAa,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,CAAS;IACrB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,KAAK,CAAgB;IAE7B;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIxB;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAI7B;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAmCzB;IAED;;OAEG;YACW,UAAU;IA8CxB;;OAEG;YACW,QAAQ;IAYtB;;OAEG;YACW,mBAAmB;IAQjC;;;;;;;;;;;;;;OAcG;YACW,gBAAgB;IAqC9B;;OAEG;YACW,YAAY;IAQ1B;;OAEG;YACW,mBAAmB;CA0BlC"}
@@ -8,18 +8,16 @@ import type { StashApplyResult } from "../results/stash-result.js";
8
8
  *
9
9
  * Based on JGit's StashApplyCommand.
10
10
  *
11
- * The stashed changes are three-way merged against the current HEAD and the
12
- * result is written back: the merged working tree always, the merged index
13
- * when `restoreIndex` is set, and the stashed untracked files when
14
- * `restoreUntracked` is set. A conflict aborts before anything is written.
11
+ * As git's `stash apply`: the stash's change is merged into the current index (staged
12
+ * content and newly staged files take part), line by line where both sides changed a
13
+ * file; the result goes to the worktree, refused up front where it would overwrite local
14
+ * changes or untracked files. A content conflict is written with conflict markers and
15
+ * staged at stages 1-3 (status CONFLICTS). Without `setRestoreIndex(true)` (`--index`)
16
+ * the index keeps its entries plus the files the stash adds; the stashed untracked files
17
+ * are restored first, refused (nothing written) where a file stands in their way.
15
18
  *
16
- * Known limits, shared with `reset --hard`:
17
- * - a symlink in the merged tree is refused, because the `Worktree` interface
18
- * has no primitive to create one - writing the target as a regular file
19
- * would silently produce a working tree that does not match;
20
- * - a gitlink's contents are not restored, as in git;
21
- * - directories left empty by a deletion are not pruned;
22
- * - the restore is not atomic across the working tree and the index.
19
+ * Known limits: a gitlink's contents are not restored, as in git; the restore is not
20
+ * atomic across the working tree and the index.
23
21
  *
24
22
  * @example
25
23
  * ```typescript
@@ -56,9 +54,12 @@ export declare class StashApplyCommand extends GitCommand<StashApplyResult> {
56
54
  */
57
55
  getStashRef(): string | undefined;
58
56
  /**
59
- * Set whether to restore the index state.
57
+ * Set whether to restore the index state (`git stash apply --index`): the stash's index
58
+ * change is merged into the current index, and a conflict there refuses the apply
59
+ * ("conflicts in index. Try without --index."). Off by default, as in git: the index then
60
+ * keeps its entries, plus the files the stash adds.
60
61
  *
61
- * @param restoreIndex true to restore index (default)
62
+ * @param restoreIndex true to restore the index (default false)
62
63
  */
63
64
  setRestoreIndex(restoreIndex: boolean): this;
64
65
  /**
@@ -109,6 +110,27 @@ export declare class StashApplyCommand extends GitCommand<StashApplyResult> {
109
110
  * @returns Result of the apply operation
110
111
  */
111
112
  call(): Promise<StashApplyResult>;
113
+ private apply;
114
+ /** Writes a blob to the worktree (a link as a link where the worktree has them). */
115
+ private writeBlob;
116
+ /**
117
+ * git's ort merge of a stash: `base` (the stash's parent) to `ours` (the current index)
118
+ * and to `theirs` (the stash). Renames on one side (exact, then by similarity of at least
119
+ * {@link DEFAULT_RENAME_SCORE}%) carry the other side's change to the new path; files both
120
+ * sides changed are merged line by line (`Updated upstream` / `Stashed changes` markers);
121
+ * binary files, modify/delete and file/directory collisions are conflicts as in git.
122
+ */
123
+ private mergeFlat;
124
+ /**
125
+ * The paths `side` renamed from `base`: a deleted path paired with an added one holding
126
+ * the same blob, else (text files) the most similar added one scoring at least
127
+ * {@link DEFAULT_RENAME_SCORE}, as git's rename detection.
128
+ */
129
+ private detectRenames;
130
+ /** Stores a flat path map as a tree. */
131
+ private storeFlat;
132
+ /** The blobs, links and gitlinks of a tree, by path. */
133
+ private flatTree;
112
134
  /**
113
135
  * Plan the restore of the stash's untracked files, if there are any to restore.
114
136
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stash-apply-command.d.ts","sourceRoot":"","sources":["../../src/commands/stash-apply-command.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AASnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,eAAe,CAAC,CAAuB;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAIlC;IAED;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED;;;;OAIG;IACH,eAAe,CAAC,YAAY,EAAE,OA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,EAAE,MAAM,GAAG,IAAI,CAIlC;IAED;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED;;;;;;;OAOG;IACH,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAI3C;IAED;;OAEG;IACH,eAAe,IAAI,OAAO,CAEzB;IAED;;;;OAIG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAInD;IAED;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAE7B;IAED;;;;;;OAMG;IACH,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAI/C;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAIzC;IAED;;OAEG;IACH,WAAW,IAAI,aAAa,CAE3B;IAED;;;;OAIG;IACH,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAI5D;IAED;;OAEG;IACH,uBAAuB,IAAI,oBAAoB,GAAG,SAAS,CAE1D;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAatC;YAEa,KAAK;IAyQnB,oFAAoF;YACtE,SAAS;IAgBvB;;;;;;OAMG;YACW,SAAS;IAiMvB;;;;OAIG;YACW,aAAa;IAmD3B,wCAAwC;YAC1B,SAAS;IA2BvB,wDAAwD;YAC1C,QAAQ;IAatB;;;;;;;;;;;;;OAaG;YACW,oBAAoB;IAuDlC;;OAEG;YACW,eAAe;CA8C9B"}
@@ -1,10 +1,23 @@
1
- import type { ObjectId, PersonIdent } from "@statewalker/vcs-core";
1
+ import { type ObjectId, type PersonIdent } from "@statewalker/vcs-core";
2
2
  import { GitCommand } from "../git-command.js";
3
+ /**
4
+ * What the reset after a stash covers, as `git stash push` options.
5
+ */
6
+ export interface StashResetOptions {
7
+ /** `-u`: the untracked files were stashed and are removed (`git clean -fd`) */
8
+ includeUntracked?: boolean;
9
+ /** `-a`: the ignored files too (`git clean -fdx`) */
10
+ includeIgnored?: boolean;
11
+ /** `--keep-index`: the index tree is checked out again after the reset */
12
+ keepIndex?: boolean;
13
+ /** The stashed index tree (for `keepIndex`) */
14
+ indexTree?: ObjectId;
15
+ }
3
16
  /**
4
17
  * Interface for providing working tree and index state.
5
18
  *
6
- * The stash create operation requires access to the working directory
7
- * and index, which requires a WorkingCopy with worktree access.
19
+ * A working copy with an index and a worktree has a built-in provider
20
+ * ({@link WorkingCopyStashProvider}); set one only to stash something else.
8
21
  */
9
22
  export interface StashWorkingTreeProvider {
10
23
  /**
@@ -16,17 +29,23 @@ export interface StashWorkingTreeProvider {
16
29
  */
17
30
  getWorkingTree(): Promise<ObjectId>;
18
31
  /**
19
- * Get tree of untracked files (optional).
32
+ * Get tree of untracked files (optional); the ignored ones too with `includeIgnored`.
20
33
  */
21
- getUntrackedTree?(): Promise<ObjectId | undefined>;
34
+ getUntrackedTree?(options?: {
35
+ includeIgnored?: boolean;
36
+ }): Promise<ObjectId | undefined>;
22
37
  /**
23
- * Check if there are local changes to stash.
38
+ * Check if there are local changes to stash (untracked files count with
39
+ * `includeUntracked`, as `git stash -u`).
24
40
  */
25
- hasLocalChanges(): Promise<boolean>;
41
+ hasLocalChanges(options?: {
42
+ includeUntracked?: boolean;
43
+ includeIgnored?: boolean;
44
+ }): Promise<boolean>;
26
45
  /**
27
- * Reset working directory to HEAD after stash.
46
+ * Reset the working directory and index to HEAD after the stash, as `git stash push`.
28
47
  */
29
- resetHard(): Promise<void>;
48
+ resetHard(options?: StashResetOptions): Promise<void>;
30
49
  }
31
50
  /**
32
51
  * Command to create a stash commit.
@@ -35,22 +54,21 @@ export interface StashWorkingTreeProvider {
35
54
  *
36
55
  * Based on JGit's StashCreateCommand.
37
56
  *
38
- * Note: This command requires a working tree provider to access
39
- * uncommitted changes. Without a provider, it creates a stash
40
- * from the current HEAD state (no actual changes stashed).
57
+ * On a working copy with an index and a worktree it stashes as `git stash push` does:
58
+ * the index tree, the worktree tree (tracked files as they are on disk), with `-u` the
59
+ * untracked files, then resets the index and the worktree to HEAD (keeping untracked files
60
+ * unless they were stashed). A working copy without a worktree has nothing to stash:
61
+ * `call()` throws `StoreNotAvailableError` unless a provider is set.
41
62
  *
42
63
  * @example
43
64
  * ```typescript
44
- * // Create a stash with working tree provider
45
- * const stashCommit = await git.stashCreate()
46
- * .setWorkingTreeProvider(provider)
47
- * .setMessage("WIP: feature work")
48
- * .call();
65
+ * // git stash push -m "WIP: feature work"
66
+ * const stashCommit = await git.stashCreate().setMessage("WIP: feature work").call();
49
67
  *
50
- * // Create stash including untracked files
68
+ * // git stash push -u --keep-index
51
69
  * const stashCommit = await git.stashCreate()
52
- * .setWorkingTreeProvider(provider)
53
70
  * .setIncludeUntracked(true)
71
+ * .setKeepIndex(true)
54
72
  * .call();
55
73
  * ```
56
74
  */
@@ -59,6 +77,8 @@ export declare class StashCreateCommand extends GitCommand<ObjectId | undefined>
59
77
  private workingDirectoryMessage;
60
78
  private ref;
61
79
  private includeUntracked;
80
+ private includeIgnored;
81
+ private keepIndex;
62
82
  private workingTreeProvider?;
63
83
  private customMessage?;
64
84
  private author?;
@@ -78,14 +98,15 @@ export declare class StashCreateCommand extends GitCommand<ObjectId | undefined>
78
98
  */
79
99
  setWorkingDirectoryMessage(message: string): this;
80
100
  /**
81
- * Set a custom stash message.
101
+ * Set a custom stash message; the stash is then "On <branch>: <message>", as `git stash push -m`.
82
102
  *
83
103
  * @param message The custom message
84
104
  */
85
105
  setMessage(message: string): this;
86
106
  /**
87
107
  * Set the reference to update with the stashed commit ID.
88
- * If null, no reference is updated.
108
+ * If null, no reference is updated and the index and worktree are left as they are
109
+ * (`git stash create`).
89
110
  *
90
111
  * @param ref The ref name (default: refs/stash)
91
112
  */
@@ -100,6 +121,16 @@ export declare class StashCreateCommand extends GitCommand<ObjectId | undefined>
100
121
  * Get whether untracked files will be included.
101
122
  */
102
123
  getIncludeUntracked(): boolean;
124
+ /**
125
+ * Set whether to stash (and remove) the ignored files too, as `git stash --all`; implies
126
+ * untracked files.
127
+ */
128
+ setIncludeIgnored(includeIgnored: boolean): this;
129
+ /**
130
+ * Set whether the staged changes stay in the index and the worktree after the stash, as
131
+ * `git stash push --keep-index`.
132
+ */
133
+ setKeepIndex(keepIndex: boolean): this;
103
134
  /**
104
135
  * Set the working tree provider for accessing uncommitted changes.
105
136
  *
@@ -118,6 +149,9 @@ export declare class StashCreateCommand extends GitCommand<ObjectId | undefined>
118
149
  * @returns The stash commit ID, or undefined if nothing to stash
119
150
  */
120
151
  call(): Promise<ObjectId | undefined>;
152
+ private stash;
153
+ /** The built-in provider, for a working copy with an index and a worktree. */
154
+ private defaultProvider;
121
155
  /**
122
156
  * Format a message template.
123
157
  */
@@ -127,10 +161,10 @@ export declare class StashCreateCommand extends GitCommand<ObjectId | undefined>
127
161
  */
128
162
  private getCurrentBranchName;
129
163
  /**
130
- * Update the stash ref.
131
- *
132
- * Note: Reflog support is not part of the core RefStore interface.
133
- * Stash history is tracked via parent commit chain instead.
164
+ * Update the stash ref as `git stash` does (update_ref with REF_FORCE_CREATE_REFLOG):
165
+ * a one-ref batch, under `<ref>.lock` on git files, that creates the ref's reflog and
166
+ * appends a line with the stash commit's message, so the stash is `stash@{0}` and the
167
+ * earlier ones move down the reflog.
134
168
  */
135
169
  private updateStashRef;
136
170
  }