summaryrefslogtreecommitdiff
path: root/builtin/diff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-05-19 12:55:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-24 01:59:27 (GMT)
commit18f1ad76392e60cfaf68c3f1e49a4c91bd415d0d (patch)
tree8f67650ef4cc10a87579b36f20fbc2707e61b73d /builtin/diff.c
parent101dd4de16eea300a59e432452fd4fc06e1ac7f2 (diff)
downloadgit-18f1ad76392e60cfaf68c3f1e49a4c91bd415d0d.zip
git-18f1ad76392e60cfaf68c3f1e49a4c91bd415d0d.tar.gz
git-18f1ad76392e60cfaf68c3f1e49a4c91bd415d0d.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/diff.c')
0 files changed, 0 insertions, 0 deletions