@osdlc/typed-git 0.12.0 → 0.14.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @osdlc/typed-git
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cb8eafc: `rebase` takes an `upstream` option: `git.rebase(onto, { upstream })` runs `git rebase --onto <onto> <upstream>`, replaying only the commits after `upstream`. Restacking a branch whose base was rewritten needs it, so the base's old commits are left behind instead of replayed onto its new ones.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [e1a5941]
12
+ - @osdlc/command-seam@0.15.0
13
+
14
+ ## 0.13.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 25ccd9e: `submodules()` is a new read verb: the submodules the index records, as `{ path, commit }` rows (`git ls-files --stage -z`, the mode `160000` gitlink entries). It reads the index, not `.gitmodules`, and says nothing of whether a submodule is checked out; its directory holds a `.git` when it is. A path in conflict appears once. `git.soft.submodules()` answers `[]` on failure.
19
+
3
20
  ## 0.12.0
4
21
 
5
22
  ### Minor Changes
package/README.md CHANGED
@@ -691,6 +691,7 @@ exit throws the classified failure.
691
691
  | `checkIgnoreVerbose(paths)` | `check-ignore -v --stdin -z` | `1` → empty list; rows are `{ path, source, line, pattern }`, a `!` pattern is a negation |
692
692
  | `lsFiles({ cached, others, excludeStandard, directory, paths })` | `ls-files -z` | none |
693
693
  | `lsFilesTagged()` | `ls-files -v -z` | none — `{ tag, path }` rows; `S` is skip-worktree, lowercase is assume-unchanged |
694
+ | `submodules()` | `ls-files --stage -z` | none — `{ path, commit }` per gitlink in the index; whether one is checked out is on disk (its `.git`) |
694
695
  | `forEachRef(pattern, { format, sort, count })` | `for-each-ref` | none — lines verbatim |
695
696
  | `refs(pattern)` | `forEachRef` + `parseRefRows` | none |
696
697
  | `diffNameOnly({ cached, diffFilter, rangeArgs, paths })` | `diff --name-only -z` | none |
@@ -762,7 +763,7 @@ other non-zero exit throws.
762
763
  | Method | git | Returns |
763
764
  | --- | --- | --- |
764
765
  | `merge(ref, { noFf, noCommit, ffOnly, message })` | `merge --no-edit` | `MergeOutcome` — with `ffOnly`, a merge that cannot fast-forward throws |
765
- | `rebase(onto, { autostash })` | `rebase` | `RebaseOutcome` |
766
+ | `rebase(onto, { autostash, upstream })` | `rebase` (`--onto <onto> <upstream>` with `upstream`) | `RebaseOutcome` |
766
767
  | `rebaseContinue()` | `-c core.editor=true rebase --continue` | `RebaseOutcome` |
767
768
  | `mergeTree(ours, theirs, { mergeBase })` | `merge-tree --write-tree --name-only -z` | `MergeTreeOutcome` |
768
769
  | `lsFilesUnmerged()` | `ls-files -u -z` | `UnmergedEntry[]` — mode, sha, stage, path |
package/dist/async.d.ts CHANGED
@@ -17,7 +17,7 @@ import { type GitBackend, type GitCallOptions } from './backend.ts';
17
17
  import type { GitVersion } from './git-version.ts';
18
18
  import { type Soft, type TriedAsync } from './outcome.ts';
19
19
  import { type RemoteCoordinate } from './remote-url.ts';
20
- import { type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CommitOptions, type CheckoutOptions, type ConfigGetOptions, type CloneOptions, type ConflictSide, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type TaggedFile, type UnmergedEntry, type ConfigSetOptions, type DiffEntry, type DiffNameOnlyOptions, type DiffStatOptions, type DiffNameStatusOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type GrepOptions, type InitOptions, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type NumstatEntry, type PushReport, type RemoteRef, type CleanOptions, type DiffCheckOptions, type DiffCheckResult, type StatusEntry, type StatusPorcelainOptions, type TreeEntry, type Worktree, type WorktreeAddOptions, type WorktreeMoveOptions, type GcOptions, type PushOptions, type RemoteSetBranchesOptions, type RemoteSetHeadOptions } from './verbs.ts';
20
+ import { type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CommitOptions, type CheckoutOptions, type ConfigGetOptions, type CloneOptions, type ConflictSide, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type IndexSubmodule, type TaggedFile, type UnmergedEntry, type ConfigSetOptions, type DiffEntry, type DiffNameOnlyOptions, type DiffStatOptions, type DiffNameStatusOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type GrepOptions, type InitOptions, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type NumstatEntry, type PushReport, type RemoteRef, type CleanOptions, type DiffCheckOptions, type DiffCheckResult, type StatusEntry, type StatusPorcelainOptions, type TreeEntry, type Worktree, type WorktreeAddOptions, type WorktreeMoveOptions, type GcOptions, type PushOptions, type RemoteSetBranchesOptions, type RemoteSetHeadOptions } from './verbs.ts';
21
21
  /** A typed, awaitable git client bound to one working directory. */
