• J
    handle_revision_arg: record paths for pending objects · 18f1ad76
    Jeff King 提交于
    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: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    18f1ad76
revision.c 92.3 KB