@ibgib/vcs-gib 0.0.33 → 0.0.34
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/README.md +14 -7
- package/dist/AUTO-GENERATED-version.d.mts +1 -1
- package/dist/AUTO-GENERATED-version.mjs +1 -1
- package/dist/cli/vcs-repo-helper.d.mts.map +1 -1
- package/dist/cli/vcs-repo-helper.mjs +10 -0
- package/dist/cli/vcs-repo-helper.mjs.map +1 -1
- package/package.json +6 -6
- package/src/AUTO-GENERATED-version.mts +1 -1
- package/src/cli/cli-e2e.respec.mts +7 -6
- package/src/cli/commands/branch-checkout-cmd.respec.mts +403 -403
- package/src/cli/commands/commit-log-cmd.respec.mts +5 -8
- package/src/cli/commands/status-add-cmd.respec.mts +7 -7
- package/src/cli/vcs-repo-helper.mts +15 -1
- package/tsconfig.test.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vcs-gib_test_output.md +43 -24
|
@@ -30,7 +30,6 @@ import { executeCheckoutCmd } from './cli-checkout-cmd.mjs';
|
|
|
30
30
|
import { executeMergeCmd } from './cli-merge-cmd.mjs';
|
|
31
31
|
import { executeGenerateCommentCmd } from './cli-generate-comment-cmd.mjs';
|
|
32
32
|
import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
|
|
33
|
-
import { readVcsIndexProjectionFromDisk } from '../vcs-projection-helper.mjs';
|
|
34
33
|
|
|
35
34
|
const lc = `[apps/vcs-gib/src/cli/commands/commit-log-cmd.respec.mts]`;
|
|
36
35
|
|
|
@@ -120,11 +119,11 @@ await respecfully(lc, `vcs commit and vcs log Command Handlers`, async () => {
|
|
|
120
119
|
quiet: true,
|
|
121
120
|
});
|
|
122
121
|
|
|
123
|
-
const {
|
|
122
|
+
const { metaspace: metaspaceAdd, localSpace: spaceAdd } = await bootstrapVcsMetaspace({
|
|
124
123
|
repoPath: testDir,
|
|
125
124
|
vcsFolderName,
|
|
126
125
|
});
|
|
127
|
-
const indexAdd = await
|
|
126
|
+
const indexAdd = await getB2tFSIndexIbGib({ space: spaceAdd, metaspace: metaspaceAdd });
|
|
128
127
|
iReckon(lc, Boolean(indexAdd?.data?.staged_item && indexAdd.data.staged_item.length > 0)).isGonnaBeTrue();
|
|
129
128
|
iReckon(lc, indexAdd?.rel8ns?.staged_item).isGonnaBeFalsy();
|
|
130
129
|
|
|
@@ -135,11 +134,11 @@ await respecfully(lc, `vcs commit and vcs log Command Handlers`, async () => {
|
|
|
135
134
|
quiet: true,
|
|
136
135
|
});
|
|
137
136
|
|
|
138
|
-
const {
|
|
137
|
+
const { metaspace: metaspaceCommit, localSpace: spaceCommit } = await bootstrapVcsMetaspace({
|
|
139
138
|
repoPath: testDir,
|
|
140
139
|
vcsFolderName,
|
|
141
140
|
});
|
|
142
|
-
const indexCommit = await
|
|
141
|
+
const indexCommit = await getB2tFSIndexIbGib({ space: spaceCommit, metaspace: metaspaceCommit });
|
|
143
142
|
iReckon(lc, indexCommit?.data?.staged_item).willEqual([]);
|
|
144
143
|
iReckon(lc, indexCommit?.rel8ns?.staged_item).isGonnaBeFalsy();
|
|
145
144
|
|
|
@@ -455,7 +454,6 @@ await respecfully(lc, `vcs commit and vcs log Command Handlers`, async () => {
|
|
|
455
454
|
|
|
456
455
|
const allMessages = mergedFileLog.commits.map(c => c.message).join(' -- ');
|
|
457
456
|
console.log(`allMessages: ${pretty(allMessages)}`);
|
|
458
|
-
iReckon(lc, allMessages).includes(`\n\n${pretty(allMessages)}\n\n`);
|
|
459
457
|
iReckon(lc, allMessages).includes('updated b to 200');
|
|
460
458
|
iReckon(lc, allMessages).includes('updated a to 100');
|
|
461
459
|
|
|
@@ -468,8 +466,7 @@ await respecfully(lc, `vcs commit and vcs log Command Handlers`, async () => {
|
|
|
468
466
|
metaspace,
|
|
469
467
|
branchName: 'main',
|
|
470
468
|
});
|
|
471
|
-
const indexIbGib =
|
|
472
|
-
|| (await readVcsIndexProjectionFromDisk({ space: localSpace, vcsPath }));
|
|
469
|
+
const indexIbGib = await getB2tFSIndexIbGib({ space: localSpace, metaspace });
|
|
473
470
|
if (!indexIbGib) { throw new Error(`(UNEXPECTED) indexIbGib falsy? (E: d4ec1b6f86cbf18808fba957b7b83826)`); }
|
|
474
471
|
const branchAddrs_spacequalified = indexIbGib.data['$@branch'] ?? [];
|
|
475
472
|
if (branchAddrs_spacequalified.length === 0) {
|
|
@@ -24,7 +24,7 @@ const lc = `[apps/vcs-gib/src/cli/commands/status-add-cmd.respec.mts]`;
|
|
|
24
24
|
|
|
25
25
|
await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
26
26
|
|
|
27
|
-
await
|
|
27
|
+
await ifWe(lc, `detects untracked files in fresh repository`, async () => {
|
|
28
28
|
const testDir = path.join(process.cwd(), '.test_status_add_1');
|
|
29
29
|
const vcsFolderName = '.vcsgib_test_1';
|
|
30
30
|
try {
|
|
@@ -50,7 +50,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
await
|
|
53
|
+
await ifWe(lc, `discovers .vcsgib via upward discovery when executed from a subfolder`, async () => {
|
|
54
54
|
const testDir = path.join(process.cwd(), '.test_status_add_subfolder');
|
|
55
55
|
const vcsFolderName = '.vcsgib_test_subfolder';
|
|
56
56
|
try {
|
|
@@ -77,7 +77,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
await
|
|
80
|
+
await ifWe(lc, `skips re-staging unmodified committed files during executeAddCmd with all flag`, async () => {
|
|
81
81
|
const testDir = path.join(process.cwd(), '.test_status_add_unmodified');
|
|
82
82
|
const vcsFolderName = '.vcsgib_test_unmodified';
|
|
83
83
|
try {
|
|
@@ -118,7 +118,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
await
|
|
121
|
+
await ifWe(lc, `stages untracked file via executeAddCmd`, async () => {
|
|
122
122
|
const testDir = path.join(process.cwd(), '.test_status_add_2');
|
|
123
123
|
const vcsFolderName = '.vcsgib_test_2';
|
|
124
124
|
try {
|
|
@@ -162,7 +162,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
await
|
|
165
|
+
await ifWe(lc, `respects .ibgibignore patterns during status and add`, async () => {
|
|
166
166
|
const testDir = path.join(process.cwd(), '.test_status_add_3');
|
|
167
167
|
const vcsFolderName = '.vcsgib_test_3';
|
|
168
168
|
try {
|
|
@@ -203,7 +203,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
await
|
|
206
|
+
await ifWe(lc, `stages files matching glob pattern with executeAddCmd`, async () => {
|
|
207
207
|
const testDir = path.join(process.cwd(), '.test_status_add_glob');
|
|
208
208
|
const vcsFolderName = '.vcsgib_test_glob';
|
|
209
209
|
try {
|
|
@@ -246,7 +246,7 @@ await respecfully(lc, `vcs status and vcs add Command Handlers`, async () => {
|
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
-
await
|
|
249
|
+
await ifWe(lc, `stages relative file paths correctly when targetDir is a subdirectory`, async () => {
|
|
250
250
|
const testDir = path.join(process.cwd(), '.test_status_add_subdir');
|
|
251
251
|
const vcsFolderName = '.vcsgib_test_subdir';
|
|
252
252
|
try {
|
|
@@ -8,7 +8,7 @@ import path from 'node:path';
|
|
|
8
8
|
import fs from 'node:fs/promises';
|
|
9
9
|
|
|
10
10
|
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
11
|
-
import { VcsRepository } from '@ibgib/core-gib/dist/vcs/vcs-repository.mjs';
|
|
11
|
+
import { VcsRepository, WorkspaceProjectionSpaceFactory } from '@ibgib/core-gib/dist/vcs/vcs-repository.mjs';
|
|
12
12
|
import { resolveContextualBranchName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
|
|
13
13
|
import { getB2tFSIndexIbGib } from '@ibgib/core-gib/dist/vcs/index/index-helper.mjs';
|
|
14
14
|
import { getOrCreateBranchSpace } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
|
|
@@ -80,11 +80,25 @@ export async function openVcsRepository({
|
|
|
80
80
|
backingSpace: activeSpace,
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
const fnGetWorkspaceProjectionSpace: WorkspaceProjectionSpaceFactory = async ({
|
|
84
|
+
worktreeDir,
|
|
85
|
+
backingSpace,
|
|
86
|
+
}) => {
|
|
87
|
+
const { space } = await getOrCreateWorkspaceProjectionSpace({
|
|
88
|
+
metaspace,
|
|
89
|
+
workspaceRoot: worktreeDir,
|
|
90
|
+
vcsFolderName,
|
|
91
|
+
backingSpace,
|
|
92
|
+
});
|
|
93
|
+
return space;
|
|
94
|
+
};
|
|
95
|
+
|
|
83
96
|
// 5. Construct domain facade
|
|
84
97
|
const repo = new VcsRepository({
|
|
85
98
|
metaspace,
|
|
86
99
|
localSpace,
|
|
87
100
|
workspaceSpace,
|
|
101
|
+
fnGetWorkspaceProjectionSpace,
|
|
88
102
|
repoRoot,
|
|
89
103
|
vcsFolderName,
|
|
90
104
|
});
|