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

Function write_rr

rerere.c:245–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243static struct lock_file write_lock;
244
245static int write_rr(struct string_list *rr, int out_fd)
246{
247 int i;
248 for (i = 0; i < rr->nr; i++) {
249 struct strbuf buf = STRBUF_INIT;
250 struct rerere_id *id;
251
252 assert(rr->items[i].util != RERERE_RESOLVED);
253
254 id = rr->items[i].util;
255 if (!id)
256 continue;
257 assert(id->variant >= 0);
258 if (0 < id->variant)
259 strbuf_addf(&buf, "%s.%d\t%s%c",
260 rerere_id_hex(id), id->variant,
261 rr->items[i].string, 0);
262 else
263 strbuf_addf(&buf, "%s\t%s%c",
264 rerere_id_hex(id),
265 rr->items[i].string, 0);
266
267 if (write_in_full(out_fd, buf.buf, buf.len) < 0)
268 die(_("unable to write rerere record"));
269
270 strbuf_release(&buf);
271 }
272 if (commit_lock_file(&write_lock) != 0)
273 die(_("unable to write rerere record"));
274 return 0;
275}
276
277/*
278 * "rerere" interacts with conflicted file contents using this I/O

Callers 2

do_plain_rerereFunction · 0.85
rerere_forgetFunction · 0.85

Calls 6

strbuf_addfFunction · 0.85
rerere_id_hexFunction · 0.85
write_in_fullFunction · 0.85
strbuf_releaseFunction · 0.85
commit_lock_fileFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected