| 435 | } |
| 436 | |
| 437 | static int list(int argc, const char **argv, const char *prefix, |
| 438 | struct repository *repo UNUSED) |
| 439 | { |
| 440 | struct notes_tree *t; |
| 441 | struct object_id object; |
| 442 | const struct object_id *note; |
| 443 | int retval = -1; |
| 444 | struct option options[] = { |
| 445 | OPT_END() |
| 446 | }; |
| 447 | |
| 448 | if (argc) |
| 449 | argc = parse_options(argc, argv, prefix, options, |
| 450 | git_notes_list_usage, 0); |
| 451 | |
| 452 | if (1 < argc) { |
| 453 | error(_("too many arguments")); |
| 454 | usage_with_options(git_notes_list_usage, options); |
| 455 | } |
| 456 | |
| 457 | t = init_notes_check("list", 0); |
| 458 | if (argc) { |
| 459 | if (repo_get_oid(the_repository, argv[0], &object)) |
| 460 | die(_("failed to resolve '%s' as a valid ref."), argv[0]); |
| 461 | note = get_note(t, &object); |
| 462 | if (note) { |
| 463 | puts(oid_to_hex(note)); |
| 464 | retval = 0; |
| 465 | } else |
| 466 | retval = error(_("no note found for object %s."), |
| 467 | oid_to_hex(&object)); |
| 468 | } else |
| 469 | retval = for_each_note(t, 0, list_each_note, NULL); |
| 470 | |
| 471 | free_notes(t); |
| 472 | return retval; |
| 473 | } |
| 474 | |
| 475 | static int append_edit(int argc, const char **argv, const char *prefix, |
| 476 | struct repository *repo UNUSED); |
nothing calls this directly
no test coverage detected