@mrpatronz/nexusflow 0.2.6 → 0.2.7
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/core/worktree.d.ts.map +1 -1
- package/dist/core/worktree.js +19 -11
- package/dist/core/worktree.js.map +1 -1
- package/package.json +1 -1
- package/src/core/worktree.ts +19 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/core/worktree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/core/worktree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAwEf;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/dist/core/worktree.js
CHANGED
|
@@ -25,22 +25,30 @@ export async function createWorktree(repoPath, targetPath, branchName, baseBranc
|
|
|
25
25
|
catch {
|
|
26
26
|
// Silently ignore fetch failures (e.g., offline or no remote origin)
|
|
27
27
|
}
|
|
28
|
-
// Update local
|
|
28
|
+
// Update local base branch, main, and master to keep them in sync with remote before branching
|
|
29
29
|
if (fetched) {
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
const { stdout: currentBranchRaw } = await execa('git', ['branch', '--show-current'], { cwd: repoPath });
|
|
32
|
+
const currentBranch = currentBranchRaw.trim();
|
|
33
|
+
const branchesToUpdate = Array.from(new Set([baseBranch, 'main', 'master']));
|
|
34
|
+
for (const branch of branchesToUpdate) {
|
|
35
|
+
try {
|
|
36
|
+
if (currentBranch === branch) {
|
|
37
|
+
// Safe fast-forward pull for the currently checked-out branch
|
|
38
|
+
await execa('git', ['pull', '--ff-only'], { cwd: repoPath });
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Fast-forward local ref from remote ref without checkout
|
|
42
|
+
await execa('git', ['fetch', 'origin', `${branch}:${branch}`], { cwd: repoPath });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// Ignore individual branch update failures
|
|
47
|
+
}
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
catch {
|
|
43
|
-
// Ignore failures
|
|
51
|
+
// Ignore failures
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
// Determine starting point: remote branch if fetched successfully and exists, else local branch.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/core/worktree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,UAAkB,EAClB,UAAkB,EAClB,UAAkB;IAElB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,6BAA6B;IAC7B,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;Q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AAC;QACN,iGAAiG;QACjG,MAAM,KAAK,CACT,KAAK,EACL,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,EAC3E,EAAE,GAAG,EAAE,QAAQ,EAAE,CAClB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,YAAoB,EACpB,KAAK,GAAG,KAAK;IAEb,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpC,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxB,MAAM,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC9C,CAAC"}
|
package/package.json
CHANGED
package/src/core/worktree.ts
CHANGED
|
@@ -32,20 +32,29 @@ export async function createWorktree(
|
|
|
32
32
|
// Silently ignore fetch failures (e.g., offline or no remote origin)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// Update local
|
|
35
|
+
// Update local base branch, main, and master to keep them in sync with remote before branching
|
|
36
36
|
if (fetched) {
|
|
37
37
|
try {
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const { stdout: currentBranchRaw } = await execa('git', ['branch', '--show-current'], { cwd: repoPath });
|
|
39
|
+
const currentBranch = currentBranchRaw.trim();
|
|
40
|
+
|
|
41
|
+
const branchesToUpdate = Array.from(new Set([baseBranch, 'main', 'master']));
|
|
42
|
+
|
|
43
|
+
for (const branch of branchesToUpdate) {
|
|
44
|
+
try {
|
|
45
|
+
if (currentBranch === branch) {
|
|
46
|
+
// Safe fast-forward pull for the currently checked-out branch
|
|
47
|
+
await execa('git', ['pull', '--ff-only'], { cwd: repoPath });
|
|
48
|
+
} else {
|
|
49
|
+
// Fast-forward local ref from remote ref without checkout
|
|
50
|
+
await execa('git', ['fetch', 'origin', `${branch}:${branch}`], { cwd: repoPath });
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
// Ignore individual branch update failures
|
|
54
|
+
}
|
|
46
55
|
}
|
|
47
56
|
} catch {
|
|
48
|
-
// Ignore failures
|
|
57
|
+
// Ignore failures
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
|