@proagentstore/cli 0.4.59 → 0.4.60
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.
|
@@ -159,10 +159,13 @@ export function switchRepoBranch(workDir, branch) {
|
|
|
159
159
|
* `switchRepoBranch` follows and for the same reason: the cloud's picture of the tree is a read
|
|
160
160
|
* taken moments earlier over a relay, and the write has to be safe against the tree as it IS.
|
|
161
161
|
*
|
|
162
|
-
* dirty refused
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
162
|
+
* dirty NOT refused (#804 — it was at 0.4.59). Unlike a checkout, a fast-forward carries
|
|
163
|
+
* nothing across: an uncommitted edit to a file the incoming commits do not touch is
|
|
164
|
+
* the same edit afterwards, and one they DO touch makes git abort before writing a
|
|
165
|
+
* byte ("Your local changes … would be overwritten"). Untracked files likewise —
|
|
166
|
+
* left alone, unless an incoming commit adds that path, which git refuses by name.
|
|
167
|
+
* The check is therefore git's own, against the real history, and arrives as
|
|
168
|
+
* `error`. Nothing here stashes, cleans or commits on the owner's behalf.
|
|
166
169
|
* off-branch refused when `branch` is given and HEAD is elsewhere. The declared branch is the
|
|
167
170
|
* one the cloud judged stale; pulling whatever the checkout happens to be on would
|
|
168
171
|
* be acting on a verdict about a different ref.
|
|
@@ -193,26 +196,26 @@ export function fastForwardRepo(workDir, opts = {}) {
|
|
|
193
196
|
if (abbrev === "HEAD")
|
|
194
197
|
return { ...base, refused: "detached" };
|
|
195
198
|
const branch = abbrev;
|
|
199
|
+
// Read, reported, never a refusal (see the doc above). A status git will not give is `null`,
|
|
200
|
+
// not `false` — "clean" is a claim, and this is the field the owner's sentence is built from.
|
|
196
201
|
let dirty;
|
|
197
202
|
try {
|
|
198
203
|
dirty = isDirty(workDir);
|
|
199
204
|
}
|
|
200
|
-
catch
|
|
201
|
-
|
|
205
|
+
catch {
|
|
206
|
+
dirty = null;
|
|
202
207
|
}
|
|
203
|
-
if (dirty)
|
|
204
|
-
return { ...base, branch, dirty: true, refused: "dirty" };
|
|
205
208
|
if (want !== null && branch !== want)
|
|
206
|
-
return { ...base, branch, refused: "off-branch" };
|
|
209
|
+
return { ...base, branch, dirty, refused: "off-branch" };
|
|
207
210
|
let upstream;
|
|
208
211
|
try {
|
|
209
212
|
upstream = git(workDir, ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"]).trim();
|
|
210
213
|
}
|
|
211
214
|
catch {
|
|
212
|
-
return { ...base, branch, refused: "no-upstream" };
|
|
215
|
+
return { ...base, branch, dirty, refused: "no-upstream" };
|
|
213
216
|
}
|
|
214
217
|
if (!upstream)
|
|
215
|
-
return { ...base, branch, refused: "no-upstream" };
|
|
218
|
+
return { ...base, branch, dirty, refused: "no-upstream" };
|
|
216
219
|
let from;
|
|
217
220
|
try {
|
|
218
221
|
from = git(workDir, ["rev-parse", "HEAD"]).trim() || null;
|
|
@@ -226,9 +229,11 @@ export function fastForwardRepo(workDir, opts = {}) {
|
|
|
226
229
|
git(workDir, gitWriteArgv("fast-forward"), { timeout: 30_000, env: networkGitEnv() });
|
|
227
230
|
}
|
|
228
231
|
catch (e) {
|
|
229
|
-
// `--ff-only` refused,
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
+
// `--ff-only` refused, an incoming commit would overwrite a local change or an untracked
|
|
233
|
+
// path, the network failed, or auth was needed and (correctly) not prompted for. In every
|
|
234
|
+
// case git left the tree as it was; the sentence says which, and names the file when there
|
|
235
|
+
// is one.
|
|
236
|
+
return { ...base, branch, upstream, from, to: from, dirty, error: gitFailureLine(e) };
|
|
232
237
|
}
|
|
233
238
|
// CONFIRM, do not assume — read HEAD back and count what arrived from git, not from the
|
|
234
239
|
// exit code.
|