Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fails *silently* if color.diff is set to "always" #172

Closed
@frozencemetery

Description

@frozencemetery

If one setscolor.diff in ~/.gitconfig to "always", then GitPython will silently fail to produce diffs. It looks like this:

    $pythonPython2.7.5 (default,Jun252014,10:19:55)    [GCC4.8.220131212 (RedHat4.8.2-7)]onlinux2Type"help","copyright","credits"or"license"formoreinformation.>>>importgit>>>oldcstr="2d018c40ff73373221bc6717bfea8ac29aff9bff">>>newcstr="aa901d68d53e686428d0c58e831f4b7c8b0de40e">>>repo=git.Repo(".")>>>oldc=repo.commit(oldcstr)>>>newc=repo.commit(newcstr)>>>oldc.diff(newc,create_patch=True)    []>>>oldc.diff(newc,create_patch=False)    [<git.diff.Diffobjectat0x7fad7fee5b18>]>>>oldc.diff(newc,create_patch=False)[0]<git.diff.Diffobjectat0xc9d050>>>>oldc.diff(newc,create_patch=False)[0].diff''>>>importos>>>os.popen("git diff %s %s"% (oldcstr,newcstr))<openfile'git diff 2d018c40ff73373221bc6717bfea8ac29aff9bff aa901d68d53e686428d0c58e831f4b7c8b0de40e',mode'r'at0xbfa930>>>>os.popen("git diff %s %s"% (oldcstr,newcstr)).read()'\x1b[1mdiff --git a/requirements.txt b/requirements.txt\x1b[m\n\x1b[1mindex 4e6c95b..7455a11 100644\x1b[m\n\x1b[1m--- a/requirements.txt\x1b[m\n\x1b[1m+++ b/requirements.txt\x1b[m\n\x1b[36m@@ -1,7 +1,7 @@\x1b[m\n pbr>=0.6,!=0.7,<1.0\x1b[m\n\x1b[m\n urwid\x1b[m\n\x1b[31m-sqlalchemy\x1b[m\n\x1b[32m+\x1b[m\x1b[32msqlalchemy>=0.9.4\x1b[m\n GitPython>=0.3.2.RC1\x1b[m\n python-dateutil\x1b[m\n requests\x1b[m\n'>>>

Settingcolor.diff to "true" instead fixes this. I think GitPython should at least warn in this case (itdid get garbage information back from a git command, which should_not_ be silent failure).git diff also contains an option to explicitly disable color (--no-color or--color=never); it would be even better if GitPython could pass these.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp