commit - c363871beda50b641e312c43813fd8962e2cd723
commit + 832c249c3a33c5421502bd9ddd86b05b619ae57c
blob - aaa7c0a42b73e7c2733bfcd4b9addac0e2521276
blob + df469a9624a297e45ad069d5fe8cea1eb52d064a
--- got/got.c
+++ got/got.c
struct got_repository *repo, int show_patch)
{
const struct got_error *err = NULL;
- char *buf;
+ char *id_str, *logmsg, *line;
- err = got_object_id_str(&buf, id);
+ err = got_object_id_str(&id_str, id);
if (err)
return err;
printf("-----------------------------------------------\n");
- printf("commit %s\n", buf);
+ printf("commit %s\n", id_str);
+ free(id_str);
printf("author: %s\n", commit->author);
if (strcmp(commit->author, commit->committer) != 0)
printf("committer: %s\n", commit->committer);
- printf("\n%s\n", commit->logmsg);
+
+ logmsg = strdup(commit->logmsg);
+ if (logmsg == NULL)
+ return got_error_from_errno();
+ do {
+ line = strsep(&logmsg, "\n");
+ if (line)
+ printf(" %s\n", line);
+ } while (line);
+ free(logmsg);
+
if (show_patch) {
err = print_patch(commit, id, repo);
if (err == 0)
printf("\n");
}
- free(buf);
return err;
}