File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,7 +175,21 @@ clean_branch_name() {
175175# to searching for repository markers so the workflow still functions in repositories that
176176# were initialised with --no-git.
177177SCRIPT_DIR=" $( CDPATH=" " cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
178- source " $SCRIPT_DIR /common.sh"
178+
179+ # Source common.sh: try the core scripts directory first (standard layout),
180+ # then fall back to the extension's sibling copy.
181+ if [ -f " $SCRIPT_DIR /common.sh" ]; then
182+ source " $SCRIPT_DIR /common.sh"
183+ else
184+ # When running from an extension install (.specify/extensions/git/scripts/bash/),
185+ # resolve common.sh from the project's core scripts directory.
186+ _ext_repo_root=" $( cd " $SCRIPT_DIR /../../../../.." 2> /dev/null && pwd) "
187+ if [ -f " $_ext_repo_root /scripts/bash/common.sh" ]; then
188+ source " $_ext_repo_root /scripts/bash/common.sh"
189+ elif [ -f " $SCRIPT_DIR /git-common.sh" ]; then
190+ source " $SCRIPT_DIR /git-common.sh"
191+ fi
192+ fi
179193
180194if git rev-parse --show-toplevel > /dev/null 2>&1 ; then
181195 REPO_ROOT=$( git rev-parse --show-toplevel)
Original file line number Diff line number Diff line change @@ -145,8 +145,22 @@ if (-not $fallbackRoot) {
145145 exit 1
146146}
147147
148- # Load common functions (includes Resolve-Template)
149- . " $PSScriptRoot /common.ps1"
148+ # Load common functions (includes Resolve-Template).
149+ # Try the core scripts directory first (standard layout), then fall back
150+ # to the extension's sibling copy.
151+ if (Test-Path " $PSScriptRoot /common.ps1" ) {
152+ . " $PSScriptRoot /common.ps1"
153+ } else {
154+ # When running from an extension install (.specify/extensions/git/scripts/powershell/),
155+ # resolve common.ps1 from the project's core scripts directory.
156+ $extRepoRoot = (Resolve-Path (Join-Path $PSScriptRoot " ../../../../.." ) - ErrorAction SilentlyContinue)
157+ $coreCommon = if ($extRepoRoot ) { Join-Path $extRepoRoot " scripts/powershell/common.ps1" } else { " " }
158+ if ($coreCommon -and (Test-Path $coreCommon )) {
159+ . $coreCommon
160+ } elseif (Test-Path " $PSScriptRoot /git-common.ps1" ) {
161+ . " $PSScriptRoot /git-common.ps1"
162+ }
163+ }
150164
151165try {
152166 $repoRoot = git rev- parse -- show-toplevel 2> $null
You can’t perform that action at this time.
0 commit comments