summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 3ce574a605..5df6537333 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -9,6 +9,7 @@
#include "builtin.h"
#include "abspath.h"
+#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "config.h"
@@ -26,7 +27,7 @@
#include "submodule-config.h"
#include "object-file.h"
#include "object-name.h"
-#include "object-store.h"
+#include "odb.h"
#include "packfile.h"
#include "pager.h"
#include "path.h"
@@ -462,7 +463,7 @@ static int grep_submodule(struct grep_opt *opt,
/*
* NEEDSWORK: repo_read_gitmodules() might call
- * add_to_alternates_memory() via config_from_gitmodules(). This
+ * odb_add_to_alternates_memory() via config_from_gitmodules(). This
* operation causes a race condition with concurrent object readings
* performed by the worker threads. That's why we need obj_read_lock()
* here. It should be removed once it's no longer necessary to add the
@@ -505,7 +506,8 @@ static int grep_submodule(struct grep_opt *opt,
* lazily registered as alternates when needed (and except in an
* unexpected code interaction, it won't be needed).
*/
- add_submodule_odb_by_path(subrepo->objects->odb->path);
+ odb_add_submodule_source_by_path(the_repository->objects,
+ subrepo->objects->sources->path);
obj_read_unlock();
memcpy(&subopt, opt, sizeof(subopt));
@@ -519,11 +521,9 @@ static int grep_submodule(struct grep_opt *opt,
struct strbuf base = STRBUF_INIT;
obj_read_lock();
- object_type = oid_object_info(subrepo, oid, NULL);
+ object_type = odb_read_object_info(subrepo->objects, oid, NULL);
obj_read_unlock();
- data = read_object_with_reference(subrepo,
- oid, OBJ_TREE,
- &size, NULL);
+ data = odb_read_object_peeled(subrepo->objects, oid, OBJ_TREE, &size, NULL);
if (!data)
die(_("unable to read tree (%s)"), oid_to_hex(oid));
@@ -572,8 +572,8 @@ static int grep_cache(struct grep_opt *opt,
void *data;
unsigned long size;
- data = repo_read_object_file(the_repository, &ce->oid,
- &type, &size);
+ data = odb_read_object(the_repository->objects, &ce->oid,
+ &type, &size);
if (!data)
die(_("unable to read tree %s"), oid_to_hex(&ce->oid));
init_tree_desc(&tree, &ce->oid, data, size);
@@ -665,8 +665,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
void *data;
unsigned long size;
- data = repo_read_object_file(the_repository,
- &entry.oid, &type, &size);
+ data = odb_read_object(the_repository->objects,
+ &entry.oid, &type, &size);
if (!data)
die(_("unable to read tree (%s)"),
oid_to_hex(&entry.oid));
@@ -704,9 +704,8 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
struct strbuf base;
int hit, len;
- data = read_object_with_reference(opt->repo,
- &obj->oid, OBJ_TREE,
- &size, NULL);
+ data = odb_read_object_peeled(opt->repo->objects, &obj->oid,
+ OBJ_TREE, &size, NULL);
if (!data)
die(_("unable to read tree (%s)"), oid_to_hex(&obj->oid));
@@ -1037,7 +1036,7 @@ int cmd_grep(int argc,
grep_prefix = prefix;
grep_init(&opt, the_repository);
- git_config(grep_cmd_config, &opt);
+ repo_config(the_repository, grep_cmd_config, &opt);
/*
* If there is no -- then the paths must exist in the working
@@ -1060,7 +1059,7 @@ int cmd_grep(int argc,
if (use_index && !startup_info->have_repository) {
int fallback = 0;
- git_config_get_bool("grep.fallbacktonoindex", &fallback);
+ repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback);
if (fallback)
use_index = 0;
else