@fluado/enmetu 0.2.0 → 0.3.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/README.md +53 -5
- package/dist/adapters/git/gitFacade.d.ts +8 -0
- package/dist/adapters/git/gitFacade.js +34 -1
- package/dist/adapters/git/gitProcessAdapter.js +1 -48
- package/dist/adapters/host/hostMessageWriterAdapter.d.ts +23 -0
- package/dist/adapters/host/hostMessageWriterAdapter.js +76 -0
- package/dist/adapters/process/processGroup.d.ts +18 -0
- package/dist/adapters/process/processGroup.js +52 -0
- package/dist/adapters/process/shellMessageCommandAdapter.d.ts +24 -0
- package/dist/adapters/process/shellMessageCommandAdapter.js +102 -0
- package/dist/adapters/watch/watcherFor.d.ts +22 -0
- package/dist/adapters/watch/watcherFor.js +29 -0
- package/dist/cli/commands/hookCommand.d.ts +2 -1
- package/dist/cli/commands/hookCommand.js +14 -8
- package/dist/cli/commands/runCommand.d.ts +10 -3
- package/dist/cli/commands/runCommand.js +45 -9
- package/dist/cli.js +2 -0
- package/dist/commit/commitLocalChangesController.d.ts +22 -1
- package/dist/commit/commitLocalChangesController.js +113 -4
- package/dist/contracts/ICommitMessageCommand.d.ts +32 -0
- package/dist/contracts/ICommitMessageCommand.js +1 -0
- package/dist/contracts/IGitConfigReader.d.ts +4 -1
- package/dist/contracts/IGitReader.d.ts +5 -0
- package/dist/contracts/IHostMessageWriter.d.ts +28 -0
- package/dist/contracts/IHostMessageWriter.js +1 -0
- package/dist/contracts/config.d.ts +34 -1
- package/dist/contracts/errors.d.ts +5 -1
- package/dist/contracts/errors.js +5 -1
- package/dist/contracts/library.d.ts +30 -0
- package/dist/contracts/logCodes.d.ts +1 -1
- package/dist/contracts/runtime.d.ts +4 -0
- package/dist/core/commit/commitMessage.d.ts +27 -0
- package/dist/core/commit/commitMessage.js +61 -0
- package/dist/core/config/parseConfig.d.ts +7 -4
- package/dist/core/config/parseConfig.js +172 -26
- package/dist/core/git/porcelain.d.ts +7 -0
- package/dist/core/git/porcelain.js +24 -0
- package/dist/enmetuInstances.d.ts +7 -4
- package/dist/enmetuInstances.js +52 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/library/enmetuLibrary.d.ts +2 -1
- package/dist/library/enmetuLibrary.js +5 -2
- package/dist/quarantine/pathQuarantine.d.ts +10 -0
- package/dist/quarantine/pathQuarantine.js +44 -2
- package/package.json +1 -1
|
@@ -70,7 +70,13 @@ export class PathQuarantine {
|
|
|
70
70
|
// --- Step 5: a file written since step 3 is stored again (Decision 114) ---
|
|
71
71
|
await this.storeAgainIfWritten(entries, []);
|
|
72
72
|
// --- Step 6: the held paths now match the index, so the rebase may run ---
|
|
73
|
-
|
|
73
|
+
try {
|
|
74
|
+
await this.writer.restoreFromIndex(paths);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
await this.forgetUnheld(0);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
74
80
|
return { kind: 'held', count: entries.length };
|
|
75
81
|
}
|
|
76
82
|
async extend(paths) {
|
|
@@ -102,9 +108,45 @@ export class PathQuarantine {
|
|
|
102
108
|
// --- Step 6: a file written since step 4 is stored again (Decision 114) ---
|
|
103
109
|
await this.storeAgainIfWritten(entries, earlier);
|
|
104
110
|
// --- Step 7: the captured paths now match the index ---
|
|
105
|
-
|
|
111
|
+
try {
|
|
112
|
+
await this.writer.restoreFromIndex(paths);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
await this.forgetUnheld(earlier.length);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
106
118
|
return { kind: 'held', count: entries.length };
|
|
107
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* git refused the checkout (a person's merge left a held path unmerged,
|
|
122
|
+
* design 14.20): an entry whose file still holds the bytes stored for it was
|
|
123
|
+
* never set aside, and restoring it later would write those bytes over the
|
|
124
|
+
* person's newer work, conflict markers included. Such entries leave the
|
|
125
|
+
* memento (the memento goes when none is left); an entry whose file changed
|
|
126
|
+
* stays, so no write goes unrecorded. Entries before `from` (an earlier
|
|
127
|
+
* hold that extend added to) stay as they are.
|
|
128
|
+
*/
|
|
129
|
+
async forgetUnheld(from) {
|
|
130
|
+
const text = await this.fs.readText(this.mementoPath());
|
|
131
|
+
const memento = text === null ? null : parseQuarantineMemento(text);
|
|
132
|
+
if (memento === null) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const kept = memento.entries.slice(0, from);
|
|
136
|
+
for (const entry of memento.entries.slice(from)) {
|
|
137
|
+
const target = join(this.paths.root, entry.path);
|
|
138
|
+
const seen = await this.observe(entry.path, target);
|
|
139
|
+
if (seen !== (entry.blobId ?? OBSERVED_ABSENT)) {
|
|
140
|
+
kept.push(entry);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (kept.length === 0) {
|
|
144
|
+
await this.fs.remove(this.mementoPath());
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
await this.writeMemento({ version: 1, entries: kept });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
108
150
|
/**
|
|
109
151
|
* git's checkout writes the index's version over a file whatever the file
|
|
110
152
|
* holds, so a write that landed after storeEntries read it would be gone
|