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

Function flush_rewritten_pending

sequencer.c:2163–2186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2161}
2162
2163static void flush_rewritten_pending(void)
2164{
2165 struct strbuf buf = STRBUF_INIT;
2166 struct object_id newoid;
2167 FILE *out;
2168
2169 if (strbuf_read_file(&buf, rebase_path_rewritten_pending(), (GIT_MAX_HEXSZ + 1) * 2) > 0 &&
2170 !repo_get_oid(the_repository, "HEAD", &newoid) &&
2171 (out = fopen_or_warn(rebase_path_rewritten_list(), "a"))) {
2172 char *bol = buf.buf, *eol;
2173
2174 while (*bol) {
2175 eol = strchrnul(bol, '\n');
2176 fprintf(out, "%.*s %s\n", (int)(eol - bol),
2177 bol, oid_to_hex(&newoid));
2178 if (!*eol)
2179 break;
2180 bol = eol + 1;
2181 }
2182 fclose(out);
2183 unlink(rebase_path_rewritten_pending());
2184 }
2185 strbuf_release(&buf);
2186}
2187
2188static void record_in_rewritten(struct object_id *oid,
2189 enum todo_command next_command)

Callers 2

record_in_rewrittenFunction · 0.85
pick_commitsFunction · 0.85

Calls 5

strbuf_read_fileFunction · 0.85
repo_get_oidFunction · 0.85
fopen_or_warnFunction · 0.85
oid_to_hexFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected