| 2161 | } |
| 2162 | |
| 2163 | static 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 | |
| 2188 | static void record_in_rewritten(struct object_id *oid, |
| 2189 | enum todo_command next_command) |
no test coverage detected