@ibgib/vcs-gib 0.0.30 → 0.0.32
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/dist/AUTO-GENERATED-version.d.mts +1 -1
- package/dist/AUTO-GENERATED-version.mjs +1 -1
- package/dist/bootstrap/node-bootstrap.mjs +1 -1
- package/dist/bootstrap/node-bootstrap.mjs.map +1 -1
- package/dist/cli/commands/add-cmd.d.mts +2 -3
- package/dist/cli/commands/add-cmd.d.mts.map +1 -1
- package/dist/cli/commands/add-cmd.mjs +30 -283
- package/dist/cli/commands/add-cmd.mjs.map +1 -1
- package/dist/cli/commands/branch-cmd.d.mts +8 -8
- package/dist/cli/commands/branch-cmd.d.mts.map +1 -1
- package/dist/cli/commands/branch-cmd.mjs +45 -176
- package/dist/cli/commands/branch-cmd.mjs.map +1 -1
- package/dist/cli/commands/checkout-cmd.d.mts +2 -4
- package/dist/cli/commands/checkout-cmd.d.mts.map +1 -1
- package/dist/cli/commands/checkout-cmd.mjs +31 -110
- package/dist/cli/commands/checkout-cmd.mjs.map +1 -1
- package/dist/cli/commands/commit-cmd.d.mts +7 -8
- package/dist/cli/commands/commit-cmd.d.mts.map +1 -1
- package/dist/cli/commands/commit-cmd.mjs +40 -390
- package/dist/cli/commands/commit-cmd.mjs.map +1 -1
- package/dist/cli/commands/generate-comment-cmd.d.mts.map +1 -1
- package/dist/cli/commands/generate-comment-cmd.mjs +5 -2
- package/dist/cli/commands/generate-comment-cmd.mjs.map +1 -1
- package/dist/cli/commands/init-cmd.d.mts +2 -2
- package/dist/cli/commands/init-cmd.d.mts.map +1 -1
- package/dist/cli/commands/init-cmd.mjs +20 -70
- package/dist/cli/commands/init-cmd.mjs.map +1 -1
- package/dist/cli/commands/log-cmd.d.mts +2 -3
- package/dist/cli/commands/log-cmd.d.mts.map +1 -1
- package/dist/cli/commands/log-cmd.mjs +42 -271
- package/dist/cli/commands/log-cmd.mjs.map +1 -1
- package/dist/cli/commands/merge-cmd.d.mts +3 -17
- package/dist/cli/commands/merge-cmd.d.mts.map +1 -1
- package/dist/cli/commands/merge-cmd.mjs +32 -218
- package/dist/cli/commands/merge-cmd.mjs.map +1 -1
- package/dist/cli/commands/reset-cmd.d.mts +1 -1
- package/dist/cli/commands/reset-cmd.d.mts.map +1 -1
- package/dist/cli/commands/reset-cmd.mjs +17 -19
- package/dist/cli/commands/reset-cmd.mjs.map +1 -1
- package/dist/cli/commands/restore-cmd.d.mts +8 -7
- package/dist/cli/commands/restore-cmd.d.mts.map +1 -1
- package/dist/cli/commands/restore-cmd.mjs +44 -62
- package/dist/cli/commands/restore-cmd.mjs.map +1 -1
- package/dist/cli/commands/status-cmd.d.mts +2 -2
- package/dist/cli/commands/status-cmd.d.mts.map +1 -1
- package/dist/cli/commands/status-cmd.mjs +63 -62
- package/dist/cli/commands/status-cmd.mjs.map +1 -1
- package/dist/cli/vcs-projection-helper.d.mts +23 -0
- package/dist/cli/vcs-projection-helper.d.mts.map +1 -0
- package/dist/cli/vcs-projection-helper.mjs +91 -0
- package/dist/cli/vcs-projection-helper.mjs.map +1 -0
- package/dist/test/test-helpers.d.mts +2 -2
- package/dist/test/test-helpers.d.mts.map +1 -1
- package/package.json +3 -3
- package/src/AUTO-GENERATED-version.mts +1 -1
- package/src/bootstrap/node-bootstrap.mts +1 -1
- package/src/cli/cli-e2e.respec.mts +4 -4
- package/src/cli/commands/add-cmd.mts +32 -347
- package/src/cli/commands/branch-cmd.mts +56 -225
- package/src/cli/commands/checkout-cmd.mts +34 -138
- package/src/cli/commands/commit-cmd.mts +46 -473
- package/src/cli/commands/commit-log-cmd.respec.mts +11 -7
- package/src/cli/commands/generate-comment-cmd.mts +6 -2
- package/src/cli/commands/init-cmd.mts +20 -73
- package/src/cli/commands/log-cmd.mts +41 -331
- package/src/cli/commands/merge-cmd.mts +32 -252
- package/src/cli/commands/reset-cmd.mts +17 -19
- package/src/cli/commands/restore-cmd.mts +52 -72
- package/src/cli/commands/status-add-cmd.respec.mts +3 -3
- package/src/cli/commands/status-cmd.mts +68 -63
- package/src/cli/vcs-projection-helper.mts +112 -0
- package/src/engine/branch/branch-space.respec.mts +5 -5
- package/src/engine/merge/b2tfs-sync-comments.respec.mts +4 -4
- package/src/test/test-helpers.mts +2 -2
- package/src/vcs-gib.respec.mts +11 -8
- package/tsconfig.test.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/engine/branch/branch-graph-helper.d.mts +0 -28
- package/dist/engine/branch/branch-graph-helper.d.mts.map +0 -1
- package/dist/engine/branch/branch-graph-helper.mjs +0 -81
- package/dist/engine/branch/branch-graph-helper.mjs.map +0 -1
- package/dist/engine/branch/branch-helper.d.mts +0 -40
- package/dist/engine/branch/branch-helper.d.mts.map +0 -1
- package/dist/engine/branch/branch-helper.mjs +0 -78
- package/dist/engine/branch/branch-helper.mjs.map +0 -1
- package/dist/engine/branch/branch-space-helper.d.mts +0 -23
- package/dist/engine/branch/branch-space-helper.d.mts.map +0 -1
- package/dist/engine/branch/branch-space-helper.mjs +0 -78
- package/dist/engine/branch/branch-space-helper.mjs.map +0 -1
- package/dist/engine/branch/branch-types.d.mts +0 -26
- package/dist/engine/branch/branch-types.d.mts.map +0 -1
- package/dist/engine/branch/branch-types.mjs +0 -7
- package/dist/engine/branch/branch-types.mjs.map +0 -1
- package/dist/engine/diff/line-diff-helper.d.mts +0 -76
- package/dist/engine/diff/line-diff-helper.d.mts.map +0 -1
- package/dist/engine/diff/line-diff-helper.mjs +0 -144
- package/dist/engine/diff/line-diff-helper.mjs.map +0 -1
- package/dist/engine/filter/glob-helper.d.mts +0 -51
- package/dist/engine/filter/glob-helper.d.mts.map +0 -1
- package/dist/engine/filter/glob-helper.mjs +0 -132
- package/dist/engine/filter/glob-helper.mjs.map +0 -1
- package/dist/engine/index/index-helper.d.mts +0 -113
- package/dist/engine/index/index-helper.d.mts.map +0 -1
- package/dist/engine/index/index-helper.mjs +0 -533
- package/dist/engine/index/index-helper.mjs.map +0 -1
- package/dist/engine/index/index-types.d.mts +0 -63
- package/dist/engine/index/index-types.d.mts.map +0 -1
- package/dist/engine/index/index-types.mjs +0 -7
- package/dist/engine/index/index-types.mjs.map +0 -1
- package/dist/engine/item/item-atom-helper.d.mts +0 -20
- package/dist/engine/item/item-atom-helper.d.mts.map +0 -1
- package/dist/engine/item/item-atom-helper.mjs +0 -30
- package/dist/engine/item/item-atom-helper.mjs.map +0 -1
- package/dist/engine/item/item-helper.d.mts +0 -94
- package/dist/engine/item/item-helper.d.mts.map +0 -1
- package/dist/engine/item/item-helper.mjs +0 -424
- package/dist/engine/item/item-helper.mjs.map +0 -1
- package/dist/engine/item/item-types.d.mts +0 -128
- package/dist/engine/item/item-types.d.mts.map +0 -1
- package/dist/engine/item/item-types.mjs +0 -16
- package/dist/engine/item/item-types.mjs.map +0 -1
- package/dist/engine/merge/b2tfs-3way-graft-strategy.d.mts +0 -74
- package/dist/engine/merge/b2tfs-3way-graft-strategy.d.mts.map +0 -1
- package/dist/engine/merge/b2tfs-3way-graft-strategy.mjs +0 -570
- package/dist/engine/merge/b2tfs-3way-graft-strategy.mjs.map +0 -1
- package/dist/engine/merge/b2tfs-3way-graft-types.d.mts +0 -34
- package/dist/engine/merge/b2tfs-3way-graft-types.d.mts.map +0 -1
- package/dist/engine/merge/b2tfs-3way-graft-types.mjs +0 -2
- package/dist/engine/merge/b2tfs-3way-graft-types.mjs.map +0 -1
- package/dist/engine/status/status-helper.d.mts +0 -90
- package/dist/engine/status/status-helper.d.mts.map +0 -1
- package/dist/engine/status/status-helper.mjs +0 -286
- package/dist/engine/status/status-helper.mjs.map +0 -1
- package/src/engine/branch/branch-graph-helper.mts +0 -117
- package/src/engine/branch/branch-helper.mts +0 -112
- package/src/engine/branch/branch-space-helper.mts +0 -110
- package/src/engine/branch/branch-types.mts +0 -29
- package/src/engine/diff/line-diff-helper.mts +0 -210
- package/src/engine/diff/line-diff-helper.respec.mts +0 -84
- package/src/engine/filter/glob-helper.mts +0 -165
- package/src/engine/filter/glob-helper.respec.mts +0 -94
- package/src/engine/index/index-helper.mts +0 -705
- package/src/engine/index/index-types.mts +0 -66
- package/src/engine/item/item-atom-helper.mts +0 -30
- package/src/engine/item/item-helper.mts +0 -544
- package/src/engine/item/item-types.mts +0 -137
- package/src/engine/item/item.respec.mts +0 -92
- package/src/engine/merge/b2tfs-3way-graft-strategy.mts +0 -630
- package/src/engine/merge/b2tfs-3way-graft-strategy.respec.mts +0 -346
- package/src/engine/merge/b2tfs-3way-graft-types.mts +0 -34
- package/src/engine/status/status-helper.mts +0 -383
|
@@ -1,60 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module merge-cmd
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Merges
|
|
6
|
-
* SyncSagaCoordinator sync and 3-way graft merge strategy.
|
|
7
|
-
* Projects merged branch snapshot onto the base branch physical worktree path.
|
|
8
|
-
*
|
|
9
|
-
* ## Terminology (matches standard git usage)
|
|
10
|
-
*
|
|
11
|
-
* * **base** branch / space — the branch currently checked out, the one being
|
|
12
|
-
* merged INTO (analogous to `ours` / `HEAD` in git)
|
|
13
|
-
* * **incoming** branch / space — the branch whose changes are being merged IN
|
|
14
|
-
* (analogous to `theirs` / the topic branch in git)
|
|
3
|
+
*
|
|
4
|
+
* CLI command handler for `vcs merge <branchName>`.
|
|
5
|
+
* Merges incoming branch into base branch and delegates to executeVcsMerge.
|
|
15
6
|
*/
|
|
16
7
|
|
|
17
8
|
import path from 'node:path';
|
|
18
9
|
import fs from 'node:fs/promises';
|
|
19
10
|
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { putInSpace, getLatestAddrs, persistTransformResult, registerNewIbGib } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
23
|
-
import { rel8 } from '@ibgib/ts-gib/dist/V1/transforms/rel8.mjs';
|
|
24
|
-
import { SyncSagaCoordinator } from '@ibgib/core-gib/dist/sync/sync-saga-coordinator.mjs';
|
|
25
|
-
import { SyncPeerInnerspace_V1 } from '@ibgib/core-gib/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
26
|
-
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from '@ibgib/core-gib/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
27
|
-
import { SyncConflictStrategy } from '@ibgib/core-gib/dist/sync/sync-constants.mjs';
|
|
28
|
-
import { GraftPreference } from '@ibgib/core-gib/dist/sync/graft-info/graft-info-types.mjs';
|
|
29
|
-
|
|
11
|
+
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
+
import { executeVcsMerge } from '@ibgib/core-gib/dist/vcs/commands/merge-cmd.mjs';
|
|
30
13
|
|
|
31
14
|
import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { writeB2tFSItemToFS, getIbGibWithMetaspaceFallback, reifyB2tFSHierarchy } from '../../engine/item/item-helper.mjs';
|
|
36
|
-
import { getB2tFSIndexIbGib, updateB2tFSIndexIbGib } from '../../engine/index/index-helper.mjs';
|
|
15
|
+
import { getOrCreateBranchSpace } from '@ibgib/node-gib/dist/vcs/branch-space-helper.mjs';
|
|
16
|
+
import { getOrCreateWorkspaceProjectionSpace } from '@ibgib/node-gib/dist/vcs/workspace-space-helper.mjs';
|
|
17
|
+
import { readVcsIndexProjectionFromDisk, writeVcsIndexProjectionToDisk } from '../vcs-projection-helper.mjs';
|
|
37
18
|
import { GLOBAL_LOG_A_LOT } from '../../vcs-gib-constants.mjs';
|
|
38
|
-
import { logBranchState, logItemState, logCheckpoint, logAddr, logAddrs } from '../../test/test-helpers.mjs';
|
|
39
|
-
|
|
40
19
|
|
|
41
20
|
const lcFile = `[merge-cmd]`;
|
|
42
21
|
const logalot = GLOBAL_LOG_A_LOT;
|
|
43
22
|
|
|
44
23
|
export interface MergeCmdOpts {
|
|
45
|
-
/** The incoming branch name — the branch whose changes will be merged in. */
|
|
46
24
|
incomingBranchName?: string;
|
|
47
25
|
targetDir?: string;
|
|
48
26
|
vcsFolderName?: string;
|
|
49
27
|
quiet?: boolean;
|
|
50
|
-
/** When true, emit diagnostic checkpoint logging (useful in tests). */
|
|
51
|
-
diagLog?: boolean;
|
|
52
28
|
}
|
|
53
29
|
|
|
54
30
|
export interface MergeCmdResult {
|
|
55
|
-
/** The base (current/active) branch name — merged into. */
|
|
56
31
|
baseBranch: string;
|
|
57
|
-
/** The incoming branch name — merged from. */
|
|
58
32
|
incomingBranch: string;
|
|
59
33
|
baseSpaceId: string;
|
|
60
34
|
incomingSpaceId: string;
|
|
@@ -67,10 +41,8 @@ export async function executeMergeCmd({
|
|
|
67
41
|
targetDir = process.cwd(),
|
|
68
42
|
vcsFolderName = '.vcsgib',
|
|
69
43
|
quiet = false,
|
|
70
|
-
diagLog = false,
|
|
71
44
|
}: MergeCmdOpts = {}): Promise<MergeCmdResult> {
|
|
72
45
|
const lc = `${lcFile}[${executeMergeCmd.name}]`;
|
|
73
|
-
const diag = (label: string) => { if (diagLog) logCheckpoint(`merge-cmd: ${label}`); };
|
|
74
46
|
try {
|
|
75
47
|
if (logalot) {
|
|
76
48
|
console.log(`${lc} starting... (I: 4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f)`);
|
|
@@ -96,54 +68,14 @@ export async function executeMergeCmd({
|
|
|
96
68
|
}
|
|
97
69
|
|
|
98
70
|
// 1. Fetch authoritative repository index from localSpace
|
|
99
|
-
const indexIbGib = await
|
|
71
|
+
const indexIbGib = await readVcsIndexProjectionFromDisk({ vcsPath, space: localSpace });
|
|
100
72
|
if (!indexIbGib) {
|
|
101
73
|
throw new Error(`Repository index B2tFSIndexIbGib_V1 not found in localSpace (E: 7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c)`);
|
|
102
74
|
}
|
|
103
75
|
|
|
104
76
|
const baseBranchName = indexIbGib.data?.activeBranch || 'main';
|
|
105
77
|
|
|
106
|
-
|
|
107
|
-
throw new Error(`Cannot merge branch '${trimmedIncomingBranch}' into itself (E: 8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d)`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 2. Fetch all registered branch ibgibs
|
|
111
|
-
const branchAddrs = [
|
|
112
|
-
...(indexIbGib.rel8ns?.branch || []),
|
|
113
|
-
...(indexIbGib.rel8ns?.branch_tjp || []),
|
|
114
|
-
];
|
|
115
|
-
|
|
116
|
-
let branchIbGibs: B2tFSBranchIbGib_V1[] = [];
|
|
117
|
-
if (branchAddrs.length > 0) {
|
|
118
|
-
for (const bAddr of branchAddrs) {
|
|
119
|
-
const bIbGib = await getIbGibWithMetaspaceFallback({
|
|
120
|
-
addr: bAddr,
|
|
121
|
-
space: localSpace,
|
|
122
|
-
metaspace,
|
|
123
|
-
});
|
|
124
|
-
if (bIbGib) {
|
|
125
|
-
branchIbGibs.push(bIbGib as B2tFSBranchIbGib_V1);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Resolve base branch node & incoming branch node
|
|
131
|
-
const baseBranchIbGib = branchIbGibs.findLast(
|
|
132
|
-
(b) => b?.data?.name === baseBranchName,
|
|
133
|
-
);
|
|
134
|
-
if (!baseBranchIbGib) {
|
|
135
|
-
throw new Error(`Base branch '${baseBranchName}' not found in repository (E: 9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e)`);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const incomingBranchIbGib = branchIbGibs.findLast(
|
|
139
|
-
(b) => b?.data?.name === trimmedIncomingBranch,
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
if (!incomingBranchIbGib) {
|
|
143
|
-
throw new Error(`Branch '${trimmedIncomingBranch}' does not exist (E: 0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f)`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// 3. Resolve base branch space & incoming branch space
|
|
78
|
+
// 2. Resolve base branch space & incoming branch space
|
|
147
79
|
const baseSpaceRes = await getOrCreateBranchSpace({
|
|
148
80
|
metaspace,
|
|
149
81
|
vcsPath,
|
|
@@ -158,139 +90,6 @@ export async function executeMergeCmd({
|
|
|
158
90
|
});
|
|
159
91
|
const incomingSpace = incomingSpaceRes.space;
|
|
160
92
|
|
|
161
|
-
await putInSpace({ space: baseSpace, ibGib: baseBranchIbGib });
|
|
162
|
-
await putInSpace({ space: incomingSpace, ibGib: incomingBranchIbGib });
|
|
163
|
-
|
|
164
|
-
// Resolve latest branch tip inside incomingSpace (in case commits occurred on incoming branch)
|
|
165
|
-
const incomingBranchTjpAddr = incomingBranchIbGib.rel8ns?.tjp?.at(0) || getIbGibAddr({ ibGib: incomingBranchIbGib });
|
|
166
|
-
const latestIncomingBranchRes = await getLatestAddrs({ space: incomingSpace, addrs: [incomingBranchTjpAddr] });
|
|
167
|
-
const latestIncomingBranchAddr = (latestIncomingBranchRes?.data as any)?.latestAddrs?.[0] || getIbGibAddr({ ibGib: incomingBranchIbGib });
|
|
168
|
-
|
|
169
|
-
const latestIncomingBranchIbGib = (await getIbGibWithMetaspaceFallback({
|
|
170
|
-
addr: latestIncomingBranchAddr,
|
|
171
|
-
space: incomingSpace,
|
|
172
|
-
metaspace,
|
|
173
|
-
})) as B2tFSBranchIbGib_V1 || incomingBranchIbGib;
|
|
174
|
-
|
|
175
|
-
const incomingRootAddr = latestIncomingBranchIbGib.rel8ns?.b2tfs_item?.at(-1);
|
|
176
|
-
|
|
177
|
-
if (!incomingRootAddr) {
|
|
178
|
-
throw new Error(`Incoming branch '${trimmedIncomingBranch}' has no valid root item address (E: 3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e)`);
|
|
179
|
-
}
|
|
180
|
-
const incomingRootItem = await getIbGibWithMetaspaceFallback({
|
|
181
|
-
addr: incomingRootAddr,
|
|
182
|
-
space: incomingSpace,
|
|
183
|
-
metaspace,
|
|
184
|
-
});
|
|
185
|
-
if (!incomingRootItem) {
|
|
186
|
-
throw new Error(`Incoming root item '${incomingRootAddr}' not found in incoming space (E: 4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f)`);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (diagLog) {
|
|
190
|
-
diag('resolving branches & spaces');
|
|
191
|
-
await logBranchState({ label: 'baseBranch (main)', branchIbGib: baseBranchIbGib, space: baseSpace });
|
|
192
|
-
await logBranchState({ label: 'incomingBranch (feature-merge)', branchIbGib: incomingBranchIbGib, space: incomingSpace });
|
|
193
|
-
await logItemState({ label: 'incomingRootItem', itemIbGib: incomingRootItem, space: incomingSpace });
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// 4. Setup SyncPeerInnerspace and SyncSagaCoordinator syncing incoming branch space into base branch space
|
|
197
|
-
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
198
|
-
await peer.initialized;
|
|
199
|
-
await peer.initializeOpts({
|
|
200
|
-
localMetaspace: metaspace,
|
|
201
|
-
localSpace: incomingSpace,
|
|
202
|
-
receiverSpace: baseSpace,
|
|
203
|
-
receiverCoordinator: new SyncSagaCoordinator(),
|
|
204
|
-
receiverMetaspace: metaspace,
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
const senderCoordinator = new SyncSagaCoordinator();
|
|
208
|
-
const syncSaga = await senderCoordinator.sync({
|
|
209
|
-
peer,
|
|
210
|
-
localSpace: incomingSpace,
|
|
211
|
-
metaspace,
|
|
212
|
-
domainIbGibs: [incomingRootItem],
|
|
213
|
-
conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
|
|
214
|
-
graftPreference: GraftPreference.receiver,
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
await syncSaga.done;
|
|
218
|
-
|
|
219
|
-
// 5. Reify the base branch filesystem hierarchy.
|
|
220
|
-
// After sync, any child timelines (files or subfolders) that were merged/advanced
|
|
221
|
-
// in baseSpace will have newer tips. reifyB2tFSHierarchy bubbles all updated child tips
|
|
222
|
-
// up through the folder DAG, evolving parents in-place and returning the newly reified root item.
|
|
223
|
-
const currentBaseRootItemAddr = baseBranchIbGib.rel8ns?.b2tfs_item?.at(-1);
|
|
224
|
-
if (!currentBaseRootItemAddr) {
|
|
225
|
-
throw new Error(`Base branch '${baseBranchName}' has no root item address (E: 6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d)`);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const reifyRes = await reifyB2tFSHierarchy({
|
|
229
|
-
rootItemAddr: currentBaseRootItemAddr,
|
|
230
|
-
space: baseSpace,
|
|
231
|
-
metaspace,
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
const reifiedRootItem = reifyRes.reifiedRootItem;
|
|
235
|
-
const reifiedRootAddr = getIbGibAddr({ ibGib: reifiedRootItem });
|
|
236
|
-
|
|
237
|
-
if (diagLog) {
|
|
238
|
-
diag('after reification');
|
|
239
|
-
logAddr('currentBaseRootItemAddr', currentBaseRootItemAddr);
|
|
240
|
-
logAddr('reifiedRootAddr', reifiedRootAddr);
|
|
241
|
-
console.log(`[merge-cmd] reification hasChanges:`, reifyRes.hasChanges);
|
|
242
|
-
console.log(`[merge-cmd] reifiedAddrsMap:`, JSON.stringify(reifyRes.reifiedAddrsMap));
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// 5b. Evolve the base branch ibgib to point at the reified root item tip.
|
|
246
|
-
// The sync engine does not update branch ibgibs — branches live in
|
|
247
|
-
// their own space and are never domain ibgibs in the sync. We advance
|
|
248
|
-
// the branch pointer to the reified root item.
|
|
249
|
-
let mergedBranchAddr: string = getIbGibAddr({ ibGib: baseBranchIbGib });
|
|
250
|
-
if (reifyRes.hasChanges && reifiedRootAddr !== currentBaseRootItemAddr) {
|
|
251
|
-
if (diagLog) {
|
|
252
|
-
console.log(`[merge-cmd] Evolving base branch: root item changing from ${currentBaseRootItemAddr} -> ${reifiedRootAddr}`);
|
|
253
|
-
}
|
|
254
|
-
const resRel8Branch = await rel8({
|
|
255
|
-
src: baseBranchIbGib,
|
|
256
|
-
rel8nsToReplaceByAddr: {
|
|
257
|
-
b2tfs_item: [{ oldAddr: currentBaseRootItemAddr, newAddr: reifiedRootAddr }],
|
|
258
|
-
},
|
|
259
|
-
dna: true,
|
|
260
|
-
nCounter: true,
|
|
261
|
-
});
|
|
262
|
-
const evolvedBranchIbGib = resRel8Branch.newIbGib;
|
|
263
|
-
await persistTransformResult({ resTransform: resRel8Branch, space: baseSpace });
|
|
264
|
-
await registerNewIbGib({ ibGib: evolvedBranchIbGib, space: baseSpace });
|
|
265
|
-
mergedBranchAddr = getIbGibAddr({ ibGib: evolvedBranchIbGib });
|
|
266
|
-
if (diagLog) {
|
|
267
|
-
console.log(`[merge-cmd] Base branch evolved to addr: ${mergedBranchAddr}`);
|
|
268
|
-
}
|
|
269
|
-
} else {
|
|
270
|
-
if (diagLog) {
|
|
271
|
-
console.log(`[merge-cmd] Base branch root item unchanged (${currentBaseRootItemAddr})`);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Update indexIbGib to reference new merged branch node
|
|
276
|
-
await updateB2tFSIndexIbGib({
|
|
277
|
-
space: baseSpace,
|
|
278
|
-
metaspace,
|
|
279
|
-
indexIbGib,
|
|
280
|
-
rel8nsToUpdate: {
|
|
281
|
-
branch: [mergedBranchAddr],
|
|
282
|
-
},
|
|
283
|
-
vcsPath,
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
const mergedRootItemAddr = reifiedRootAddr;
|
|
287
|
-
|
|
288
|
-
if (diagLog) {
|
|
289
|
-
diag('projecting onto disk');
|
|
290
|
-
logAddr('mergedRootItemAddr', mergedRootItemAddr);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// 6. Project merged branch snapshot files onto physical worktree disk
|
|
294
93
|
const isDefaultBranch = baseBranchName === 'main';
|
|
295
94
|
const worktreePath = isDefaultBranch
|
|
296
95
|
? repoRoot
|
|
@@ -298,46 +97,27 @@ export async function executeMergeCmd({
|
|
|
298
97
|
|
|
299
98
|
await fs.mkdir(worktreePath, { recursive: true });
|
|
300
99
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (diagLog) {
|
|
309
|
-
await logItemState({ label: 'mergedRootItem to write', itemIbGib: mergedRootItem, space: baseSpace });
|
|
310
|
-
}
|
|
100
|
+
const { space: workspaceSpace } = await getOrCreateWorkspaceProjectionSpace({
|
|
101
|
+
metaspace,
|
|
102
|
+
workspaceRoot: worktreePath,
|
|
103
|
+
vcsFolderName,
|
|
104
|
+
backingSpace: baseSpace,
|
|
105
|
+
});
|
|
311
106
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
addr: childAddr,
|
|
325
|
-
space: baseSpace,
|
|
326
|
-
metaspace,
|
|
327
|
-
}) as B2tFSItemIbGib_V1;
|
|
107
|
+
const mergeRes = await executeVcsMerge({
|
|
108
|
+
metaspace,
|
|
109
|
+
localSpace,
|
|
110
|
+
baseBranchSpace: baseSpace,
|
|
111
|
+
incomingBranchSpace: incomingSpace,
|
|
112
|
+
workspaceSpace,
|
|
113
|
+
indexIbGib,
|
|
114
|
+
incomingBranchName: trimmedIncomingBranch,
|
|
115
|
+
repoRoot,
|
|
116
|
+
targetDir: absTargetDir,
|
|
117
|
+
vcsFolderName,
|
|
118
|
+
});
|
|
328
119
|
|
|
329
|
-
|
|
330
|
-
await writeB2tFSItemToFS({
|
|
331
|
-
item: childItem,
|
|
332
|
-
destPath: worktreePath,
|
|
333
|
-
space: baseSpace,
|
|
334
|
-
metaspace,
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
120
|
+
await writeVcsIndexProjectionToDisk({ vcsPath, indexIbGib: mergeRes.updatedIndex });
|
|
341
121
|
|
|
342
122
|
if (!quiet) {
|
|
343
123
|
console.log(`Successfully merged branch '${trimmedIncomingBranch}' into '${baseBranchName}' (I: 1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a)`);
|
|
@@ -345,11 +125,11 @@ export async function executeMergeCmd({
|
|
|
345
125
|
}
|
|
346
126
|
|
|
347
127
|
return {
|
|
348
|
-
baseBranch:
|
|
349
|
-
incomingBranch:
|
|
128
|
+
baseBranch: mergeRes.baseBranch,
|
|
129
|
+
incomingBranch: mergeRes.incomingBranch,
|
|
350
130
|
baseSpaceId: baseSpaceRes.spaceId,
|
|
351
131
|
incomingSpaceId: incomingSpaceRes.spaceId,
|
|
352
|
-
mergedBranchAddr,
|
|
132
|
+
mergedBranchAddr: mergeRes.mergeCommitAddr,
|
|
353
133
|
worktreePath,
|
|
354
134
|
};
|
|
355
135
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module reset-cmd
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* CLI command handler for `vcs reset [path...]`.
|
|
5
5
|
* Unstages specified files (or all files) from active branch index in localSpace.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -10,11 +10,12 @@ import fs from 'node:fs/promises';
|
|
|
10
10
|
|
|
11
11
|
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
12
|
import { promptForConfirm } from '@ibgib/helper-gib/dist/helpers/node-helper.mjs';
|
|
13
|
-
import {
|
|
13
|
+
import { executeVcsReset } from '@ibgib/core-gib/dist/vcs/commands/reset-cmd.mjs';
|
|
14
|
+
import { resolveContextualBranchName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
|
|
14
15
|
|
|
15
16
|
import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
|
|
16
|
-
import { getOrCreateBranchSpace } from '
|
|
17
|
-
import {
|
|
17
|
+
import { getOrCreateBranchSpace } from '@ibgib/node-gib/dist/vcs/branch-space-helper.mjs';
|
|
18
|
+
import { readVcsIndexProjectionFromDisk, writeVcsIndexProjectionToDisk } from '../vcs-projection-helper.mjs';
|
|
18
19
|
import { GLOBAL_LOG_A_LOT } from '../../vcs-gib-constants.mjs';
|
|
19
20
|
|
|
20
21
|
const lcFile = `[reset-cmd]`;
|
|
@@ -65,12 +66,12 @@ export async function executeResetCmd({
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
// Retrieve authoritative B2tFSIndexIbGib_V1 from space
|
|
68
|
-
const indexIbGib = await
|
|
69
|
+
const indexIbGib = await readVcsIndexProjectionFromDisk({ vcsPath, space: localSpace });
|
|
69
70
|
if (!indexIbGib) {
|
|
70
71
|
throw new Error(`Repository not initialized. Run 'vcs init' first. (E: 3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b)`);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
const activeBranch = indexIbGib
|
|
74
|
+
const activeBranch = resolveContextualBranchName({ targetDir: absTargetDir, repoRoot, indexIbGib });
|
|
74
75
|
const activeWorktreeDir = activeBranch === 'main' ? repoRoot : path.join(repoRoot, 'b', activeBranch);
|
|
75
76
|
|
|
76
77
|
const { space: activeSpace } = await getOrCreateBranchSpace({
|
|
@@ -91,31 +92,28 @@ export async function executeResetCmd({
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
const
|
|
95
|
+
const resetRes = await executeVcsReset({
|
|
96
|
+
metaspace,
|
|
97
|
+
localSpace,
|
|
98
|
+
activeBranchSpace: activeSpace,
|
|
95
99
|
indexIbGib,
|
|
96
100
|
paths,
|
|
97
|
-
targetDir,
|
|
98
|
-
activeWorktreeDir,
|
|
99
|
-
vcsPath,
|
|
100
|
-
space: activeSpace,
|
|
101
|
-
metaspace,
|
|
102
101
|
all,
|
|
102
|
+
targetDir: absTargetDir,
|
|
103
|
+
activeWorktreeDir,
|
|
103
104
|
});
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
await putInSpace({ space: localSpace, ibGib: unstageRes.updatedIndex });
|
|
107
|
-
}
|
|
106
|
+
await writeVcsIndexProjectionToDisk({ vcsPath, indexIbGib: resetRes.updatedIndex });
|
|
108
107
|
|
|
109
108
|
if (!quiet) {
|
|
110
|
-
for (const unstagedPath of
|
|
109
|
+
for (const unstagedPath of resetRes.unstagedPaths) {
|
|
111
110
|
console.log(`unstaged: ${unstagedPath}`);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
const finalStagedCount = Object.keys(unstageRes.updatedIndex.data?.stagedPaths || {}).length;
|
|
116
114
|
return {
|
|
117
|
-
unstagedPaths:
|
|
118
|
-
stagedCount:
|
|
115
|
+
unstagedPaths: resetRes.unstagedPaths,
|
|
116
|
+
stagedCount: resetRes.stagedCount,
|
|
119
117
|
};
|
|
120
118
|
} catch (error) {
|
|
121
119
|
console.error(`${lc} ${extractErrorMsg(error)} (E: 4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b)`);
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module restore-cmd
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* CLI command handler for `vcs restore [path...]`.
|
|
5
|
+
* Delegates to executeVcsRestore and formats terminal output.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import fs from 'node:fs/promises';
|
|
10
10
|
|
|
11
11
|
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { executeVcsRestore } from '@ibgib/core-gib/dist/vcs/commands/restore-cmd.mjs';
|
|
13
|
+
import { resolveContextualBranchName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
|
|
14
14
|
|
|
15
15
|
import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
|
|
16
|
-
import { getOrCreateBranchSpace } from '
|
|
17
|
-
import {
|
|
16
|
+
import { getOrCreateBranchSpace } from '@ibgib/node-gib/dist/vcs/branch-space-helper.mjs';
|
|
17
|
+
import { getOrCreateWorkspaceProjectionSpace } from '@ibgib/node-gib/dist/vcs/workspace-space-helper.mjs';
|
|
18
|
+
import { readVcsIndexProjectionFromDisk, writeVcsIndexProjectionToDisk } from '../vcs-projection-helper.mjs';
|
|
18
19
|
import { GLOBAL_LOG_A_LOT } from '../../vcs-gib-constants.mjs';
|
|
19
20
|
|
|
20
21
|
const lcFile = `[restore-cmd]`;
|
|
@@ -22,34 +23,36 @@ const logalot = GLOBAL_LOG_A_LOT;
|
|
|
22
23
|
|
|
23
24
|
export interface RestoreCmdOpts {
|
|
24
25
|
paths?: string[];
|
|
25
|
-
targetDir?: string;
|
|
26
|
-
vcsFolderName?: string;
|
|
27
26
|
staged?: boolean;
|
|
28
27
|
worktree?: boolean;
|
|
28
|
+
all?: boolean;
|
|
29
29
|
yes?: boolean;
|
|
30
30
|
force?: boolean;
|
|
31
|
+
targetDir?: string;
|
|
32
|
+
vcsFolderName?: string;
|
|
31
33
|
quiet?: boolean;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export interface RestoreCmdResult {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
restoredPaths: string[];
|
|
38
|
+
unstagedPaths: string[];
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export async function executeRestoreCmd({
|
|
40
42
|
paths = [],
|
|
41
|
-
targetDir = process.cwd(),
|
|
42
|
-
vcsFolderName = '.vcsgib',
|
|
43
43
|
staged = false,
|
|
44
44
|
worktree = false,
|
|
45
|
+
all = false,
|
|
45
46
|
yes = false,
|
|
46
47
|
force = false,
|
|
48
|
+
targetDir = process.cwd(),
|
|
49
|
+
vcsFolderName = '.vcsgib',
|
|
47
50
|
quiet = false,
|
|
48
51
|
}: RestoreCmdOpts = {}): Promise<RestoreCmdResult> {
|
|
49
52
|
const lc = `${lcFile}[${executeRestoreCmd.name}]`;
|
|
50
53
|
try {
|
|
51
54
|
if (logalot) {
|
|
52
|
-
console.log(`${lc} starting... (I:
|
|
55
|
+
console.log(`${lc} starting... (I: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d)`);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
const absTargetDir = path.resolve(targetDir);
|
|
@@ -63,93 +66,70 @@ export async function executeRestoreCmd({
|
|
|
63
66
|
try {
|
|
64
67
|
await fs.access(vcsPath);
|
|
65
68
|
} catch {
|
|
66
|
-
throw new Error(`Not an ibgib repository (directory ${vcsPath} does not exist) (E:
|
|
69
|
+
throw new Error(`Not an ibgib repository (directory ${vcsPath} does not exist) (E: 2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d)`);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
// Retrieve authoritative B2tFSIndexIbGib_V1 from space
|
|
70
|
-
const indexIbGib = await
|
|
73
|
+
const indexIbGib = await readVcsIndexProjectionFromDisk({ vcsPath, space: localSpace });
|
|
71
74
|
if (!indexIbGib) {
|
|
72
|
-
throw new Error(`Repository not initialized. Run 'vcs init' first. (E:
|
|
75
|
+
throw new Error(`Repository not initialized. Run 'vcs init' first. (E: 3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d)`);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
const activeBranch = indexIbGib
|
|
78
|
+
const activeBranch = resolveContextualBranchName({ targetDir: absTargetDir, repoRoot, indexIbGib });
|
|
76
79
|
const activeWorktreeDir = activeBranch === 'main' ? repoRoot : path.join(repoRoot, 'b', activeBranch);
|
|
77
80
|
|
|
78
|
-
const { space:
|
|
81
|
+
const { space: activeBranchSpace } = await getOrCreateBranchSpace({
|
|
79
82
|
metaspace,
|
|
80
83
|
vcsPath,
|
|
81
84
|
branchName: activeBranch,
|
|
82
85
|
});
|
|
83
86
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!confirmed) {
|
|
91
|
-
if (!quiet) {
|
|
92
|
-
console.log('Operation cancelled.');
|
|
93
|
-
}
|
|
94
|
-
return { unstagedPaths: [], restoredPaths: [] };
|
|
95
|
-
}
|
|
96
|
-
}
|
|
87
|
+
const { space: workspaceSpace } = await getOrCreateWorkspaceProjectionSpace({
|
|
88
|
+
metaspace,
|
|
89
|
+
workspaceRoot: activeWorktreeDir,
|
|
90
|
+
vcsFolderName,
|
|
91
|
+
backingSpace: activeBranchSpace,
|
|
92
|
+
});
|
|
97
93
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
if (localSpace !== activeSpace) {
|
|
113
|
-
await putInSpace({ space: localSpace, ibGib: unstageRes.updatedIndex });
|
|
114
|
-
}
|
|
94
|
+
const restoreRes = await executeVcsRestore({
|
|
95
|
+
metaspace,
|
|
96
|
+
localSpace,
|
|
97
|
+
activeBranchSpace,
|
|
98
|
+
workspaceSpace,
|
|
99
|
+
indexIbGib,
|
|
100
|
+
paths,
|
|
101
|
+
staged,
|
|
102
|
+
all,
|
|
103
|
+
targetDir: absTargetDir,
|
|
104
|
+
activeWorktreeDir,
|
|
105
|
+
});
|
|
115
106
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
for (const p of unstagedPaths) {
|
|
119
|
-
console.log(`unstaged: ${p}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
107
|
+
if (staged && restoreRes.updatedIndex) {
|
|
108
|
+
await writeVcsIndexProjectionToDisk({ vcsPath, indexIbGib: restoreRes.updatedIndex });
|
|
122
109
|
}
|
|
123
110
|
|
|
124
|
-
if (!
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
vcsPath,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
restoredPaths = restoreRes.restoredPaths;
|
|
136
|
-
if (!quiet) {
|
|
137
|
-
for (const p of restoredPaths) {
|
|
138
|
-
console.log(`restored: ${p}`);
|
|
111
|
+
if (!quiet) {
|
|
112
|
+
if (staged) {
|
|
113
|
+
for (const unstagedPath of restoreRes.unstagedPaths) {
|
|
114
|
+
console.log(`unstaged: ${unstagedPath}`);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
for (const restoredPath of restoreRes.restoredPaths) {
|
|
118
|
+
console.log(`restored: ${restoredPath}`);
|
|
139
119
|
}
|
|
140
120
|
}
|
|
141
121
|
}
|
|
142
122
|
|
|
143
123
|
return {
|
|
144
|
-
|
|
145
|
-
|
|
124
|
+
restoredPaths: restoreRes.restoredPaths,
|
|
125
|
+
unstagedPaths: restoreRes.unstagedPaths,
|
|
146
126
|
};
|
|
147
127
|
} catch (error) {
|
|
148
128
|
console.error(`${lc} ${extractErrorMsg(error)} (E: 9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4e)`);
|
|
149
129
|
throw error;
|
|
150
130
|
} finally {
|
|
151
131
|
if (logalot) {
|
|
152
|
-
console.log(`${lc} complete. (I:
|
|
132
|
+
console.log(`${lc} complete. (I: 0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5f)`);
|
|
153
133
|
}
|
|
154
134
|
}
|
|
155
135
|
}
|
|
@@ -8,7 +8,7 @@ import path from 'node:path';
|
|
|
8
8
|
import fs from 'node:fs/promises';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
respecfully, ifWe, iReckon
|
|
11
|
+
respecfully, ifWe, ifWeMight, iReckon
|
|
12
12
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
13
13
|
|
|
14
14
|
import { executeInitCmd } from './init-cmd.mjs';
|
|
@@ -16,7 +16,7 @@ import { executeStatusCmd } from './status-cmd.mjs';
|
|
|
16
16
|
import { executeAddCmd } from './add-cmd.mjs';
|
|
17
17
|
import { executeCommitCmd } from './commit-cmd.mjs';
|
|
18
18
|
import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
|
|
19
|
-
import {
|
|
19
|
+
import { readVcsIndexProjectionFromDisk } from '../vcs-projection-helper.mjs';
|
|
20
20
|
|
|
21
21
|
const lc = `[apps/vcs-gib/src/cli/commands/status-add-cmd.respec.node.mts]`;
|
|
22
22
|
|
|
@@ -142,7 +142,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
142
142
|
repoPath: testDir,
|
|
143
143
|
vcsFolderName,
|
|
144
144
|
});
|
|
145
|
-
const indexIbGib = await
|
|
145
|
+
const indexIbGib = await readVcsIndexProjectionFromDisk({ space: localSpace, vcsPath });
|
|
146
146
|
iReckon(lc, Boolean(indexIbGib?.data?.staged_item && indexIbGib.data.staged_item.length > 0)).isGonnaBeTrue();
|
|
147
147
|
iReckon(lc, indexIbGib?.rel8ns?.staged_item).isGonnaBeFalsy();
|
|
148
148
|
|