Skip to content

Repo.git.branch parsing broken #92

Closed
@bilderbuchi

Description

@bilderbuchi

Something must be broken in some Repo.git.* command argument parsing. In some git repo, do

import git
repo = git.Repo()
repo.git.branch('somebranch') # works
repo.git.checkout(b='otherbranch') # works
repo.git.branch(D='somebranch') # to force delete a branch, fails:
---------------------------------------------------------------------------
GitCommandError                           Traceback (most recent call last)
<ipython-input-6-bfd51b2d0b04> in <module>()
----> 1 repo.git.branch(D='somebranch')

/usr/lib/python2.7/dist-packages/git/cmd.pyc in <lambda>(*args, **kwargs)
    225                 if name[0] == '_':
    226                         return LazyMixin.__getattr__(self, name)
--> 227                 return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
    228 
    229         def _set_cache_(self, attr):

/usr/lib/python2.7/dist-packages/git/cmd.pyc in _call_process(self, method, *args, **kwargs)
    454                 call.extend(args)
    455 
--> 456                 return self.execute(call, **_kwargs)
    457 
    458         def _parse_object_header(self, header_line):

/usr/lib/python2.7/dist-packages/git/cmd.pyc in execute(self, command, istream, with_keep_cwd, with_extended_output, with_exceptions, as_process, output_stream, **subprocess_kwargs)
    375 
    376                 if with_exceptions and status != 0:
--> 377                         raise GitCommandError(command, status, stderr_value)
    378 
    379                 # Allow access to the command's status code

GitCommandError: 'git branch -Dsomebranch' returned exit status 129: error: unknown switch `s'
usage: git branch etc. etc...

from the GitCommandError you can see that for some reason, there's a space missing in the created git command.

git.__version__
Out[10]: '0.3.2 RC1'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions