Restore git 1.8 support

This commit is contained in:
Anthony Sottile 2018-03-12 13:09:05 -07:00
parent 179f11bdce
commit 96e9d1b758
10 changed files with 35 additions and 38 deletions

View file

@ -29,8 +29,8 @@ def git_dir(tempdir_factory):
def make_repo(tempdir_factory, repo_source):
path = git_dir(tempdir_factory)
copy_tree_to_path(get_resource_path(repo_source), path)
cmd_output('git', '-C', path, 'add', '.')
cmd_output('git', '-C', path, 'commit', '-m', 'Add hooks')
cmd_output('git', 'add', '.', cwd=path)
cmd_output('git', 'commit', '-m', 'Add hooks', cwd=path)
return path
@ -114,15 +114,14 @@ def write_config(directory, config, config_file=C.CONFIG_FILE):
def add_config_to_repo(git_path, config, config_file=C.CONFIG_FILE):
write_config(git_path, config, config_file=config_file)
cmd_output('git', '-C', git_path, 'add', config_file)
cmd_output('git', '-C', git_path, 'commit', '-m', 'Add hooks config')
cmd_output('git', 'add', config_file, cwd=git_path)
cmd_output('git', 'commit', '-m', 'Add hooks config', cwd=git_path)
return git_path
def remove_config_from_repo(git_path, config_file=C.CONFIG_FILE):
os.unlink(os.path.join(git_path, config_file))
cmd_output('git', '-C', git_path, 'add', config_file)
cmd_output('git', '-C', git_path, 'commit', '-m', 'Remove hooks config')
cmd_output('git', 'rm', config_file, cwd=git_path)
cmd_output('git', 'commit', '-m', 'Remove hooks config', cwd=git_path)
return git_path