| 161 | } |
| 162 | |
| 163 | static void write_commented_object(int fd, const struct object_id *object) |
| 164 | { |
| 165 | struct child_process show = CHILD_PROCESS_INIT; |
| 166 | struct strbuf buf = STRBUF_INIT; |
| 167 | struct strbuf cbuf = STRBUF_INIT; |
| 168 | |
| 169 | /* Invoke "git show --stat --no-notes $object" */ |
| 170 | strvec_pushl(&show.args, "show", "--stat", "--no-notes", |
| 171 | oid_to_hex(object), NULL); |
| 172 | show.no_stdin = 1; |
| 173 | show.out = -1; |
| 174 | show.err = 0; |
| 175 | show.git_cmd = 1; |
| 176 | if (start_command(&show)) |
| 177 | die(_("unable to start 'show' for object '%s'"), |
| 178 | oid_to_hex(object)); |
| 179 | |
| 180 | if (strbuf_read(&buf, show.out, 0) < 0) |
| 181 | die_errno(_("could not read 'show' output")); |
| 182 | strbuf_add_commented_lines(&cbuf, buf.buf, buf.len, comment_line_str); |
| 183 | write_or_die(fd, cbuf.buf, cbuf.len); |
| 184 | |
| 185 | strbuf_release(&cbuf); |
| 186 | strbuf_release(&buf); |
| 187 | |
| 188 | if (finish_command(&show)) |
| 189 | die(_("failed to finish 'show' for object '%s'"), |
| 190 | oid_to_hex(object)); |
| 191 | } |
| 192 | |
| 193 | static void prepare_note_data(const struct object_id *object, struct note_data *d, |
| 194 | const struct object_id *old_note) |
no test coverage detected