167
168
static struct string_list added_submodule_odb_paths = STRING_LIST_INIT_NODUP;
169
170
-/* TODO: remove this function, use repo_submodule_init instead. */
171
-int add_submodule_odb(const char *path)
172
-{
173
- struct strbuf objects_directory = STRBUF_INIT;
174
- int ret = 0;
175
-
176
- ret = strbuf_git_path_submodule(&objects_directory, path, "objects/");
177
- if (ret)
178
- goto done;
179
- if (!is_directory(objects_directory.buf)) {
180
- ret = -1;
181
- goto done;
182
- }
183
- string_list_insert(&added_submodule_odb_paths,
184
- strbuf_detach(&objects_directory, NULL));
185
-done:
186
- strbuf_release(&objects_directory);
187
- return ret;
188
-}
189
-
170
void add_submodule_odb_by_path(const char *path)
171
{
172
string_list_insert(&added_submodule_odb_paths, xstrdup(path));
966
967
if (repo_submodule_init(&subrepo, cb->repo, cb->path, cb->super_oid)) {
968
cb->result = 0;
989
- goto cleanup;
969
+ /* subrepo failed to init, so don't clean it up. */
970
+ return 0;
971
}
972
973
type = oid_object_info(&subrepo, oid, NULL);
1003
.super_oid = super_oid
1004
};
1005
1025
- /*
1026
- * Perform a cheap, but incorrect check for the existence of 'commits'.
1027
- * This is done by adding the submodule's object store to the in-core
1028
- * object store, and then querying for each commit's existence. If we
1029
- * do not have the commit object anywhere, there is no chance we have
1030
- * it in the object store of the correct submodule and have it
1031
- * reachable from a ref, so we can fail early without spawning rev-list
1032
- * which is expensive.
1033
- */
1034
- if (add_submodule_odb(path))
1035
- return 0;
1036
-
1006
oid_array_for_each_unique(commits, check_has_commit, &has_commit);
1007
1008
if (has_commit.result) {