22
22
  export declare class AsyncGit {
23
23
  readonly cwd: string;
@@ -173,6 +173,8 @@ export declare class AsyncGit {
173
173
  lsFiles(opts?: GitCallOptions & LsFilesOptions): Promise<string[]>;
174
174
  /** Tracked files with their `ls-files -v` tag. See {@link Git.lsFilesTagged}. */
175
175
  lsFilesTagged(opts?: GitCallOptions): Promise<TaggedFile[]>;
176
+ /** The submodules the index records. See {@link Git.submodules}. */
177
+ submodules(opts?: GitCallOptions): Promise<IndexSubmodule[]>;
176
178
  /**
177
179
  * The unified diff; `""` when nothing differs. A bad rev, or a cwd outside a
178
180
  * repository, rejects. See {@link Git.diffText}.
package/dist/async.js CHANGED
@@ -279,6 +279,10 @@ export class AsyncGit {
279
279
  lsFilesTagged(opts = {}) {
280
280
  return this.backend.execute(this.cwd, { kind: 'lsFilesTagged' }, opts);
281
281
  }
282
+ /** The submodules the index records. See {@link Git.submodules}. */
283
+ submodules(opts = {}) {
284
+ return this.backend.execute(this.cwd, { kind: 'submodules' }, opts);
285
+ }
282
286
  /**
283
287
  * The unified diff; `""` when nothing differs. A bad rev, or a cwd outside a
284
288
  * repository, rejects. See {@link Git.diffText}.
package/dist/backend.d.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import { type AsyncCommandRunner, type CommandResult } from '@osdlc/command-seam';
21
21
  import { type GitVersion } from './git-version.ts';
22
- import { type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CheckoutOptions, type CloneOptions, type CommitOptions, type ConfigGetOptions, type ConfigSetOptions, type ConflictSide, type DiffEntry, type DiffNameOnlyOptions, type DiffStatOptions, type DiffNameStatusOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type GcOptions, type GrepOptions, type InitOptions, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type NumstatEntry, type PushOptions, type PushReport, type RemoteSetBranchesOptions, type RemoteSetHeadOptions, type WorktreeAddOptions, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type RemoteRef, type CleanOptions, type DiffCheckOptions, type DiffCheckResult, type StatusEntry, type StatusPorcelainOptions, type TreeEntry, type TaggedFile, type UnmergedEntry, type Worktree, type WorktreeMoveOptions } from './verbs.ts';
22
+ import { type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CheckoutOptions, type CloneOptions, type CommitOptions, type ConfigGetOptions, type ConfigSetOptions, type ConflictSide, type DiffEntry, type DiffNameOnlyOptions, type DiffStatOptions, type DiffNameStatusOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type GcOptions, type GrepOptions, type InitOptions, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type NumstatEntry, type PushOptions, type PushReport, type RemoteSetBranchesOptions, type RemoteSetHeadOptions, type WorktreeAddOptions, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type RemoteRef, type CleanOptions, type DiffCheckOptions, type DiffCheckResult, type StatusEntry, type StatusPorcelainOptions, type TreeEntry, type IndexSubmodule, type TaggedFile, type UnmergedEntry, type Worktree, type WorktreeMoveOptions } from './verbs.ts';
23
23
  /** Per-call concerns that are not part of the operation itself. */
24
24
  export interface GitCallOptions {
25
25
  /**
@@ -143,6 +143,8 @@ export type GitRequest = {
143
143
  kind: 'lsFiles';
144
144
  } & LsFilesOptions) | {
145
145
  kind: 'lsFilesTagged';
146
+ } | {
147
+ kind: 'submodules';
146
148
  } | ({
147
149
  kind: 'forEachRef';
148
150
  pattern: string | string[];
@@ -323,6 +325,7 @@ export interface GitResults {
323
325
  commitTree: string;
324
326
  lsFiles: string[];
325
327
  lsFilesTagged: TaggedFile[];
328
+ submodules: IndexSubmodule[];
326
329
  forEachRef: string[];
327
330
  diffNameOnly: string[];
328
331
  diffStat: string;
package/dist/backend.js CHANGED
@@ -94,6 +94,8 @@ function toVerb(request) {
94
94
  return v.lsFiles(request);
95
95
  case 'lsFilesTagged':
96
96
  return v.lsFilesTagged();
97
+ case 'submodules':
98
+ return v.submodules();
97
99
  case 'forEachRef':
98
100
  return v.forEachRef(request.pattern, request);
99
101
  case 'diffNameOnly':
package/dist/client.d.ts CHANGED
@@ -22,5 +22,5 @@ export { classifyGitFailure, describeGitFailure, type GitFailure, type GitFailur
22
22
  export { type Soft, type TriedAsync, type TriedSync } from './outcome.ts';
23
23
  export { GIT_FEATURES, GIT_FLOOR, gitSupports, type GitFeature, type GitFeatureSpec, type GitRelease, type UnsupportedGit, } from './features.ts';
24
24
  export { compareGitVersions, parseGitVersion, type GitVersion } from './git-version.ts';
25
- export { forceWithLeaseArg, parseRefRows, PUSH_REJECTIONS, REF_FORMAT, type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CheckoutOptions, type CleanOptions, type CloneOptions, type CommitFlags, type CommitOptions, type ConfigGetOptions, type ConfigScope, type ConfigSetOptions, type ConflictSide, type DiffCheckOptions, type DiffCheckResult, type DiffEntry, type DiffNameOnlyOptions, type DiffNameStatusOptions, type DiffStatOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type ForceLease, type GcOptions, type GrepOptions, type InitOptions, type IntegrationOutcome, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type NumstatEntry, type PushFlag, type PushOptions, type PushRefResult, type PushRejection, type PushRejectionInfo, type PushReport, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type RemoteRef, type RemoteSetBranchesOptions, type RemoteSetHeadOptions, type StatusEntry, type StatusPorcelainOptions, type TaggedFile, type TreeEntry, type UnmergedEntry, type Worktree, type WorktreeAddOptions, type WorktreeMoveOptions, } from './verbs.ts';
25
+ export { forceWithLeaseArg, parseRefRows, PUSH_REJECTIONS, REF_FORMAT, type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CheckoutOptions, type CleanOptions, type CloneOptions, type CommitFlags, type CommitOptions, type ConfigGetOptions, type ConfigScope, type ConfigSetOptions, type ConflictSide, type DiffCheckOptions, type DiffCheckResult, type DiffEntry, type DiffNameOnlyOptions, type DiffNameStatusOptions, type DiffStatOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type ForceLease, type GcOptions, type GrepOptions, type InitOptions, type IntegrationOutcome, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type NumstatEntry, type PushFlag, type PushOptions, type PushRefResult, type PushRejection, type PushRejectionInfo, type PushReport, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type RemoteRef, type RemoteSetBranchesOptions, type RemoteSetHeadOptions, type StatusEntry, type StatusPorcelainOptions, type IndexSubmodule, type TaggedFile, type TreeEntry, type UnmergedEntry, type Worktree, type WorktreeAddOptions, type WorktreeMoveOptions, } from './verbs.ts';
26
26
  export { asAsync, CommandFailed, runChecked, runCheckedAsync, spawnRunner, spawnRunnerAsync, type AsyncCommandRunner, type AsyncCommandRunOptions, type CommandResult, type CommandRunner, type CommandRunOptions, } from '@osdlc/command-seam';
package/dist/soft.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare const SOFT_TABLE: {
35
35
  readonly lsRemote: "empty";
36
36
  readonly lsFiles: "empty";
37
37
  readonly lsFilesTagged: "empty";
38
+ readonly submodules: "empty";
38
39
  readonly refs: "empty";
39
40
  readonly forEachRef: "empty";
40
41
  readonly diffNameOnly: "empty";
package/dist/soft.js CHANGED
@@ -35,6 +35,7 @@ export const SOFT_TABLE = {
35
35
  lsRemote: 'empty',
36
36
  lsFiles: 'empty',
37
37
  lsFilesTagged: 'empty',
38
+ submodules: 'empty',
38
39
  refs: 'empty',
39
40
  forEachRef: 'empty',
40
41
  diffNameOnly: 'empty',
package/dist/sync.d.ts CHANGED
@@ -19,7 +19,7 @@ import { type CommandResult, type CommandRunner } from '@osdlc/command-seam';
19
19
  import { type GitVersion } from './git-version.ts';
20
20
  import { type Soft, type TriedSync } from './outcome.ts';
21
21
  import { type RemoteCoordinate } from './remote-url.ts';
22
- import { type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CommitOptions, type CheckoutOptions, type ConfigGetOptions, type CloneOptions, type ConflictSide, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type TaggedFile, type UnmergedEntry, type ConfigSetOptions, type DiffEntry, type DiffNameOnlyOptions, type DiffStatOptions, type DiffNameStatusOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type GrepOptions, type InitOptions, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type NumstatEntry, type PushReport, type RemoteRef, type CleanOptions, type DiffCheckOptions, type DiffCheckResult, type StatusEntry, type StatusPorcelainOptions, type TreeEntry, type Worktree, type WorktreeAddOptions, type WorktreeMoveOptions, type GcOptions, type PushOptions, type RemoteSetBranchesOptions, type RemoteSetHeadOptions } from './verbs.ts';
22
+ import { type AddOptions, type AheadBehind, type CherryEntry, type CommitTreeOptions, type CommitOptions, type CheckoutOptions, type ConfigGetOptions, type CloneOptions, type ConflictSide, type MergeOptions, type MergeOutcome, type MergeTreeOptions, type MergeTreeOutcome, type RebaseOptions, type RebaseOutcome, type RemoteGetUrlOptions, type IndexSubmodule, type TaggedFile, type UnmergedEntry, type ConfigSetOptions, type DiffEntry, type DiffNameOnlyOptions, type DiffStatOptions, type DiffNameStatusOptions, type DiffTextOptions, type DiffTreeOptions, type FetchOptions, type ForEachRefOptions, type GrepOptions, type InitOptions, type LogOptions, type IgnoreMatch, type LsFilesOptions, type LsRemoteOptions, type LsTreeOptions, type NumstatEntry, type PushReport, type RemoteRef, type CleanOptions, type DiffCheckOptions, type DiffCheckResult, type StatusEntry, type StatusPorcelainOptions, type TreeEntry, type Worktree, type WorktreeAddOptions, type WorktreeMoveOptions, type GcOptions, type PushOptions, type RemoteSetBranchesOptions, type RemoteSetHeadOptions } from './verbs.ts';
23
23
  /**
24
24
  * Per-call concerns that are not part of the operation itself.
25
25
  *
@@ -278,6 +278,8 @@ export declare class Git {
278
278
  lsFiles(opts?: GitSyncCallOptions & LsFilesOptions): string[];
279
279
  /** Tracked files with their `ls-files -v` tag — see `lsFilesTagged` in `verbs.ts`. */
280
280
  lsFilesTagged(opts?: GitSyncCallOptions): TaggedFile[];
281
+ /** The submodules the index records, as `{ path, commit }` — see `submodules` in `verbs.ts`. */
282
+ submodules(opts?: GitSyncCallOptions): IndexSubmodule[];
281
283
  /**
282
284
  * The unified diff; `""` when nothing differs. A bad rev, or a cwd outside a
283
285
  * repository, throws. See `diffText` in `verbs.ts`.
package/dist/sync.js CHANGED
@@ -403,6 +403,10 @@ export class Git {
403
403
  lsFilesTagged(opts = {}) {
404
404
  return this.exec(v.lsFilesTagged(), opts);
405
405
  }
406
+ /** The submodules the index records, as `{ path, commit }` — see `submodules` in `verbs.ts`. */
407
+ submodules(opts = {}) {
408
+ return this.exec(v.submodules(), opts);
409
+ }
406
410
  /**
407
411
  * The unified diff; `""` when nothing differs. A bad rev, or a cwd outside a
408
412
  * repository, throws. See `diffText` in `verbs.ts`.
package/dist/verbs.d.ts CHANGED
@@ -468,6 +468,28 @@ export interface TaggedFile {
468
468
  * as {@link lsFiles} does.
469
469
  */
470
470
  export declare function lsFilesTagged(): GitVerb<TaggedFile[]>;
471
+ /** One submodule the index records: a gitlink entry (`ls-files --stage`, mode `160000`). */
472
+ export interface IndexSubmodule {
473
+ /** The submodule's path from the repository root, `/`-separated. */
474
+ path: string;
475
+ /** The commit the index records for it, which need not be the one checked out. */
476
+ commit: string;
477
+ }
478
+ /**
479
+ * The submodules this repository's index records (`git ls-files --stage -z`,
480
+ * the mode `160000` gitlink entries), in index order.
481
+ *
482
+ * It reads the index, not `.gitmodules`, so it lists what a checkout holds:
483
+ * a submodule added but not committed is here, one only named in
484
+ * `.gitmodules` is not. It says nothing of whether a submodule is checked
485
+ * out: its directory holds a `.git` when it is. Nested submodules belong to
486
+ * the submodule's own index; ask a client at that path. A path in conflict
487
+ * appears once, with the commit of its lowest stage.
488
+ *
489
+ * `absent: []` — a repository with no submodules is exit 0 and no gitlinks,
490
+ * so `[]` means "none". Outside a repository git exits 128 and this throws.
491
+ */
492
+ export declare function submodules(): GitVerb<IndexSubmodule[]>;
471
493
  /** Options for {@link forEachRef}. */
472
494
  export interface ForEachRefOptions {
473
495
  /** `--format=` value; defaults to `%(objectname)%09%(refname)`. */
@@ -1391,9 +1413,17 @@ export declare function mergeAbort(): GitVerb<void>;
1391
1413
  export interface RebaseOptions {
1392
1414
  /** `--autostash` — shelve and restore a dirty tree around the replay. */
1393
1415
  autostash?: boolean | undefined;
1416
+ /**
1417
+ * `--onto <onto> <upstream>`: replay only the commits after `upstream`
1418
+ * (`upstream..HEAD`), not every commit `onto` lacks. Restacking a branch
1419
+ * whose base was rewritten needs it: pass the base's old head, so the old
1420
+ * base commits are left behind instead of replayed onto the new ones.
1421
+ */
1422
+ upstream?: string | undefined;
1394
1423
  }
1395
1424
  /**
1396
- * Replay the current branch onto `onto` (`git rebase`).
1425
+ * Replay the current branch onto `onto` (`git rebase`, or
1426
+ * `git rebase --onto <onto> <upstream>` with `upstream`).
1397
1427
  *
1398
1428
  * `absent: [1]` for the same reason as {@link merge}. An unknown ref exits
1399
1429
  * 128 here rather than 1, so this verb is the less ambiguous of the two —
package/dist/verbs.js CHANGED
@@ -704,6 +704,40 @@ export function lsFilesTagged() {
704
704
  },
705
705
  };
706
706
  }
707
+ /** `<mode> <sha> <stage>\t<path>` */
708
+ const STAGE_ROW = /^(\d+) ([0-9a-f]+) ([0123])\t(.*)$/s;
709
+ /**
710
+ * The submodules this repository's index records (`git ls-files --stage -z`,
711
+ * the mode `160000` gitlink entries), in index order.
712
+ *
713
+ * It reads the index, not `.gitmodules`, so it lists what a checkout holds:
714
+ * a submodule added but not committed is here, one only named in
715
+ * `.gitmodules` is not. It says nothing of whether a submodule is checked
716
+ * out: its directory holds a `.git` when it is. Nested submodules belong to
717
+ * the submodule's own index; ask a client at that path. A path in conflict
718
+ * appears once, with the commit of its lowest stage.
719
+ *
720
+ * `absent: []` — a repository with no submodules is exit 0 and no gitlinks,
721
+ * so `[]` means "none". Outside a repository git exits 128 and this throws.
722
+ */
723
+ export function submodules() {
724
+ return {
725
+ argv: ['ls-files', '--stage', '-z'],
726
+ absent: NONE,
727
+ parse(r) {
728
+ const rows = [];
729
+ const seen = new Set();
730
+ for (const chunk of r.stdout.split('\x00')) {
731
+ const m = STAGE_ROW.exec(chunk);
732
+ if (m === null || m[1] !== '160000' || seen.has(m[4]))
733
+ continue;
734
+ seen.add(m[4]);
735
+ rows.push({ path: m[4], commit: m[2] });
736
+ }
737
+ return rows;
738
+ },
739
+ };
740
+ }
707
741
  /** The `forEachRef` format {@link refs} parses: sha, TAB, full refname. */
708
742
  export const REF_FORMAT = '%(objectname)%09%(refname)';
709
743
  /**
@@ -1857,7 +1891,8 @@ export function mergeAbort() {
1857
1891
  return { argv: ['merge', '--abort'], absent: NONE, parse: nothing };
1858
1892
  }
1859
1893
  /**
1860
- * Replay the current branch onto `onto` (`git rebase`).
1894
+ * Replay the current branch onto `onto` (`git rebase`, or
1895
+ * `git rebase --onto <onto> <upstream>` with `upstream`).
1861
1896
  *
1862
1897
  * `absent: [1]` for the same reason as {@link merge}. An unknown ref exits
1863
1898
  * 128 here rather than 1, so this verb is the less ambiguous of the two —
@@ -1867,7 +1902,11 @@ export function rebase(onto, opts = {}) {
1867
1902
  const argv = ['rebase'];
1868
1903
  if (opts.autostash)
1869
1904
  argv.push('--autostash');
1870
- argv.push(positional('rebase', 'onto', onto));
1905
+ if (opts.upstream === undefined)
1906
+ argv.push(positional('rebase', 'onto', onto));
1907
+ else {
1908
+ argv.push('--onto', positional('rebase', 'onto', onto), positional('rebase', 'upstream', opts.upstream));
1909
+ }
1871
1910
  const verb = {
1872
1911
  argv,
1873
1912
  env: C_LOCALE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdlc/typed-git",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "A typed git client for TypeScript, sync and awaitable. Each verb declares what absence means for it; every other failure throws. git.try.* inspects, raw() bypasses — over an injectable backend that drives the git CLI or any other implementation.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "sksizer",
@@ -52,7 +52,7 @@
52
52
  ],
53
53
  "dependencies": {
54
54
  "hosted-git-info": "^10.1.1",
55
- "@osdlc/command-seam": "^0.14.0",
55
+ "@osdlc/command-seam": "^0.15.0",
56
56
  "@osdlc/result": "^0.1.0"
57
57
  },
58
58
  "devDependencies": {