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
This commit is contained in:
Junio C Hamano
2013-10-23 13:21:30 -07:00
14 changed files with 237 additions and 57 deletions

View File

@ -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)
{