-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
Summary
The cfg_default function doesn't read settings from .gtrconfig because it lacks the auto-mapping feature that cfg_get_all has. This affects gtr.worktrees.dir and gtr.defaultBranch settings.
Steps to Reproduce
- Create a
.gtrconfigfile:
[worktrees]
dir = /worktrees-
Run
git gtr new test -
Expected: Worktree created in
/worktrees/test -
Actual: Worktree created in default location (
<repo>-worktrees/test)
Root Cause
In lib/config.sh, cfg_get_all has auto-mapping (lines 115-117):
# Auto-map file_key if not provided and key is a gtr.* key
if [ -z "$file_key" ] && [[ "$key" == gtr.* ]]; then
file_key=$(cfg_map_to_file_key "$key")
fiBut cfg_default doesn't have this, so when called without file_key:
# lib/core.sh line 51
base_dir=$(cfg_default "gtr.worktrees.dir" "GTR_WORKTREES_DIR" "")The .gtrconfig is never checked.
Suggested Fix
Add auto-mapping to cfg_default:
cfg_default() {
local key="$1"
local env_name="$2"
local fallback="$3"
local file_key="${4:-}"
# Auto-map file_key if not provided and key is a gtr.* key
if [ -z "$file_key" ] && [[ "$key" == gtr.* ]]; then
file_key=$(cfg_map_to_file_key "$key")
fi
# ... rest of functionWorkaround
Use git config --local instead:
git config --local gtr.worktrees.dir /worktreesMetadata
Metadata
Assignees
Labels
No labels