summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-17 20:25:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-17 20:25:20 (GMT)
commitdec040192fde87fb3249a3d53f802decd84fa7b7 (patch)
tree7c73c3807033b62c98368ff2d3ca8ecbf20177b9 /submodule.c
parentaf9a70c8de7b1d45ecd0bbb1379c5c3e911a9dcd (diff)
parentea0fc3b4176a424a2b20eb76a6a503dc4d59cebb (diff)
downloadgit-dec040192fde87fb3249a3d53f802decd84fa7b7.zip
git-dec040192fde87fb3249a3d53f802decd84fa7b7.tar.gz
git-dec040192fde87fb3249a3d53f802decd84fa7b7.tar.bz2
Merge branch 'jk/alt-odb-cleanup'
Codepaths involved in interacting alternate object store have been cleaned up. * jk/alt-odb-cleanup: alternates: use fspathcmp to detect duplicates sha1_file: always allow relative paths to alternates count-objects: report alternates via verbose mode fill_sha1_file: write into a strbuf alternates: store scratch buffer as strbuf fill_sha1_file: write "boring" characters alternates: use a separate scratch space alternates: encapsulate alt->base munging alternates: provide helper for allocating alternate alternates: provide helper for adding to alternates list link_alt_odb_entry: refactor string handling link_alt_odb_entry: handle normalize_path errors t5613: clarify "too deep" recursion tests t5613: do not chdir in main process t5613: whitespace/style cleanups t5613: use test_must_fail t5613: drop test_valid_repo function t5613: drop reachable_via function
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/submodule.c b/submodule.c
index 2de06a3..7333320 100644
--- a/submodule.c
+++ b/submodule.c
@@ -123,9 +123,7 @@ void stage_updated_gitmodules(void)
static int add_submodule_odb(const char *path)
{
struct strbuf objects_directory = STRBUF_INIT;
- struct alternate_object_database *alt_odb;
int ret = 0;
- size_t alloc;
ret = strbuf_git_path_submodule(&objects_directory, path, "objects/");
if (ret)
@@ -134,26 +132,7 @@ static int add_submodule_odb(const char *path)
ret = -1;
goto done;
}
- /* avoid adding it twice */
- prepare_alt_odb();
- for (alt_odb = alt_odb_list; alt_odb; alt_odb = alt_odb->next)
- if (alt_odb->name - alt_odb->base == objects_directory.len &&
- !strncmp(alt_odb->base, objects_directory.buf,
- objects_directory.len))
- goto done;
-
- alloc = st_add(objects_directory.len, 42); /* for "12/345..." sha1 */
- alt_odb = xmalloc(st_add(sizeof(*alt_odb), alloc));
- alt_odb->next = alt_odb_list;
- xsnprintf(alt_odb->base, alloc, "%s", objects_directory.buf);
- alt_odb->name = alt_odb->base + objects_directory.len;
- alt_odb->name[2] = '/';
- alt_odb->name[40] = '\0';
- alt_odb->name[41] = '\0';
- alt_odb_list = alt_odb;
-
- /* add possible alternates from the submodule */
- read_info_alternates(objects_directory.buf, 0);
+ add_to_alternates_memory(objects_directory.buf);
done:
strbuf_release(&objects_directory);
return ret;