summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5db47c2)
raw | patch | inline | side by side (parent: 5db47c2)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 28 Jun 2005 06:58:45 +0000 (23:58 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 28 Jun 2005 15:53:21 +0000 (08:53 -0700) |
When trying to find out the type of the object, there is no need
to uncompress the whole object. Just use sha1_object_info().
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
to uncompress the whole object. Just use sha1_object_info().
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
cat-file.c | patch | blob | history |
diff --git a/cat-file.c b/cat-file.c
index be41f516664bc96ebec77c9ab88c3ab8df02ddfa..0076fc5b20a71b4d32add42b8dcb76a22eea4ef6 100644 (file)
--- a/cat-file.c
+++ b/cat-file.c
usage("git-cat-file [-t | tagname] <sha1>");
if (!strcmp("-t", argv[1])) {
- buf = read_sha1_file(sha1, type, &size);
- if (buf) {
- buf = type;
- size = strlen(type);
- type[size] = '\n';
- size++;
+ if (!sha1_object_info(sha1, type, &size)) {
+ printf("%s\n", type);
+ return 0;
}
+ buf = NULL;
} else {
buf = read_object_with_reference(sha1, argv[1], &size, NULL);
}