Skip to content

includeDirs does not support paths with slashes (e.g., tmp/prompts, vendor/bundle) #99

@inouetakuya

Description

@inouetakuya

Description

includeDirs configuration does not support directory paths containing slashes. Only the last component (basename) is matched because gtr uses find -name internally.

Environment

  • OS: macOS (Darwin 25.2.0)
  • Git version: 2.52.0
  • gtr version: 2.1.0
  • Shell: zsh

Steps to Reproduce

  1. Create .gtrconfig:

    [copy]
    includeDirs = node_modules
    includeDirs = vendor/bundle
    includeDirs = tmp/prompts
  2. Create directories:

    mkdir -p vendor/bundle tmp/prompts
  3. Run git gtr new test-branch

Expected Behavior

All three directories should be copied:

  • node_modules
  • vendor/bundle
  • tmp/prompts

Actual Behavior

Only node_modules is copied. vendor/bundle and tmp/prompts are not copied.

==> Copying directories...
[OK] Copied directory node_modules
[OK] Copied 1 directories

Root Cause Analysis

gtr uses find -name to locate directories, which only matches the basename (last path component), not full paths:

$ find . -name "node_modules"    # ✅ Finds ./node_modules
$ find . -name "vendor/bundle"   # ❌ No results (path not supported)
$ find . -name "tmp/prompts"     # ❌ No results (path not supported)

Proposed Solutions

  1. Support -path option: Use find -path "*/$pattern" when the pattern contains a slash
  2. Direct path check: If the pattern contains /, check if the path exists directly instead of using find
  3. Documentation: At minimum, document that only basenames are supported

Workaround

Currently, users must specify only the basename:

includeDirs = bundle    # instead of vendor/bundle
includeDirs = prompts   # instead of tmp/prompts

However, this may cause unintended matches if multiple directories share the same basename.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions