[PATCH] git-daemon --syslog to log through syslog
[git.git] / read-tree.c
index 4db154d..ca80873 100644 (file)
@@ -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
 
@@ -652,7 +655,7 @@ int main(int argc, char **argv)
                        die("failed to unpack tree object %s", arg);
                stage++;
        }
-       if (update && !merge)
+       if ((update||index_only) && !merge)
                usage(read_tree_usage);
        if (merge && !fn) {
                if (stage < 2)