On Wed, Feb 06, 2013 at 04:08:53PM +0100, Michael J Gruber wrote:
> - add_object_array(object, arg, &list);
> + add_object_array_with_context(object, arg, &list,
> xmemdupz(&oc, sizeof(struct object_context)));
If we go this route, this new _with_context variant should be used in
patch 1, too.
> @@ -265,9 +260,28 @@ void add_object_array_with_mode(struct object *obj,
> const char *name, struct obj
> objects[nr].item = obj;
> objects[nr].name = name;
> objects[nr].mode = mode;
> + objects[nr].context = context;
> array->nr = ++nr;
This seems a little gross. Who is responsible for allocating the
context? Who frees it? It looks like we duplicate it in cmd_grep. Which
I think is OK, but it means all of this context infrastructure in
object.[ch] is just bolted-on junk waiting for somebody to use it wrong
or get confused. It does not get set, for example, by the regular
setup_revisions code path.
It would be nice if we could just always have the context available,
then setup_revisions could set it up by default (and replace the "mode"
parameter entirely). But we'd need to do something to avoid the
PATH_MAX-sized buffer for each entry, as some code paths may have a
large number of pending objects.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html