summaryrefslogtreecommitdiff
path: root/lib/git/cmd.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-14 19:41:27 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-14 19:41:27 +0200
commitc5df44408218003eb49e3b8fc94329c5e8b46c7d (patch)
tree2e0c757af71c05cc5d4580cf80ba97abb00fe1be /lib/git/cmd.py
parent6745f4542cfb74bbf3b933dba7a59ef2f54a4380 (diff)
downloadgitpython-c5df44408218003eb49e3b8fc94329c5e8b46c7d.tar.gz
persistent command signature changed to also return the hexsha from a possible input ref - the objects pointed to by refs are now baked on demand - perhaps it should change to always be re-retrieved using a property as it is relatively fast - this way refs can always be cached
Diffstat (limited to 'lib/git/cmd.py')
-rw-r--r--lib/git/cmd.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/git/cmd.py b/lib/git/cmd.py
index 92ef3bda..2965eb8b 100644
--- a/lib/git/cmd.py
+++ b/lib/git/cmd.py
@@ -272,7 +272,7 @@ class Git(object):
<hex_sha> type_string size_as_int
Returns
- (type_string, size_as_int)
+ (hex_sha, type_string, size_as_int)
Raises
ValueError if the header contains indication for an error due to incorrect
@@ -282,7 +282,7 @@ class Git(object):
if len(tokens) != 3:
raise ValueError( "SHA named %s could not be resolved" % tokens[0] )
- return (tokens[1], int(tokens[2]))
+ return (tokens[0], tokens[1], int(tokens[2]))
def __prepare_ref(self, ref):
# required for command to separate refs on stdin
@@ -318,7 +318,7 @@ class Git(object):
once and reuses the command in subsequent calls.
Return:
- (type_string, size_as_int)
+ (hexsha, type_string, size_as_int)
"""
cmd = self.__get_persistent_cmd("cat_file_header", "cat_file", batch_check=True)
return self.__get_object_header(cmd, ref)
@@ -328,11 +328,11 @@ class Git(object):
As get_object_header, but returns object data as well
Return:
- (type_string, size_as_int,data_string)
+ (hexsha, type_string, size_as_int,data_string)
"""
cmd = self.__get_persistent_cmd("cat_file_all", "cat_file", batch=True)
- typename, size = self.__get_object_header(cmd, ref)
+ hexsha, typename, size = self.__get_object_header(cmd, ref)
data = cmd.stdout.read(size)
cmd.stdout.read(1) # finishing newlines
- return (typename, size, data)
+ return (hexsha, typename, size, data)