| 188 | } |
| 189 | |
| 190 | void get_commit_format(const char *arg, struct rev_info *rev) |
| 191 | { |
| 192 | struct cmt_fmt_map *commit_format; |
| 193 | |
| 194 | rev->use_terminator = 0; |
| 195 | if (!arg) { |
| 196 | rev->commit_format = CMIT_FMT_DEFAULT; |
| 197 | return; |
| 198 | } |
| 199 | if (skip_prefix(arg, "format:", &arg)) { |
| 200 | save_user_format(rev, arg, 0); |
| 201 | return; |
| 202 | } |
| 203 | |
| 204 | if (!*arg || skip_prefix(arg, "tformat:", &arg) || strchr(arg, '%')) { |
| 205 | save_user_format(rev, arg, 1); |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | commit_format = find_commit_format(arg); |
| 210 | if (!commit_format) |
| 211 | die("invalid --pretty format: %s", arg); |
| 212 | |
| 213 | rev->commit_format = commit_format->format; |
| 214 | rev->use_terminator = commit_format->is_tformat; |
| 215 | rev->expand_tabs_in_log_default = commit_format->expand_tabs_in_log; |
| 216 | if (!rev->date_mode_explicit && commit_format->default_date_mode_type) |
| 217 | rev->date_mode.type = commit_format->default_date_mode_type; |
| 218 | if (commit_format->format == CMIT_FMT_USERFORMAT) { |
| 219 | save_user_format(rev, commit_format->user_format, |
| 220 | commit_format->is_tformat); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | /* |
| 225 | * Generic support for pretty-printing the header |
no test coverage detected