summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6872f60)
raw | patch | inline | side by side (parent: 6872f60)
author | Alex Riesen <raa.lkml@gmail.com> | |
Thu, 19 Mar 2009 22:54:29 +0000 (23:54 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 20 Mar 2009 16:35:21 +0000 (09:35 -0700) |
An error message is already printed by sha1_object_info itself, and
the failed entries are additionally marked in the listing.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the failed entries are additionally marked in the listing.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-ls-tree.c | patch | blob | history |
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index fca46312f681caf077565fb4bd5b59a70008eb59..22008dfa8fb94d971b6fb1bd7342ede02a8d3fd0 100644 (file)
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
{
int retval = 0;
const char *type = blob_type;
- unsigned long size;
if (S_ISGITLINK(mode)) {
/*
if (!(ls_options & LS_NAME_ONLY)) {
if (ls_options & LS_SHOW_SIZE) {
+ char size_text[24];
if (!strcmp(type, blob_type)) {
- sha1_object_info(sha1, &size);
- printf("%06o %s %s %7lu\t", mode, type,
- abbrev ? find_unique_abbrev(sha1, abbrev)
- : sha1_to_hex(sha1),
- size);
+ unsigned long size;
+ if (sha1_object_info(sha1, &size) == OBJ_BAD)
+ strcpy(size_text, "BAD");
+ else
+ snprintf(size_text, sizeof(size_text),
+ "%lu", size);
} else
- printf("%06o %s %s %7c\t", mode, type,
- abbrev ? find_unique_abbrev(sha1, abbrev)
- : sha1_to_hex(sha1),
- '-');
+ strcpy(size_text, "-");
+ printf("%06o %s %s %7s\t", mode, type,
+ abbrev ? find_unique_abbrev(sha1, abbrev)
+ : sha1_to_hex(sha1),
+ size_text);
} else
printf("%06o %s %s\t", mode, type,
abbrev ? find_unique_abbrev(sha1, abbrev)