summaryrefslogtreecommitdiff
path: root/read-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-13 22:27:42 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-13 22:27:42 -0700
commit2ba6c47be1762726ad0c1d5779064c489150d789 (patch)
treee45d2513b9888c831acc3a15d7b00a508de5cfe5 /read-tree.c
parent74376a686425c6304eafff9f26d8d5fb0d083bc0 (diff)
downloadgit-2ba6c47be1762726ad0c1d5779064c489150d789.tar.gz
read-tree: fix bogus debugging statement.
We wanted to detect case #16 which should be rare, but botched the case when some paths are missing, causing a segfault. My fault. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'read-tree.c')
-rw-r--r--read-tree.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/read-tree.c b/read-tree.c
index 4db154db2b..6a5c08c4c6 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -362,12 +362,15 @@ static int keep_entry(struct cache_entry *ce)
static void show_stage_entry(FILE *o,
const char *label, const struct cache_entry *ce)
{
- fprintf(stderr, "%s%06o %s %d\t%s\n",
- label,
- ntohl(ce->ce_mode),
- sha1_to_hex(ce->sha1),
- ce_stage(ce),
- ce->name);
+ if (!ce)
+ fprintf(o, "%s (missing)\n", label);
+ else
+ fprintf(o, "%s%06o %s %d\t%s\n",
+ label,
+ ntohl(ce->ce_mode),
+ sha1_to_hex(ce->sha1),
+ ce_stage(ce),
+ ce->name);
}
#endif