MCPcopy Index your code
hub / github.com/git/git / write_commented_object

Function write_commented_object

builtin/notes.c:163–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163static 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
193static void prepare_note_data(const struct object_id *object, struct note_data *d,
194 const struct object_id *old_note)

Callers 1

prepare_note_dataFunction · 0.85

Calls 10

strvec_pushlFunction · 0.85
oid_to_hexFunction · 0.85
start_commandFunction · 0.85
strbuf_readFunction · 0.85
die_errnoFunction · 0.85
write_or_dieFunction · 0.85
strbuf_releaseFunction · 0.85
finish_commandFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected