Skip to content

trying to run ls-tree (using raw) fails when using wildcards #1055

Open
@ATGardner

Description

@ATGardner

i am trying to run this code snipper:

...
const git = simpleGit(dir, config).env(COMMON_ENV_VARS)
const res = await git.raw('ls-tree', '-r', '--name-only', ref, '--', 'README.m?')

and the res is empty ('').
when i manually run the same command (git ls-tree -r --name-only main -- README.m?), i get the correct response (README.md)

i followed down the rabbit hole of using raw, and it seems like the issue is the usage of spawn. it tries to resolve the wildcards before the call, instead of sending them as-is into the process. adding a spawn option of shell: true resolves this. but currently, the package only allows sending in uid and gid.

i will create a pr that exposes the shell field of SpanOptions as well. i hope it gets merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions