Commit dab5fe87a4baf0794fd02a8e5ad27561b107ea2a

Stefan Sperling 2018-09-14T20:22:22

tweak commit display

diff --git a/got/got.c b/got/got.c
index 5467480..8349fe9 100644
--- a/got/got.c
+++ b/got/got.c
@@ -331,13 +331,11 @@ print_commit(struct got_commit_object *commit, struct got_object_id *id,
 	printf("-----------------------------------------------\n");
 	printf("commit %s\n", id_str);
 	free(id_str);
-	datestr = get_datestr(&author_time, datebuf);
-	printf("author: %s  %s UTC\n", commit->author, datestr);
-	if (strcmp(commit->author, commit->committer) != 0 ||
-	    author_time != committer_time) {
-		datestr = get_datestr(&committer_time, datebuf);
-		printf("committer: %s  %s UTC\n", commit->committer, datestr);
-	}
+	datestr = get_datestr(&committer_time, datebuf);
+	printf("from: %s\n", commit->committer);
+	printf("date: %s UTC\n", datestr);
+	if (strcmp(commit->author, commit->committer) != 0)
+		printf("original author: %s\n", commit->author);
 	if (commit->nparents > 1) {
 		struct got_object_qid *qid;
 		int n = 1;
diff --git a/lib/diff.c b/lib/diff.c
index 39132fa..a06d2b0 100644
--- a/lib/diff.c
+++ b/lib/diff.c
@@ -611,15 +611,18 @@ got_diff_objects_as_commits(struct got_object *obj1, struct got_object *obj2,
 	}
 	free(id_str);
 	time = mktime(&commit2->tm_author);
-	if (fprintf(outfile, "author: %s  %s UTC\n", commit2->author,
+	if (fprintf(outfile, "from: %s\n", commit2->author) < 0) {
+		err = got_error_from_errno();
+		goto done;
+	}
+	if (fprintf(outfile, "date: %s UTC\n",
 	    get_datestr(&time, datebuf)) < 0) {
 		err = got_error_from_errno();
 		goto done;
 	}
 	time = mktime(&commit2->tm_committer);
 	if (strcmp(commit2->author, commit2->committer) != 0 &&
-	    fprintf(outfile, "committer: %s  %s UTC\n", commit2->committer,
-	    get_datestr(&time, datebuf)) < 0) {
+	    fprintf(outfile, "original author: %s\n", commit2->committer) < 0) {
 		err = got_error_from_errno();
 		goto done;
 	}