Files
git/builtin
Jeff King 9e0c3c4fcd make add_object_array_with_context interface more sane
When you resolve a sha1, you can optionally keep any context
found during the resolution, including the path and mode of
a tree entry (e.g., when looking up "HEAD:subdir/file.c").

The add_object_array_with_context function lets you then
attach that context to an entry in a list. Unfortunately,
the interface for doing so is horrible. The object_context
structure is large and most object_array users do not use
it. Therefore we keep a pointer to the structure to avoid
burdening other users too much. But that means when we do
use it that we must allocate the struct ourselves. And the
struct contains a fixed PATH_MAX-sized buffer, which makes
this wholly unsuitable for any large arrays.

We can observe that there is only a single user of the
"with_context" variant: builtin/grep.c. And in that use
case, the only element we care about is the path. We can
therefore store only the path as a pointer (the context's
mode field was redundant with the object_array_entry itself,
and nobody actually cared about the surrounding tree). This
still requires a strdup of the pathname, but at least we are
only consuming the minimum amount of memory for each string.

We can also handle the copying ourselves in
add_object_array_*, and free it as appropriate in
object_array_release_entry.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-16 10:10:44 -07:00
..
2014-07-16 11:10:11 -07:00
2014-09-19 11:38:32 -07:00
2014-09-11 10:33:32 -07:00
2014-09-09 12:54:06 -07:00
2014-09-19 11:38:35 -07:00
2014-09-19 11:38:35 -07:00
2014-01-17 12:21:20 -08:00
2014-07-09 11:34:05 -07:00
2014-09-26 14:39:45 -07:00
2014-09-26 14:39:43 -07:00
2014-09-26 14:39:45 -07:00
2014-09-02 13:28:44 -07:00
2014-09-26 14:39:45 -07:00
2014-09-02 12:00:30 -07:00
2014-08-13 09:50:58 -07:00
2014-09-26 14:39:45 -07:00
2014-09-19 11:38:35 -07:00
2014-10-08 13:05:25 -07:00
2014-09-11 10:33:31 -07:00
2014-04-30 10:30:02 -07:00
2014-07-16 11:25:40 -07:00
2014-09-02 12:00:30 -07:00
2014-10-08 13:05:25 -07:00
2014-09-11 10:33:31 -07:00
2014-07-16 11:25:40 -07:00