diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2020-02-16 02:00:56 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-11-27 11:40:02 +0000 |
| commit | f847fa7b34abdc7850b8739747e1d25eefafa5f2 (patch) | |
| tree | ac8b28e09c7563a05196f4d354e065b5faaafc0a /tests/pack | |
| parent | fa618a595bff675fa1d001dc9d57f8fd6c1b052e (diff) | |
| download | libgit2-f847fa7b34abdc7850b8739747e1d25eefafa5f2.tar.gz | |
midx: Support multi-pack-index files in odb_pack.c
This change adds support for reading multi-pack-index files from the
packfile odb backend. This also makes git_pack_file objects open their
backing failes lazily in more scenarios, since the multi-pack-index can
avoid having to open them in some cases (yay!).
This change also refreshes the documentation found in src/odb_pack.c to
match the updated code.
Part of: #5399
Diffstat (limited to 'tests/pack')
| -rw-r--r-- | tests/pack/midx.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/pack/midx.c b/tests/pack/midx.c index 1f47d9502..92d9ae24c 100644 --- a/tests/pack/midx.c +++ b/tests/pack/midx.c @@ -27,3 +27,19 @@ void test_pack_midx__parse(void) git_repository_free(repo); git_buf_dispose(&midx_path); } + +void test_pack_midx__lookup(void) +{ + git_repository *repo; + git_commit *commit; + git_oid id; + + cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); + + cl_git_pass(git_oid_fromstr(&id, "5001298e0c09ad9c34e4249bc5801c75e9754fa5")); + cl_git_pass(git_commit_lookup_prefix(&commit, repo, &id, GIT_OID_HEXSZ)); + cl_assert_equal_s(git_commit_message(commit), "packed commit one\n"); + + git_commit_free(commit); + git_repository_free(repo); +} |
