-
-
Notifications
You must be signed in to change notification settings - Fork 954
-
Hoping to move all files from the foo
folder to the current folder (.
)
The raw git command looks like this: git mv foo/* .
Using GitPython, those are the two alternatives I could attempt:
repo.index.move(['foo/*', '.']) # -> cmdline: git mv --dry-run foo/* . repo.git.mv('foo/*', '.') # -> cmdline: git mv foo/* .
They both return the same error:
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
stderr: 'fatal: bad source, source=foo/*, destination=*'
What is surprising to me is:
- error says "bad source" but the generated
cmdline
looks good and actually works when running them in the terminal destination
input is.
butstderr
shows*
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
repo.git.mv(...)
should work the same as on the command-line. The latter will resolve the *
portion as it runs in the shell, but in theory at least, *
also is a glob picked up by git which should resolve it internally. You could try to run git mv 'foo/*' .
(note 'single quotes') in the terminal to see if it yields the same result as what you see in GitPython.
If so, this means that git
does not resolve the glob for some reason even though I would expect it to do that.
Beta Was this translation helpful? Give feedback.