示例#1
0
    def test_with_env_pwd(self):
        with TemporaryDirectory() as f:
            temp_path = Path(f)

            exec_git('-C', str(temp_path), 'init')

            os.environ['PWD'] = str(temp_path)

            git_dir_path = temp_path / '.git'

            git_hook_dir_path = get_git_hook_directory_path()
            self.assertEqual(git_hook_dir_path, git_dir_path / 'hooks')
示例#2
0
    def test_with_env_pwd(self):
        with TemporaryDirectory() as f:
            temp_path = Path(f)

            exec_git('-C', str(temp_path), 'init')

            os.chdir(str(temp_path))

            git_dir_path = (temp_path / '.git').resolve()

            git_hook_dir_path = get_git_hook_directory_path()
            self.assertEqual(git_hook_dir_path, git_dir_path / 'hooks')
示例#3
0
def get_pre_commit_hook_path():
    git_hook_dir_path = get_git_hook_directory_path()
    return git_hook_dir_path / 'pre-commit'
示例#4
0
 def test_get_git_hook_directory_path(self):
     path = Path('foo')
     git_hook_dir_path = get_git_hook_directory_path(path)
     self.assertEqual(git_hook_dir_path, path / 'hooks')