Skip to content

Pre-commit hook compatibility #164

@IdanAdar

Description

@IdanAdar

My company now requires the use of a detect-secrets tool and a pre-commit step.
After following the instructions and attempting to push a commit, it failed with the following:

Commit failed - exit code 1 received, with output: '[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/iadar/.cache/pre-commit/patch1546236539.
[INFO] Initializing environment for git@github.****.com:****/****-detect-secrets.
[INFO] Restored changes from /Users/iadar/.cache/pre-commit/patch1546236539.
An unexpected error has occurred: CalledProcessError: Command: ('/Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
Return code: 1
Expected return code: 0
Output: (none)
Errors: 
    /Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core/git-sh-setup: line 46: //libexec/git-core/git-sh-i18n: No such file or directory
    

Check the log at /Users/iadar/.cache/pre-commit/pre-commit.log'

The log file shows:

An unexpected error has occurred: CalledProcessError: Command: ('/Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
Return code: 1
Expected return code: 0
Output: (none)
Errors:
    /Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core/git-sh-setup: line 46: //libexec/git-core/git-sh-i18n: No such file or directory


Traceback (most recent call last):
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/error_handler.py", line 47, in error_handler
    yield
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/main.py", line 261, in main
    return run(runner, store, args)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/commands/run.py", line 256, in run
    for _, hook in repo.hooks:
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/repository.py", line 162, in hooks
    if hook['id'] not in self.manifest_hooks:
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/repository.py", line 155, in manifest_hooks
    repo_path = self.store.clone(repo, rev)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/store.py", line 149, in clone
    return self._new_repo(repo, ref, deps, clone_strategy)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/store.py", line 125, in _new_repo
    make_strategy(directory)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/store.py", line 147, in clone_strategy
    _git_cmd('submodule', 'update', '--init', '--recursive')
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/store.py", line 144, in _git_cmd
    return cmd_output('git', *args, cwd=directory, env=env)
  File "/Users/iadar/Library/Python/2.7/lib/python/site-packages/pre_commit/util.py", line 186, in cmd_output
    returncode, cmd, retcode, output=(stdout, stderr),
CalledProcessError: Command: ('/Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
Return code: 1
Expected return code: 0
Output: (none)
Errors:
    /Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core/git-sh-setup: line 46: //libexec/git-core/git-sh-i18n: No such file or directory

I don't know if the problem is on the GitHub Desktop 1.5.2 beta 0 side, the pre-commit side, the Git side or the Python side. Any clues to resolve this will be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions