worktree-flow 0.0.11 → 0.0.12
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/lib/git.js +10 -2
- package/dist/lib/workspaceDirectory.js +8 -1
- package/package.json +1 -1
package/dist/lib/git.js
CHANGED
|
@@ -20,12 +20,20 @@ export class GitService {
|
|
|
20
20
|
return output.length > 0;
|
|
21
21
|
}
|
|
22
22
|
async localRemoteBranchExists(repoPath, branch) {
|
|
23
|
+
// Check for local branch first
|
|
23
24
|
try {
|
|
24
|
-
await this.exec(repoPath, ['rev-parse', '--verify',
|
|
25
|
+
await this.exec(repoPath, ['rev-parse', '--verify', branch]);
|
|
25
26
|
return true;
|
|
26
27
|
}
|
|
27
28
|
catch {
|
|
28
|
-
|
|
29
|
+
// Fall back to checking remote-tracking branch
|
|
30
|
+
try {
|
|
31
|
+
await this.exec(repoPath, ['rev-parse', '--verify', `origin/${branch}`]);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
async findFirstExistingBranch(repoPath, candidates) {
|
|
@@ -44,7 +44,14 @@ export class WorkspaceDirectoryService {
|
|
|
44
44
|
getWorktreeDirs(workspacePath) {
|
|
45
45
|
const entries = this.fs.readdirSync(workspacePath, { withFileTypes: true });
|
|
46
46
|
return entries
|
|
47
|
-
.filter((entry) =>
|
|
47
|
+
.filter((entry) => {
|
|
48
|
+
if (!entry.isDirectory()) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// Only include directories that have a .git file or directory (git repos/worktrees)
|
|
52
|
+
const gitPath = path.join(workspacePath, entry.name, '.git');
|
|
53
|
+
return this.fs.existsSync(gitPath);
|
|
54
|
+
})
|
|
48
55
|
.map((entry) => path.join(workspacePath, entry.name));
|
|
49
56
|
}
|
|
50
57
|
listWorkspaces(destPath) {
|