commit 48830929110975bbf1aeab8dff472d33f50fa548 from: Stefan Sperling via: Thomas Adam date: Sat Jan 07 16:36:08 2023 UTC show from: and via: headers on consecutive lines in 'got log' and 'tog log' ok jamsek commit - f3ad4b0a2ba1fd3f0c3f54b3f506585b0570d1b1 commit + 48830929110975bbf1aeab8dff472d33f50fa548 blob - 8669268b5e3483ebf2b5a00490e7fe5fccd0cece blob + 3332095a8811454d53d12e13a07aceca025d3d7a --- got/got.c +++ got/got.c @@ -4202,14 +4202,14 @@ print_commit(struct got_commit_object *commit, struct free(refs_str); refs_str = NULL; printf("from: %s\n", got_object_commit_get_author(commit)); - committer_time = got_object_commit_get_committer_time(commit); - datestr = get_datestr(&committer_time, datebuf); - if (datestr) - printf("date: %s UTC\n", datestr); author = got_object_commit_get_author(commit); committer = got_object_commit_get_committer(commit); if (strcmp(author, committer) != 0) printf("via: %s\n", committer); + committer_time = got_object_commit_get_committer_time(commit); + datestr = get_datestr(&committer_time, datebuf); + if (datestr) + printf("date: %s UTC\n", datestr); if (got_object_commit_get_nparents(commit) > 1) { const struct got_object_id_queue *parent_ids; struct got_object_qid *qid; blob - ff5f1a7aa6b97fe6f63e22a55e2ffa4049c5db27 blob + 32f094442105db209ba33dc4657540b9ea984e87 --- tog/tog.c +++ tog/tog.c @@ -4623,31 +4623,31 @@ write_commit_info(struct got_diff_line **lines, size_t if (err) goto done; - committer_time = got_object_commit_get_committer_time(commit); - datestr = get_datestr(&committer_time, datebuf); - if (datestr) { - n = fprintf(outfile, "date: %s UTC\n", datestr); + author = got_object_commit_get_author(commit); + committer = got_object_commit_get_committer(commit); + if (strcmp(author, committer) != 0) { + n = fprintf(outfile, "via: %s\n", committer); if (n < 0) { err = got_error_from_errno("fprintf"); goto done; } outoff += n; err = add_line_metadata(lines, nlines, outoff, - GOT_DIFF_LINE_DATE); + GOT_DIFF_LINE_AUTHOR); if (err) goto done; } - author = got_object_commit_get_author(commit); - committer = got_object_commit_get_committer(commit); - if (strcmp(author, committer) != 0) { - n = fprintf(outfile, "via: %s\n", committer); + committer_time = got_object_commit_get_committer_time(commit); + datestr = get_datestr(&committer_time, datebuf); + if (datestr) { + n = fprintf(outfile, "date: %s UTC\n", datestr); if (n < 0) { err = got_error_from_errno("fprintf"); goto done; } outoff += n; err = add_line_metadata(lines, nlines, outoff, - GOT_DIFF_LINE_AUTHOR); + GOT_DIFF_LINE_DATE); if (err) goto done; }