Skip to content

Commit ec29b15

Browse files
Harmon758Byron
authored andcommitted
Remove compat.byte_ord
1 parent 438d3e6 commit ec29b15

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

‎git/compat.py

-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
defenc = sys.getfilesystemencoding()
3434

3535
if PY3:
36-
def byte_ord(b):
37-
return b
38-
3936
def bchr(n):
4037
return bytes([n])
4138

@@ -48,7 +45,6 @@ def mviter(d):
4845
else:
4946
if defenc == 'ascii':
5047
defenc = 'utf-8'
51-
byte_ord = ord
5248
bchr = chr
5349
unicode = unicode
5450
binary_type = str

‎git/objects/fun.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Module with functions which are supposed to be as fast as possible"""
22
from stat import S_ISDIR
33
from git.compat import (
4-
byte_ord,
54
safe_decode,
65
defenc,
76
xrange,
@@ -27,7 +26,7 @@ def tree_to_stream(entries, write):
2726
# END for each 8 octal value
2827

2928
# git slices away the first octal if its zero
30-
if byte_ord(mode_str[0]) == ord_zero:
29+
if mode_str[0] == ord_zero:
3130
mode_str = mode_str[1:]
3231
# END save a byte
3332

@@ -57,10 +56,10 @@ def tree_entries_from_data(data):
5756
# read mode
5857
# Some git versions truncate the leading 0, some don't
5958
# The type will be extracted from the mode later
60-
while byte_ord(data[i]) != space_ord:
59+
while data[i] != space_ord:
6160
# move existing mode integer up one level being 3 bits
6261
# and add the actual ordinal value of the character
63-
mode = (mode << 3) + (byte_ord(data[i]) - ord_zero)
62+
mode = (mode << 3) + (data[i] - ord_zero)
6463
i += 1
6564
# END while reading mode
6665

@@ -70,7 +69,7 @@ def tree_entries_from_data(data):
7069
# parse name, it is NULL separated
7170

7271
ns = i
73-
while byte_ord(data[i]) != 0:
72+
while data[i] != 0:
7473
i += 1
7574
# END while not reached NULL
7675

0 commit comments

Comments
 (0)