def _perform_git_commit(filename, git_commit, git_message): if git_commit and git.is_git(): reset('git') # resets git commit info git.commit(git_message) log('Git repository identified. Performing git commit...') git_info = { 'repository': git.get_remote(), 'commit': git.get_current_commit(), 'filename': filename, 'path': git.get_relative_path(), 'branch': git.get_branch() } log_git(git_info, verbose=False)
def test_commit(self): message = 'sample commit' expected_result = 'cd ' + get_repository_root() + ' && git add . && git commit -a -m "sample commit" && cd -' self.assertEqual(commit(message), 0)
def test_commit(): with mock_git_repo(): os.system('touch file') message = 'sample commit' assert commit(message) == 0