Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix appending trailers to git commits #33

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def _set_trailers(self, patch: Patch) -> str:
# Add trailers, changing them if they exist.
# It's _highly_ unlikely that they'd exist, but this seems to be the
# most sane way of handling that edge case.
with tempfile.NamedTemporaryFile(mode='wt') as f:
with tempfile.NamedTemporaryFile(mode='w+') as f:
f.write(original_message)
f.flush() # Flush before we write to the file externally below
self._git('interpret-trailers', '--in-place', '--if-exists=addIfDifferent',
'--trailer', change_id_trailer, '--trailer', lore_trailer, f.name)
return self._git.commit('--amend', '-F', f.name)
Expand Down