Skip to content

repo.git.submodule('foreach', 'git', 'clean', '-xfd') fails with Bad file descriptor error #688

Open
@grkkarthick90

Description

@grkkarthick90

OS: Windows 64 bit
gitpython: 2.0.8
git: 2.10.0

I'm trying to clean my submodules using the command repo.git.submodule('foreach', 'git', 'clean', '-xfd'). When executing this getting the below stack trace.

  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\git\cmd.py", line 466, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "C:\Python27\lib\site-packages\git\cmd.py", line 910, in _call_process
    return self.execute(make_call(), **_kwargs)
  File "C:\Python27\lib\site-packages\git\cmd.py", line 718, in execute
    raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git submodule foreach git clean -xfd' returned with ex
it code 1
stderr: 'C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 311:
0: Bad file descriptor'

Getting the same error for the below commands too,

repo.git.submodule('foreach', 'git', 'reset', '--hard')
 repo.git.submodule('foreach', 'git', 'stash')

But the below commands are getting succeeded in gitpython

repo.git.submodule('update', '--init', '--recursive')
repo.git.submodule('update', '--remote', '--recursive')

Whereas trying to execute git submodule foreach git clean -xfd in windows command prompt or git bash it succeeds without any error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions