зеркало из https://github.com/microsoft/git.git
list-objects-filter.c: remove implicit dependency on the_index
While at there, since we have access to struct repository now, eliminate the only the_repository reference in this file. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
788454576f
Коммит
01d40c8487
|
@ -34,6 +34,7 @@ struct filter_blobs_none_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum list_objects_filter_result filter_blobs_none(
|
static enum list_objects_filter_result filter_blobs_none(
|
||||||
|
struct repository *r,
|
||||||
enum list_objects_filter_situation filter_situation,
|
enum list_objects_filter_situation filter_situation,
|
||||||
struct object *obj,
|
struct object *obj,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
|
@ -88,6 +89,7 @@ struct filter_trees_none_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum list_objects_filter_result filter_trees_none(
|
static enum list_objects_filter_result filter_trees_none(
|
||||||
|
struct repository *r,
|
||||||
enum list_objects_filter_situation filter_situation,
|
enum list_objects_filter_situation filter_situation,
|
||||||
struct object *obj,
|
struct object *obj,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
|
@ -144,6 +146,7 @@ struct filter_blobs_limit_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum list_objects_filter_result filter_blobs_limit(
|
static enum list_objects_filter_result filter_blobs_limit(
|
||||||
|
struct repository *r,
|
||||||
enum list_objects_filter_situation filter_situation,
|
enum list_objects_filter_situation filter_situation,
|
||||||
struct object *obj,
|
struct object *obj,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
|
@ -171,7 +174,7 @@ static enum list_objects_filter_result filter_blobs_limit(
|
||||||
assert(obj->type == OBJ_BLOB);
|
assert(obj->type == OBJ_BLOB);
|
||||||
assert((obj->flags & SEEN) == 0);
|
assert((obj->flags & SEEN) == 0);
|
||||||
|
|
||||||
t = oid_object_info(the_repository, &obj->oid, &object_length);
|
t = oid_object_info(r, &obj->oid, &object_length);
|
||||||
if (t != OBJ_BLOB) { /* probably OBJ_NONE */
|
if (t != OBJ_BLOB) { /* probably OBJ_NONE */
|
||||||
/*
|
/*
|
||||||
* We DO NOT have the blob locally, so we cannot
|
* We DO NOT have the blob locally, so we cannot
|
||||||
|
@ -249,6 +252,7 @@ struct filter_sparse_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum list_objects_filter_result filter_sparse(
|
static enum list_objects_filter_result filter_sparse(
|
||||||
|
struct repository *r,
|
||||||
enum list_objects_filter_situation filter_situation,
|
enum list_objects_filter_situation filter_situation,
|
||||||
struct object *obj,
|
struct object *obj,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
|
@ -268,7 +272,7 @@ static enum list_objects_filter_result filter_sparse(
|
||||||
dtype = DT_DIR;
|
dtype = DT_DIR;
|
||||||
val = is_excluded_from_list(pathname, strlen(pathname),
|
val = is_excluded_from_list(pathname, strlen(pathname),
|
||||||
filename, &dtype, &filter_data->el,
|
filename, &dtype, &filter_data->el,
|
||||||
&the_index);
|
r->index);
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
val = filter_data->array_frame[filter_data->nr].defval;
|
val = filter_data->array_frame[filter_data->nr].defval;
|
||||||
|
|
||||||
|
@ -331,7 +335,7 @@ static enum list_objects_filter_result filter_sparse(
|
||||||
dtype = DT_REG;
|
dtype = DT_REG;
|
||||||
val = is_excluded_from_list(pathname, strlen(pathname),
|
val = is_excluded_from_list(pathname, strlen(pathname),
|
||||||
filename, &dtype, &filter_data->el,
|
filename, &dtype, &filter_data->el,
|
||||||
&the_index);
|
r->index);
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
val = frame->defval;
|
val = frame->defval;
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
struct list_objects_filter_options;
|
struct list_objects_filter_options;
|
||||||
struct object;
|
struct object;
|
||||||
struct oidset;
|
struct oidset;
|
||||||
|
struct repository;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* During list-object traversal we allow certain objects to be
|
* During list-object traversal we allow certain objects to be
|
||||||
|
@ -60,6 +61,7 @@ enum list_objects_filter_situation {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum list_objects_filter_result (*filter_object_fn)(
|
typedef enum list_objects_filter_result (*filter_object_fn)(
|
||||||
|
struct repository *r,
|
||||||
enum list_objects_filter_situation filter_situation,
|
enum list_objects_filter_situation filter_situation,
|
||||||
struct object *obj,
|
struct object *obj,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
|
|
|
@ -55,7 +55,8 @@ static void process_blob(struct traversal_context *ctx,
|
||||||
pathlen = path->len;
|
pathlen = path->len;
|
||||||
strbuf_addstr(path, name);
|
strbuf_addstr(path, name);
|
||||||
if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
|
if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
|
||||||
r = ctx->filter_fn(LOFS_BLOB, obj,
|
r = ctx->filter_fn(ctx->revs->repo,
|
||||||
|
LOFS_BLOB, obj,
|
||||||
path->buf, &path->buf[pathlen],
|
path->buf, &path->buf[pathlen],
|
||||||
ctx->filter_data);
|
ctx->filter_data);
|
||||||
if (r & LOFR_MARK_SEEN)
|
if (r & LOFR_MARK_SEEN)
|
||||||
|
@ -175,7 +176,8 @@ static void process_tree(struct traversal_context *ctx,
|
||||||
|
|
||||||
strbuf_addstr(base, name);
|
strbuf_addstr(base, name);
|
||||||
if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
|
if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
|
||||||
r = ctx->filter_fn(LOFS_BEGIN_TREE, obj,
|
r = ctx->filter_fn(ctx->revs->repo,
|
||||||
|
LOFS_BEGIN_TREE, obj,
|
||||||
base->buf, &base->buf[baselen],
|
base->buf, &base->buf[baselen],
|
||||||
ctx->filter_data);
|
ctx->filter_data);
|
||||||
if (r & LOFR_MARK_SEEN)
|
if (r & LOFR_MARK_SEEN)
|
||||||
|
@ -191,7 +193,8 @@ static void process_tree(struct traversal_context *ctx,
|
||||||
process_tree_contents(ctx, tree, base);
|
process_tree_contents(ctx, tree, base);
|
||||||
|
|
||||||
if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn) {
|
if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn) {
|
||||||
r = ctx->filter_fn(LOFS_END_TREE, obj,
|
r = ctx->filter_fn(ctx->revs->repo,
|
||||||
|
LOFS_END_TREE, obj,
|
||||||
base->buf, &base->buf[baselen],
|
base->buf, &base->buf[baselen],
|
||||||
ctx->filter_data);
|
ctx->filter_data);
|
||||||
if (r & LOFR_MARK_SEEN)
|
if (r & LOFR_MARK_SEEN)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче