Files
Joel Brobecker 9c82498e7b Introduce (the concept of) git command output decoding
This commit is preparation work for the transition to Python 3.x,
where the output obtained by running Git commands will become
bytes as opposed to a string. In the vast majority of cases,
we'll want to decode that output into a string. Ideally, we would
want to do this in a way that is both compatible with Python 2.x
and Python 3.x, but we have found that this requires a lot of
work with many changes spread all over the code. So, instead,
what this commit does is introduce the concept of decoding
the output, but with the decoding only occurring when running
under Python 3.x.

That way, we can make progress towards Python 3.x while preserving
the behavior under Python 2.x intact.

Change-Id: I189577798ee96cba1fa55c7356babf102575642f
TN: U530-006
2021-10-06 11:27:20 -07:00

11 lines
432 B
Python

from git import git, get_object_type
print("DEBUG: Test the git --switch=False attribute")
print(git.log("-n1", pretty="format:%P", _decode=True).strip())
print("DEBUG: A Test to verify that git does not do any lstrip-ing...")
print(git.log("-n1", "space-subject", pretty="format:%s", _decode=True))
print("DEBUG: Unit test get_object_type with a null SHA1...")
print(get_object_type("0000000000000000000000000000000000000000"))