summaryrefslogtreecommitdiff
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-04 21:33:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-04 21:33:32 (GMT)
commit3b2f8a02fa9a9e68d5215828e1d97bb4f6996976 (patch)
tree95480e645fe16f17fd9ccc43a893699476b60a63 /builtin/submodule--helper.c
parent13d991929810ebfdf6b75d91cdc72561213d548a (diff)
parent7317aa7153c063a01750cda625e1a4580af89ef3 (diff)
downloadgit-3b2f8a02fa9a9e68d5215828e1d97bb4f6996976.zip
git-3b2f8a02fa9a9e68d5215828e1d97bb4f6996976.tar.gz
git-3b2f8a02fa9a9e68d5215828e1d97bb4f6996976.tar.bz2
Merge branch 'jk/loose-object-cache'
Code clean-up with optimization for the codepath that checks (non-)existence of loose objects. * jk/loose-object-cache: odb_load_loose_cache: fix strbuf leak fetch-pack: drop custom loose object cache sha1-file: use loose object cache for quick existence check object-store: provide helpers for loose_objects_cache sha1-file: use an object_directory for the main object dir handle alternates paths the same as the main object dir sha1_file_name(): overwrite buffer instead of appending rename "alternate_object_database" to "object_directory" submodule--helper: prefer strip_suffix() to ends_with() fsck: do not reuse child_process structs
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d38113a..b45514b 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1265,19 +1265,20 @@ struct submodule_alternate_setup {
SUBMODULE_ALTERNATE_ERROR_IGNORE, NULL }
static int add_possible_reference_from_superproject(
- struct alternate_object_database *alt, void *sas_cb)
+ struct object_directory *odb, void *sas_cb)
{
struct submodule_alternate_setup *sas = sas_cb;
+ size_t len;
/*
* If the alternate object store is another repository, try the
* standard layout with .git/(modules/<name>)+/objects
*/
- if (ends_with(alt->path, "/objects")) {
+ if (strip_suffix(odb->path, "/objects", &len)) {
char *sm_alternate;
struct strbuf sb = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
- strbuf_add(&sb, alt->path, strlen(alt->path) - strlen("objects"));
+ strbuf_add(&sb, odb->path, len);
/*
* We need to end the new path with '/' to mark it as a dir,
@@ -1285,7 +1286,7 @@ static int add_possible_reference_from_superproject(
* as the last part of a missing submodule reference would
* be taken as a file name.
*/
- strbuf_addf(&sb, "modules/%s/", sas->submodule_name);
+ strbuf_addf(&sb, "/modules/%s/", sas->submodule_name);
sm_alternate = compute_alternate_path(sb.buf, &err);
if (sm_alternate) {