| 864 | define_commit_slab(author_date_slab, timestamp_t); |
| 865 | |
| 866 | void record_author_date(struct author_date_slab *author_date, |
| 867 | struct commit *commit) |
| 868 | { |
| 869 | const char *buffer = repo_get_commit_buffer(the_repository, commit, |
| 870 | NULL); |
| 871 | struct ident_split ident; |
| 872 | const char *ident_line; |
| 873 | size_t ident_len; |
| 874 | char *date_end; |
| 875 | timestamp_t date; |
| 876 | |
| 877 | ident_line = find_commit_header(buffer, "author", &ident_len); |
| 878 | if (!ident_line) |
| 879 | goto fail_exit; /* no author line */ |
| 880 | if (split_ident_line(&ident, ident_line, ident_len) || |
| 881 | !ident.date_begin || !ident.date_end) |
| 882 | goto fail_exit; /* malformed "author" line */ |
| 883 | |
| 884 | date = parse_timestamp(ident.date_begin, &date_end, 10); |
| 885 | if (date_end != ident.date_end) |
| 886 | goto fail_exit; /* malformed date */ |
| 887 | *(author_date_slab_at(author_date, commit)) = date; |
| 888 | |
| 889 | fail_exit: |
| 890 | repo_unuse_commit_buffer(the_repository, commit, buffer); |
| 891 | } |
| 892 | |
| 893 | int compare_commits_by_author_date(const void *a_, const void *b_, |
| 894 | void *cb_data) |
no test coverage detected