commit 1a99e0b4097b26cac736de07239a3be7589a48f7 from: Stefan Sperling date: Sat Jan 07 16:13:33 2023 UTC show from: and via: headers on consecutive lines in 'got log' and 'tog log' ok jamsek commit - d651dcfa6fe871c93d967b1b741d2ad4bbb9e2c2 commit + 1a99e0b4097b26cac736de07239a3be7589a48f7 blob - f3bab984d4721436391e5b71e5cb14178af9a6ff blob + 4e1c7e548dd68228986b5949d2af99e7e032a6ba --- 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 - c032241608751301e7be7c2f440255dec505fecb blob + 7a91723cf327c438d7801b8d486b165bd84ba1ea --- tog/tog.c +++ tog/tog.c @@ -4618,31 +4618,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; }