aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-12-05 14:49:58 +0900
committerJunio C Hamano <gitster@pobox.com>2025-12-05 14:49:58 +0900
commit9d442ce2e21fc02332378c6026b011bb5ced1856 (patch)
treed2074c0ead08d882f8cd824584d0b2814c3b5a4b /t
parent1b40ddc1a5e2eecd54802c3c6c3c940b0306542a (diff)
parentac65c70663b092e823b0d3de1c1cfdee0a4fbc8e (diff)
downloadgit-9d442ce2e21fc02332378c6026b011bb5ced1856.tar.xz
Merge branch 'ps/object-source-management'
Code refactoring around object database sources. * ps/object-source-management: odb: handle recreation of quarantine directories odb: handle changing a repository's commondir chdir-notify: add function to unregister listeners odb: handle initialization of sources in `odb_new()` http-push: stop setting up `the_repository` for each reference t/helper: stop setting up `the_repository` repeatedly builtin/index-pack: fix deferred fsck outside repos oidset: introduce `oidset_equal()` odb: move logic to disable ref updates into repo odb: refactor `odb_clear()` to `odb_free()` odb: adopt logic to close object databases setup: convert `set_git_dir()` to have file scope path: move `enter_repo()` into "setup.c"
Diffstat (limited to 't')
-rw-r--r--t/helper/test-repository.c16
-rwxr-xr-xt/t5302-pack-index.sh16
2 files changed, 18 insertions, 14 deletions
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index 63c37de33d..9ba94cdffa 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -17,10 +17,6 @@ static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
struct commit *c;
struct commit_list *parent;
- setup_git_env(gitdir);
-
- repo_clear(the_repository);
-
if (repo_init(&r, gitdir, worktree))
die("Couldn't init repo");
@@ -47,10 +43,6 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
struct commit *c;
struct tree *tree;
- setup_git_env(gitdir);
-
- repo_clear(the_repository);
-
if (repo_init(&r, gitdir, worktree))
die("Couldn't init repo");
@@ -75,24 +67,20 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
int cmd__repository(int argc, const char **argv)
{
- int nongit_ok = 0;
-
- setup_git_directory_gently(&nongit_ok);
-
if (argc < 2)
die("must have at least 2 arguments");
if (!strcmp(argv[1], "parse_commit_in_graph")) {
struct object_id oid;
if (argc < 5)
die("not enough arguments");
- if (parse_oid_hex(argv[4], &oid, &argv[4]))
+ if (parse_oid_hex_any(argv[4], &oid, &argv[4]) == GIT_HASH_UNKNOWN)
die("cannot parse oid '%s'", argv[4]);
test_parse_commit_in_graph(argv[2], argv[3], &oid);
} else if (!strcmp(argv[1], "get_commit_tree_in_graph")) {
struct object_id oid;
if (argc < 5)
die("not enough arguments");
- if (parse_oid_hex(argv[4], &oid, &argv[4]))
+ if (parse_oid_hex_any(argv[4], &oid, &argv[4]) == GIT_HASH_UNKNOWN)
die("cannot parse oid '%s'", argv[4]);
test_get_commit_tree_in_graph(argv[2], argv[3], &oid);
} else {
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 413c99274c..9697448cb2 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -293,4 +293,20 @@ test_expect_success 'too-large packs report the breach' '
grep "maximum allowed size (20 bytes)" err
'
+# git-index-pack(1) uses the default hash algorithm outside of the repository,
+# and it has no way to tell it otherwise. So we can only run this test with the
+# default hash algorithm, as it would otherwise fail to parse the tree.
+test_expect_success DEFAULT_HASH_ALGORITHM 'index-pack --fsck-objects outside of a repo' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ printf "100644 blob $(test_oid 001)\t.gitattributes\n" >tree &&
+ git mktree --missing <tree >tree-oid &&
+ git pack-objects <tree-oid pack &&
+ test_must_fail nongit git index-pack --fsck-objects "$(pwd)"/pack-*.pack 2>err &&
+ test_grep "cannot perform queued object checks outside of a repository" err
+ )
+'
+
test_done