diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-10-23 13:21:30 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-10-23 13:21:31 -0700 |
commit | 4197361e39a304df30cc492122dbdfe90ae8af0e (patch) | |
tree | e64abbced7f07dab484262d7c0dab12af1abe2d0 /object.c | |
parent | eeb8e8373f68b706f5fc8a00760c3dedf239db70 (diff) | |
parent | afa15f3cd8f4cbf9572138329be374ff8566b10a (diff) | |
download | git-4197361e39a304df30cc492122dbdfe90ae8af0e.tar.gz |
Merge branch 'mg/more-textconv'
Make "git grep" and "git show" pay attention to --textconv when
dealing with blob objects.
* mg/more-textconv:
grep: honor --textconv for the case rev:path
grep: allow to use textconv filters
t7008: demonstrate behavior of grep with textconv
cat-file: do not die on --textconv without textconv filters
show: honor --textconv for blobs
diff_opt: track whether flags have been set explicitly
t4030: demonstrate behavior of show with textconv
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -262,18 +262,16 @@ int object_list_contains(struct object_list *list, struct object *obj) return 0; } -void add_object_array(struct object *obj, const char *name, struct object_array *array) -{ - add_object_array_with_mode(obj, name, array, S_IFINVALID); -} - /* * A zero-length string to which object_array_entry::name can be * initialized without requiring a malloc/free. */ static char object_array_slopbuf[1]; -void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode) +static void add_object_array_with_mode_context(struct object *obj, const char *name, + struct object_array *array, + unsigned mode, + struct object_context *context) { unsigned nr = array->nr; unsigned alloc = array->alloc; @@ -296,9 +294,28 @@ void add_object_array_with_mode(struct object *obj, const char *name, struct obj else entry->name = xstrdup(name); entry->mode = mode; + entry->context = context; array->nr = ++nr; } +void add_object_array(struct object *obj, const char *name, struct object_array *array) +{ + add_object_array_with_mode(obj, name, array, S_IFINVALID); +} + +void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode) +{ + add_object_array_with_mode_context(obj, name, array, mode, NULL); +} + +void add_object_array_with_context(struct object *obj, const char *name, struct object_array *array, struct object_context *context) +{ + if (context) + add_object_array_with_mode_context(obj, name, array, context->mode, context); + else + add_object_array_with_mode_context(obj, name, array, S_IFINVALID, context); +} + void object_array_filter(struct object_array *array, object_array_each_func_t want, void *cb_data) { |