@matheusbsbs / matheus-bagliano / commits / 2ba6c47be1
Fork 0

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>

Junio C Hamano committed Sep 13, 2005 at 22:27 UTC 2ba6c47be1762726ad0c1d5779064c489150d789
1 file changed +9 -6
read-tree.c
+9 -6
@@ -362,12 +362,15 @@ static int keep_entry(struct cache_entry *ce)
362 static void show_stage_entry(FILE *o,
363 const char *label, const struct cache_entry *ce)
364 {
365 - fprintf(stderr, "%s%06o %s %d\t%s\n",
366 - label,
367 - ntohl(ce->ce_mode),
368 - sha1_to_hex(ce->sha1),
369 - ce_stage(ce),
370 - ce->name);
365 + if (!ce)
366 + fprintf(o, "%s (missing)\n", label);
367 + else
368 + fprintf(o, "%s%06o %s %d\t%s\n",
369 + label,
370 + ntohl(ce->ce_mode),
371 + sha1_to_hex(ce->sha1),
372 + ce_stage(ce),
373 + ce->name);
374 }
375 #endif
376