sha1-file: document how to use pretend_object_file
commit60440d72db4c9f2fc05b841813e72159c4f08928
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 4 Jan 2020 00:13:31 +0000 (3 16:13 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jan 2020 16:44:24 +0000 (6 08:44 -0800)
tree2bc28ab59a2138996ad102578c7e4947aa222a66
parent53a06cf39b756eddfe4a2a34da93e3d04eb7b728
sha1-file: document how to use pretend_object_file

Like in-memory alternates, pretend_object_file contains a trap for the
unwary: careless callers can use it to create references to an object
that does not exist in the on-disk object store.

Add a comment documenting how to use the function without risking such
problems.

The only current caller is blame, which uses pretend_object_file to
create an in-memory commit representing the working tree state.
Noticed during a discussion of how to safely use this function in
operations like "git merge" which, unlike blame, are not read-only.

Inspired-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-store.h