| 304 | } |
| 305 | |
| 306 | static void show_one_commit(struct commit *commit, int no_name) |
| 307 | { |
| 308 | struct strbuf pretty = STRBUF_INIT; |
| 309 | const char *pretty_str = "(unavailable)"; |
| 310 | struct commit_name *name = commit_to_name(commit); |
| 311 | |
| 312 | if (commit->object.parsed) { |
| 313 | pp_commit_easy(CMIT_FMT_ONELINE, commit, &pretty); |
| 314 | pretty_str = pretty.buf; |
| 315 | } |
| 316 | skip_prefix(pretty_str, "[PATCH] ", &pretty_str); |
| 317 | |
| 318 | if (!no_name) { |
| 319 | if (name && name->head_name) { |
| 320 | printf("[%s", name->head_name); |
| 321 | if (name->generation) { |
| 322 | if (name->generation == 1) |
| 323 | printf("^"); |
| 324 | else |
| 325 | printf("~%d", name->generation); |
| 326 | } |
| 327 | printf("] "); |
| 328 | } |
| 329 | else |
| 330 | printf("[%s] ", |
| 331 | repo_find_unique_abbrev(the_repository, &commit->object.oid, |
| 332 | DEFAULT_ABBREV)); |
| 333 | } |
| 334 | puts(pretty_str); |
| 335 | strbuf_release(&pretty); |
| 336 | } |
| 337 | |
| 338 | static char *ref_name[MAX_REVS + 1]; |
| 339 | static int ref_name_cnt; |
no test coverage detected