mark_object(object);
printf("blob\nmark :%d\ndata %lu\n", last_idnum, size);
- if (fwrite(buf, size, 1, stdout) != 1)
+ if (size && fwrite(buf, size, 1, stdout) != 1)
die ("Could not write blob %s", sha1_to_hex(sha1));
printf("\n");
printf("D %s\n", spec->path);
else {
struct object *object = lookup_object(spec->sha1);
- printf("M 0%06o :%d %s\n", spec->mode,
+ printf("M %06o :%d %s\n", spec->mode,
get_object_mark(object), spec->path);
}
}
mark_object(&commit->object);
if (!is_encoding_utf8(encoding))
reencoded = reencode_string(message, "UTF-8", encoding);
+ if (!commit->parents)
+ printf("reset %s\n", (const char*)commit->util);
printf("commit %s\nmark :%d\n%.*s\n%.*s\ndata %u\n%s",
(const char *)commit->util, last_idnum,
(int)(author_end - author), author,
? strlen(reencoded) : message
? strlen(message) : 0),
reencoded ? reencoded : message ? message : "");
- if (reencoded)
- free(reencoded);
+ free(reencoded);
for (i = 0, p = commit->parents; p; p = p->next) {
int mark = get_object_mark(&p->item->object);
continue;
if (i == 0)
printf("from :%d\n", mark);
- else if (i == 1)
- printf("merge :%d", mark);
else
- printf(" :%d", mark);
+ printf("merge :%d\n", mark);
i++;
}
- if (i > 1)
- printf("\n");
log_tree_diff_flush(rev);
rev->diffopt.output_format = saved_output_format;
};
/* we handle encodings */
- git_config(git_default_config);
+ git_config(git_default_config, NULL);
init_revisions(&revs, prefix);
argc = setup_revisions(argc, argv, &revs, NULL);
get_tags_and_duplicates(&revs.pending, &extra_refs);
- prepare_revision_walk(&revs);
+ if (prepare_revision_walk(&revs))
+ die("revision walk setup failed");
revs.diffopt.format_callback = show_filemodify;
DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
while ((commit = get_revision(&revs))) {