commit a9da0816e28f2d7d6dbd3582ce02214e5c772501 from: Sven M. Hallberg date: Fri Aug 02 16:18:32 2024 UTC fix order of header lines: from, via, date, orig The from and via lines were deliberately adjacent before, so they should stay that way. commit - bfbb258b77efcda05d51b22c11c23c2b94c3cf05 commit + a9da0816e28f2d7d6dbd3582ce02214e5c772501 blob - 717a7c74d145e56db2a81a960f1739187059af09 blob + c000d1047d7b2bd91e7015e05e3443279216305b --- got/got.c +++ got/got.c @@ -4465,11 +4465,11 @@ print_commit(struct got_commit_object *commit, struct committer = got_object_commit_get_committer(commit); committer_time = got_object_commit_get_committer_time(commit); printf("from: %s\n", author); - if (author_time != committer_time) - print_date("orig:", &author_time); if (strcmp(author, committer) != 0) printf("via: %s\n", committer); print_date("date:", &committer_time); + if (author_time != committer_time) + print_date("orig:", &author_time); /* parent commits */ if (got_object_commit_get_nparents(commit) > 1) { blob - 5289fe88e2afd9cf2bdc043d4722c21fa4843071 blob + 6f62269b5db678a60f947bec3954fb82ba0cd2a4 --- tog/tog.c +++ tog/tog.c @@ -5196,6 +5196,7 @@ write_commit_info(struct got_diff_line **lines, size_t if (err) goto done; + /* author and committer data */ author = got_object_commit_get_author(commit); author_time = got_object_commit_get_author_time(commit); committer = got_object_commit_get_committer(commit); @@ -5209,12 +5210,6 @@ write_commit_info(struct got_diff_line **lines, size_t err = add_line_metadata(lines, nlines, outoff, GOT_DIFF_LINE_AUTHOR); if (err) goto done; - if (author_time != committer_time) { - err = write_date(lines, nlines, "orig:", &author_time, outfile, - &outoff); - if (err) - goto done; - } if (strcmp(author, committer) != 0) { n = fprintf(outfile, "via: %s\n", committer); if (n < 0) { @@ -5231,6 +5226,14 @@ write_commit_info(struct got_diff_line **lines, size_t &outoff); if (err) goto done; + if (author_time != committer_time) { + err = write_date(lines, nlines, "orig:", &author_time, outfile, + &outoff); + if (err) + goto done; + } + + /* parent commits */ if (got_object_commit_get_nparents(commit) > 1) { const struct got_object_id_queue *parent_ids; struct got_object_qid *qid;