Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 62ecd6c

Browse filesBrowse files
committed
Fix trailing newline handling and typo on test code.
1 parent 8065d2a commit 62ecd6c
Copy full SHA for 62ecd6c

2 files changed

+5-6Lines changed: 5 additions & 6 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎git/objects/commit.py‎

Copy file name to clipboardExpand all lines: git/objects/commit.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def _serialize(self, stream):
403403

404404
if self.gpgsig:
405405
write("gpgsig")
406-
for sigline in self.gpgsig.split("\n"):
406+
for sigline in self.gpgsig.rstrip("\n").split("\n"):
407407
write(" "+sigline+"\n")
408408

409409
write("\n")
@@ -458,7 +458,7 @@ def _deserialize(self, stream):
458458
is_next_header = True
459459
break
460460
sig += sigbuf[1:]
461-
self.gpgsig = sig
461+
self.gpgsig = sig.rstrip("\n")
462462
if is_next_header:
463463
continue
464464
buf = readline().strip()
Collapse file

‎git/test/objects/test_commit.py‎

Copy file name to clipboardExpand all lines: git/test/objects/test_commit.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,11 @@ def test_gpgsig(self):
298298
BX/otlTa8pNE3fWYBxURvfHnMY4i3HQT7Bc1QjImAhMnyo2vJk4ORBJIZ1FTNIhJ
299299
JzJMZDRLQLFvnzqZuCjE
300300
=przd
301-
-----END PGP SIGNATURE-----
302-
"""
301+
-----END PGP SIGNATURE-----"""
303302
assert cmt.gpgsig == fixture_sig
304303

305304
cmt.gpgsig = "<test\ndummy\nsig>"
306-
assert cmt.gpgsig != sig
305+
assert cmt.gpgsig != fixture_sig
307306

308307
cstream = StringIO()
309308
cmt._serialize(cstream)
@@ -312,7 +311,7 @@ def test_gpgsig(self):
312311
cstream.seek(0)
313312
cmt.gpgsig = None
314313
cmt._deserialize(cstream)
315-
assert cmt.gpgsig == "<test\ndummy\nsig>\n"
314+
assert cmt.gpgsig == "<test\ndummy\nsig>"
316315

317316
cmt.gpgsig = None
318317
cstream = StringIO()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.