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

Function diff_populate_gitlink

diff.c:4470–4490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4468}
4469
4470static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
4471{
4472 struct strbuf buf = STRBUF_INIT;
4473 const char *dirty = "";
4474
4475 /* Are we looking at the work tree? */
4476 if (s->dirty_submodule)
4477 dirty = "-dirty";
4478
4479 strbuf_addf(&buf, "Subproject commit %s%s\n",
4480 oid_to_hex(&s->oid), dirty);
4481 s->size = buf.len;
4482 if (size_only) {
4483 s->data = NULL;
4484 strbuf_release(&buf);
4485 } else {
4486 s->data = strbuf_detach(&buf, NULL);
4487 s->should_free = 1;
4488 }
4489 return 0;
4490}
4491
4492/*
4493 * While doing rename detection and pickaxe operation, we may need to

Callers 1

diff_populate_filespecFunction · 0.85

Calls 4

strbuf_addfFunction · 0.85
oid_to_hexFunction · 0.85
strbuf_releaseFunction · 0.85
strbuf_detachFunction · 0.85

Tested by

no test coverage detected