Skip to content

Commit

Permalink
Check for errors and skip commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeybohm committed Mar 25, 2018
1 parent cd40591 commit c439340
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion editorconfig_git_preserve_history/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def impersonate_and_write_commit(self, files: List[str]) -> None:
impersonator_name = run(['git', 'config', 'user.name'])[0]
message = self.message + "\n\nOriginal-Commit: " + self.commit + "\n" + \
"Impersonator: {} <{}>".format(impersonator_name, impersonator_email)
args = ['git', 'commit', '--date', self.date, '--author', self.author,
args = ['git', 'commit', '-n', '--date', self.date, '--author', self.author,
'--message', message]
run(args + files)

Expand Down
6 changes: 5 additions & 1 deletion editorconfig_git_preserve_history/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def find_and_write_commits():
change_file,
line_numbers)
with open(change_file, 'wb') as f:
f.write(new_contents)
try:
f.write(new_contents)
except IOError as e:
print("Error writing "+change_file)
raise e
gitinfo.impersonate_and_write_commit(change.files())


Expand Down

0 comments on commit c439340

Please sign in to comment.