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

Function do_update_refs

sequencer.c:4581–4630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4579}
4580
4581static int do_update_refs(struct repository *r, int quiet)
4582{
4583 int res = 0;
4584 struct string_list_item *item;
4585 struct string_list refs_to_oids = STRING_LIST_INIT_DUP;
4586 struct ref_store *refs = get_main_ref_store(r);
4587 struct strbuf update_msg = STRBUF_INIT;
4588 struct strbuf error_msg = STRBUF_INIT;
4589
4590 if ((res = sequencer_get_update_refs_state(r->gitdir, &refs_to_oids)))
4591 return res;
4592
4593 for_each_string_list_item(item, &refs_to_oids) {
4594 struct update_ref_record *rec = item->util;
4595 int loop_res;
4596
4597 loop_res = refs_update_ref(refs, "rewritten during rebase",
4598 item->string,
4599 &rec->after, &rec->before,
4600 0, UPDATE_REFS_MSG_ON_ERR);
4601 res |= loop_res;
4602
4603 if (quiet)
4604 continue;
4605
4606 if (loop_res)
4607 strbuf_addf(&error_msg, "\t%s\n", item->string);
4608 else
4609 strbuf_addf(&update_msg, "\t%s\n", item->string);
4610 }
4611
4612 if (!quiet &&
4613 (update_msg.len || error_msg.len)) {
4614 fprintf(stderr,
4615 _("Updated the following refs with %s:\n%s"),
4616 "--update-refs",
4617 update_msg.buf);
4618
4619 if (res)
4620 fprintf(stderr,
4621 _("Failed to update the following refs with %s:\n%s"),
4622 "--update-refs",
4623 error_msg.buf);
4624 }
4625
4626 string_list_clear(&refs_to_oids, 1);
4627 strbuf_release(&update_msg);
4628 strbuf_release(&error_msg);
4629 return res;
4630}
4631
4632static int is_final_fixup(struct todo_list *todo_list)
4633{

Callers 1

pick_commitsFunction · 0.85

Calls 6

get_main_ref_storeFunction · 0.85
refs_update_refFunction · 0.85
strbuf_addfFunction · 0.85
string_list_clearFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected