MCPcopy Create free account
hub / github.com/git/git / list

Function list

builtin/notes.c:437–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437static 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
475static int append_edit(int argc, const char **argv, const char *prefix,
476 struct repository *repo UNUSED);

Callers

nothing calls this directly

Calls 10

parse_optionsFunction · 0.85
errorFunction · 0.85
usage_with_optionsFunction · 0.85
init_notes_checkFunction · 0.85
repo_get_oidFunction · 0.85
get_noteFunction · 0.85
oid_to_hexFunction · 0.85
for_each_noteFunction · 0.85
free_notesFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected