MCPcopy Index your code
hub / github.com/git/git / warn_if_dangling_symref

Function warn_if_dangling_symref

refs.c:500–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498};
499
500static int warn_if_dangling_symref(const struct reference *ref, void *cb_data)
501{
502 struct warn_if_dangling_data *d = cb_data;
503 const char *resolves_to, *msg;
504
505 if (!(ref->flags & REF_ISSYMREF))
506 return 0;
507
508 resolves_to = refs_resolve_ref_unsafe(d->refs, ref->name, 0, NULL, NULL);
509 if (!resolves_to
510 || !string_list_has_string(d->refnames, resolves_to)) {
511 return 0;
512 }
513
514 msg = d->dry_run
515 ? _("%s%s will become dangling after %s is deleted\n")
516 : _("%s%s has become dangling after %s was deleted\n");
517 fprintf(d->fp, msg, d->indent, ref->name, resolves_to);
518 return 0;
519}
520
521void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp,
522 const char *indent, int dry_run,

Callers

nothing calls this directly

Calls 2

refs_resolve_ref_unsafeFunction · 0.85
string_list_has_stringFunction · 0.85

Tested by

no test coverage detected