예제 #1
0
파일: test_git.py 프로젝트: shaief/gitlint
    def test_git_hooks_dir(self, git):
        hooks_dir = os.path.join(u"föo", ".git", "hooks")
        git.return_value.__str__ = lambda _: hooks_dir + "\n"
        git.return_value.__unicode__ = lambda _: hooks_dir + "\n"
        self.assertEqual(git_hooks_dir(u"/blä"),
                         os.path.join(u"/blä", hooks_dir))

        git.assert_called_once_with("rev-parse",
                                    "--git-path",
                                    "hooks",
                                    _cwd=u"/blä")
예제 #2
0
    def test_git_hooks_dir(self, git):
        hooks_dir = os.path.join("föo", ".git", "hooks")
        git.return_value = hooks_dir + "\n"
        self.assertEqual(git_hooks_dir("/blä"), os.path.abspath(os.path.join("/blä", hooks_dir)))

        git.assert_called_once_with("rev-parse", "--git-path", "hooks", _cwd="/blä")
예제 #3
0
 def _assert_git_repo(target):
     """ Asserts that a given target directory is a git repository """
     hooks_dir = git_hooks_dir(target)
     if not os.path.isdir(hooks_dir):
         raise GitHookInstallerError(f"{target} is not a git repository.")
예제 #4
0
 def commit_msg_hook_path(lint_config):
     return os.path.join(git_hooks_dir(lint_config.target),
                         COMMIT_MSG_HOOK_DST_PATH)