@@ -225,7 +225,9 @@ static int write_directory(struct archiver_context *c)
return ret ? -1 : 0;
}
-static int queue_or_write_archive_entry(const struct object_id *oid,
+static int queue_or_write_archive_entry(
+ struct repository *r,
+ const struct object_id *oid,
struct strbuf *base, const char *filename,
unsigned mode, void *context)
{
@@ -246,7 +248,7 @@ static int queue_or_write_archive_entry(const struct object_id *oid,
/* Borrow base, but restore its original value when done. */
strbuf_addstr(base, filename);
strbuf_addch(base, '/');
- check = get_archive_attrs(c->args->repo->index, base->buf);
+ check = get_archive_attrs(r->index, base->buf);
strbuf_setlen(base, baselen);
if (check_attr_export_ignore(check))
@@ -382,7 +384,8 @@ struct path_exists_context {
struct archiver_args *args;
};
-static int reject_entry(const struct object_id *oid UNUSED,
+static int reject_entry(
+ struct repository *r, const struct object_id *oid UNUSED,
struct strbuf *base,
const char *filename, unsigned mode,
void *context)
@@ -394,7 +397,7 @@ static int reject_entry(const struct object_id *oid UNUSED,
struct strbuf sb = STRBUF_INIT;
strbuf_addbuf(&sb, base);
strbuf_addstr(&sb, filename);
- if (!match_pathspec(ctx->args->repo->index,
+ if (!match_pathspec(r->index,
&ctx->pathspec,
sb.buf, sb.len, 0, NULL, 1))
ret = READ_TREE_RECURSIVE;
@@ -124,7 +124,9 @@ static int post_checkout_hook(struct commit *old_commit, struct commit *new_comm
}
-static int update_some(const struct object_id *oid, struct strbuf *base,
+static int update_some(
+ struct repository *r UNUSED,
+ const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, void *context UNUSED)
{
int len;
@@ -698,7 +698,9 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
return 0;
}
-static int show_tree_object(const struct object_id *oid UNUSED,
+static int show_tree_object(
+ struct repository *r UNUSED,
+ const struct object_id *oid UNUSED,
struct strbuf *base UNUSED,
const char *pathname, unsigned mode,
void *context)
@@ -533,7 +533,9 @@ static int read_one_entry_opt(struct index_state *istate,
return add_index_entry(istate, ce, opt);
}
-static int read_one_entry(const struct object_id *oid, struct strbuf *base,
+static int read_one_entry(
+ struct repository *r UNUSED,
+ const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
{
@@ -547,7 +549,9 @@ static int read_one_entry(const struct object_id *oid, struct strbuf *base,
* This is used when the caller knows there is no existing entries at
* the stage that will conflict with the entry being added.
*/
-static int read_one_entry_quick(const struct object_id *oid, struct strbuf *base,
+static int read_one_entry_quick(
+ struct repository *r UNUSED,
+ const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
{
@@ -141,8 +141,10 @@ static int show_recursive(const char *base, size_t baselen, const char *pathname
return 0;
}
-static int show_tree_fmt(const struct object_id *oid, struct strbuf *base,
- const char *pathname, unsigned mode, void *context UNUSED)
+static int show_tree_fmt(
+ struct repository *r UNUSED,
+ const struct object_id *oid, struct strbuf *base,
+ const char *pathname, unsigned mode, void *context UNUSED)
{
size_t baselen;
int recurse = 0;
@@ -211,9 +213,11 @@ static void show_tree_common_default_long(struct strbuf *base,
strbuf_setlen(base, baselen);
}
-static int show_tree_default(const struct object_id *oid, struct strbuf *base,
- const char *pathname, unsigned mode,
- void *context UNUSED)
+static int show_tree_default(
+ struct repository *r,
+ const struct object_id *oid, struct strbuf *base,
+ const char *pathname, unsigned mode,
+ void *context UNUSED)
{
int early;
int recurse;
@@ -224,12 +228,14 @@ static int show_tree_default(const struct object_id *oid, struct strbuf *base,
return early;
printf("%06o %s %s\t", data.mode, type_name(data.type),
- find_unique_abbrev(data.oid, abbrev));
+ repo_find_unique_abbrev(r, data.oid, abbrev));
show_tree_common_default_long(base, pathname, data.base->len);
return recurse;
}
-static int show_tree_long(const struct object_id *oid, struct strbuf *base,
+static int show_tree_long(
+ struct repository *r,
+ const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context UNUSED)
{
@@ -244,7 +250,7 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,
if (data.type == OBJ_BLOB) {
unsigned long size;
- if (oid_object_info(the_repository, data.oid, &size) == OBJ_BAD)
+ if (oid_object_info(r, data.oid, &size) == OBJ_BAD)
xsnprintf(size_text, sizeof(size_text), "BAD");
else
xsnprintf(size_text, sizeof(size_text),
@@ -254,12 +260,14 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,
}
printf("%06o %s %s %7s\t", data.mode, type_name(data.type),
- find_unique_abbrev(data.oid, abbrev), size_text);
+ repo_find_unique_abbrev(r, data.oid, abbrev), size_text);
show_tree_common_default_long(base, pathname, data.base->len);
return recurse;
}
-static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,
+static int show_tree_name_only(
+ struct repository *r UNUSED,
+ const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context UNUSED)
{
@@ -280,7 +288,9 @@ static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,
return recurse;
}
-static int show_tree_object(const struct object_id *oid, struct strbuf *base,
+static int show_tree_object(
+ struct repository *r,
+ const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context UNUSED)
{
@@ -292,7 +302,7 @@ static int show_tree_object(const struct object_id *oid, struct strbuf *base,
if (early >= 0)
return early;
- printf("%s%c", find_unique_abbrev(oid, abbrev), line_termination);
+ printf("%s%c", repo_find_unique_abbrev(r, oid, abbrev), line_termination);
return recurse;
}
@@ -456,7 +456,9 @@ static void unpack_trees_finish(struct merge_options *opt)
clear_unpack_trees_porcelain(&opt->priv->unpack_opts);
}
-static int save_files_dirs(const struct object_id *oid UNUSED,
+static int save_files_dirs(
+ struct repository *r UNUSED,
+ const struct object_id *oid UNUSED,
struct strbuf *base, const char *path,
unsigned int mode, void *context)
{
@@ -232,7 +232,9 @@ static void set_index_entry(struct index_state *istate, int nr, struct cache_ent
add_name_hash(istate, ce);
}
-static int add_path_to_index(const struct object_id *oid,
+static int add_path_to_index(
+ struct repository *r UNUSED,
+ const struct object_id *oid,
struct strbuf *base, const char *path,
unsigned int mode, void *context)
{
@@ -6,7 +6,8 @@ We call it tree-read-tree-at to disambiguate with the read-tree tool.
#include "test-tool.h"
#include "tree.h"
-static int test_handle_entry(const struct object_id *oid,
+static int test_handle_entry(
+ struct repository *r UNUSED, const struct object_id *oid,
struct strbuf *base, const char *filename,
unsigned mode, void *context UNUSED) {
printf("%i %s %s%s\n", mode, oid_to_hex(oid), base->buf, filename);
@@ -38,7 +38,7 @@ int read_tree_at(struct repository *r,
continue;
}
- switch (fn(&entry.oid, base,
+ switch (fn(r, &entry.oid, base,
entry.path, entry.mode, context)) {
case 0:
continue;
@@ -37,7 +37,7 @@ struct tree *repo_parse_tree_indirect(struct repository *r, const struct object_
int cmp_cache_name_compare(const void *a_, const void *b_);
#define READ_TREE_RECURSIVE 1
-typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);
+typedef int (*read_tree_fn_t)(struct repository *r, const struct object_id *, struct strbuf *, const char *, unsigned int, void *);
int read_tree_at(struct repository *r,
struct tree *tree, struct strbuf *base,
@@ -665,7 +665,9 @@ static void wt_status_collect_changes_index(struct wt_status *s)
release_revisions(&rev);
}
-static int add_file_to_list(const struct object_id *oid,
+static int add_file_to_list(
+ struct repository *r UNUSED,
+ const struct object_id *oid,
struct strbuf *base, const char *path,
unsigned int mode, void *context)
{