santree 0.2.2 → 0.2.3
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 +11 -1
- package/package.json +1 -1
package/dist/lib/git.js
CHANGED
|
@@ -263,8 +263,18 @@ export function extractTicketId(branch) {
|
|
|
263
263
|
*/
|
|
264
264
|
export function getWorktreePath(branchName) {
|
|
265
265
|
const worktrees = listWorktrees();
|
|
266
|
+
// Try exact match first
|
|
266
267
|
const wt = worktrees.find((w) => w.branch === branchName);
|
|
267
|
-
|
|
268
|
+
if (wt)
|
|
269
|
+
return wt.path;
|
|
270
|
+
// Fall back to matching by ticket ID
|
|
271
|
+
const inputTicketId = extractTicketId(branchName);
|
|
272
|
+
if (inputTicketId) {
|
|
273
|
+
const byTicket = worktrees.find((w) => w.branch && extractTicketId(w.branch) === inputTicketId);
|
|
274
|
+
if (byTicket)
|
|
275
|
+
return byTicket.path;
|
|
276
|
+
}
|
|
277
|
+
return null;
|
|
268
278
|
}
|
|
269
279
|
/**
|
|
270
280
|
* Get path to centralized metadata file: .santree/metadata.json in the repo root.
|