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

Using GitPython inside a pre-commit hook breaks (GIT_AUTHOR_DATE breaks) #963

Open
@dries007

Description

@dries007

I suspect the culprit of the crash is the GIT_AUTHOR_DATE. If I remove this before starting my script it works. I already passexpand_vars=False, but that isn't passed far enough down to make a differance.

My current workaround is to nulke the enviroment variables when invoking my script by usingenv -i <script> from the commit hook.

My ideal solution would be a flag to disable the copy of the os environ ongit/cmd.py:699. This will not only eliminate this issue, but also any potential other interferance (think GIT_DIR and friends).

Replicate via:

export GIT_INDEX_FILE='.git/index'export GIT_AUTHOR_DATE='@1574863356 +0100'export GIT_EXEC_PATH='/usr/lib/git-core'export GIT_AUTHOR_EMAIL='admin@dries007.net'export GIT_PREFIX=''export GIT_AUTHOR_NAME='Dries'python3
importtempfileimportgitdefmain():withtempfile.TemporaryDirectory()asfolder:repo=git.Repo.init(folder,expand_vars=False)repo.index.commit("Init test repo with empty commit.")repo.head.reference=repo.create_head("master")if__name__=="__main__":main()

Thanks,
Dries

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