From 657a57adbff49c553752254c106ce1d5b5690cf8 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 18 Oct 2009 17:20:30 +0200 Subject: Improved tagobject message handling by not assuming an empty fourth line anymore --- lib/git/objects/tag.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/git/objects/tag.py') diff --git a/lib/git/objects/tag.py b/lib/git/objects/tag.py index f54d4b64..b2140551 100644 --- a/lib/git/objects/tag.py +++ b/lib/git/objects/tag.py @@ -60,8 +60,13 @@ class TagObject(base.Object): tagger_info = lines[3][7:]# tagger self.tagger, self.tagged_date = utils.parse_actor_and_date(tagger_info) - # line 4 empty - check git source to figure out purpose - self.message = "\n".join(lines[5:]) + # line 4 empty - it could mark the beginning of the next header + # in csse there really is no message, it would not exist. Otherwise + # a newline separates header from message + if len(lines) > 5: + self.message = "\n".join(lines[5:]) + else: + self.message = '' # END check our attributes else: super(TagObject, self)._set_cache_(attr) -- cgit v1.2.3 From 3cb5ba18ab1a875ef6b62c65342de476be47871b Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 3 Nov 2009 16:35:33 +0100 Subject: object: renamed id attribute to sha as it in fact is always being rewritten as sha, even if the passed in id was a ref. This is done to assure objects are uniquely identified and will compare correctly --- lib/git/objects/tag.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/git/objects/tag.py') diff --git a/lib/git/objects/tag.py b/lib/git/objects/tag.py index b2140551..c329edf7 100644 --- a/lib/git/objects/tag.py +++ b/lib/git/objects/tag.py @@ -17,7 +17,7 @@ class TagObject(base.Object): type = "tag" __slots__ = ( "object", "tag", "tagger", "tagged_date", "message" ) - def __init__(self, repo, id, object=None, tag=None, + def __init__(self, repo, sha, object=None, tag=None, tagger=None, tagged_date=None, message=None): """ Initialize a tag object with additional data @@ -25,7 +25,7 @@ class TagObject(base.Object): ``repo`` repository this object is located in - ``id`` + ``sha`` SHA1 or ref suitable for git-rev-parse ``object`` @@ -41,7 +41,7 @@ class TagObject(base.Object): is the DateTime of the tag creation - use time.gmtime to convert it into a different format """ - super(TagObject, self).__init__(repo, id ) + super(TagObject, self).__init__(repo, sha ) self._set_self_from_args_(locals()) def _set_cache_(self, attr): -- cgit v1.2.3