Skip to content

Commit 5479027

Browse files
marcelsafinCopilot
andcommitted
fix(extensions/git): pass script path to core.get_repo_root for cwd-outside-repo callers
Without script_file, core.get_repo_root() falls back to Path.cwd() when SPECIFY_INIT_DIR is unset and no .specify root is found upward — the bash twin instead falls back to the script's install location (.specify/scripts/...). Pass script_file so both twins resolve the same repo_root; TypeError fallback keeps older cores working. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5241529 commit 5479027

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

extensions/git/scripts/python/create_new_feature_branch.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,13 @@ def main(argv: list[str]) -> int:
435435
return 1
436436

437437
if core is not None and hasattr(core, "get_repo_root"):
438-
repo_root = core.get_repo_root()
438+
# Pass script path so cwd-outside-repo callers land on the same
439+
# fallback the bash twin does. Older cores don't accept the kwarg —
440+
# fall back to the no-arg call for compatibility.
441+
try:
442+
repo_root = core.get_repo_root(script_file=Path(__file__))
443+
except TypeError:
444+
repo_root = core.get_repo_root()
439445
else:
440446
toplevel = _git_lines(Path.cwd(), "rev-parse", "--show-toplevel")
441447
if toplevel:

0 commit comments

Comments
 (0)