path: root/builtin/diff.c
diff options
authorJeff King <>2017-05-19 12:55:26 (GMT)
committerJunio C Hamano <>2017-05-24 01:59:27 (GMT)
commit18f1ad76392e60cfaf68c3f1e49a4c91bd415d0d (patch)
tree8f67650ef4cc10a87579b36f20fbc2707e61b73d /builtin/diff.c
parent101dd4de16eea300a59e432452fd4fc06e1ac7f2 (diff)
handle_revision_arg: record paths for pending objects
If the revision parser sees an argument like tree:path, we parse it down to the correct blob (or tree), but throw away the "path" portion. Let's ask get_sha1_with_context() to record it, and pass it along in the pending array. This will let programs like git-diff which rely on the revision-parser show more accurate paths. Note that the implementation is a little tricky; we have to make sure we free oc.path in all code paths. For handle_dotdot(), we can piggy-back on the existing cleanup-wrapper pattern. The real work happens in handle_dotdot_1(), but the handle_dotdot() wrapper makes sure that the path is freed no matter how we exit the function (and for that reason we make sure that the object_context struct is zero'd, so if we fail to even get to the get_sha1_with_context() call, we just end up calling free(NULL)). Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/diff.c')
0 files changed, 0 insertions, 0 deletions