Exemplo n.º 1
0
def pre_commit_hooks() -> None:
    """ Sets up git hooks """

    try:
        get_git_dir()
        pre_commit(['install'])
    except CalledProcessError:
        log.warning(
            'Git folder has not bee found! Proceed without git hooks setup step'
        )
def _hook_paths(
    hook_type: str,
    git_dir: Optional[str] = None,
) -> Tuple[str, str]:
    git_dir = git_dir if git_dir is not None else git.get_git_dir()
    pth = os.path.join(git_dir, 'hooks', hook_type)
    return pth, f'{pth}.legacy'
Exemplo n.º 3
0
def test_get_git_dir(tmpdir):
    """Regression test for #1972"""
    src = tmpdir.join('src').ensure_dir()
    cmd_output('git', 'init', str(src))
    git_commit(cwd=str(src))

    worktree = tmpdir.join('worktree').ensure_dir()
    cmd_output('git', 'worktree', 'add', '../worktree', cwd=src)

    with worktree.as_cwd():
        assert git.get_git_dir() == src.ensure_dir('.git/worktrees/worktree', )
        assert git.get_git_common_dir() == src.ensure_dir('.git')
Exemplo n.º 4
0
def _hook_paths(hook_type):
    pth = os.path.join(git.get_git_dir(), 'hooks', hook_type)
    return pth, '{}.legacy'.format(pth)
Exemplo n.º 5
0
 def git_dir(self):
     return git.get_git_dir(self.git_root)
Exemplo n.º 6
0
 def git_dir(self):
     return git.get_git_dir(self.git_root)
Exemplo n.º 7
0
def _hook_paths(hook_type):
    pth = os.path.join(git.get_git_dir(), 'hooks', hook_type)
    return pth, '{}.legacy'.format(pth)
def _hook_paths(hook_type, git_dir=None):
    git_dir = git_dir if git_dir is not None else git.get_git_dir()
    pth = os.path.join(git_dir, 'hooks', hook_type)
    return pth, '{}.legacy'.format(pth)
Exemplo n.º 9
0
 def get_hook_path(self, hook_type):
     return os.path.join(git.get_git_dir(self.git_root), 'hooks', hook_type)