git.samba.org
/
jelmer
/
dulwich-libgit2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge improvements and extra tests, mainly to deal better with creating non-bare...
[jelmer/dulwich-libgit2.git]
/
dulwich
/
objects.py
diff --git
a/dulwich/objects.py
b/dulwich/objects.py
index 8a644e034b5a5fa220ebb77bcf2c963ac272c294..d78e6d7e00b0c95491eccc2cb3be42852fb82ed2 100644
(file)
--- a/
dulwich/objects.py
+++ b/
dulwich/objects.py
@@
-140,6
+140,13
@@
def check_hexsha(hex, error_msg):
def check_identity(identity, error_msg):
def check_identity(identity, error_msg):
+ """Check if the specified identity is valid.
+
+ This will raise an exception if the identity is not valid.
+
+ :param identity: Identity string
+ :param error_msg: Error message to use in exception
+ """
email_start = identity.find("<")
email_end = identity.find(">")
if (email_start < 0 or email_end < 0 or email_end <= email_start
email_start = identity.find("<")
email_end = identity.find(">")
if (email_start < 0 or email_end < 0 or email_end <= email_start
@@
-267,8
+274,8
@@
class ShaFile(object):
size = os.path.getsize(f.name)
map = mmap.mmap(f.fileno(), size, access=mmap.ACCESS_READ)
try:
size = os.path.getsize(f.name)
map = mmap.mmap(f.fileno(), size, access=mmap.ACCESS_READ)
try:
- # skip type and size; type must have already been determined, and
we
- # trust zlib to fail if it's otherwise corrupted
+ # skip type and size; type must have already been determined, and
+ #
we
trust zlib to fail if it's otherwise corrupted
byte = ord(map[0])
used = 1
while (byte & 0x80) != 0:
byte = ord(map[0])
used = 1
while (byte & 0x80) != 0:
@@
-427,7
+434,7
@@
class ShaFile(object):
def sha(self):
"""The SHA1 object that is the name of this object."""
def sha(self):
"""The SHA1 object that is the name of this object."""
- if self._sha is None:
+ if self._sha is None
or self._needs_serialization
:
# this is a local because as_raw_chunks() overwrites self._sha
new_sha = make_sha()
new_sha.update(self._header())
# this is a local because as_raw_chunks() overwrites self._sha
new_sha = make_sha()
new_sha.update(self._header())