summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/resources/pack-odb/info/packs2
-rw-r--r--tests/resources/testrepo.git/HEAD0
-rw-r--r--tests/resources/testrepo.git/index (renamed from tests/resources/index)bin10041 -> 10041 bytes
-rw-r--r--tests/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 (renamed from tests/resources/sample-odb/13/85f264afb75a56a5bec74243be9b367ba4ca08)bin19 -> 19 bytes
-rw-r--r--tests/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 (renamed from tests/resources/sample-odb/18/1037049a54a1eb5fab404658a3a250b44335d7)bin51 -> 51 bytes
-rw-r--r--tests/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd (renamed from tests/resources/sample-odb/18/10dff58d8a660512d4832e740f692884338ccd)bin119 -> 119 bytes
-rw-r--r--tests/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 (renamed from tests/resources/sample-odb/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057)bin18 -> 18 bytes
-rw-r--r--tests/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 (renamed from tests/resources/sample-odb/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045)0
-rw-r--r--tests/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 (renamed from tests/resources/sample-odb/5b/5b025afb0b4c913b4c338a42934a3863bf3644)0
-rw-r--r--tests/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a (renamed from tests/resources/sample-odb/75/057dd4114e74cca1d750d0aee1647c903cb60a)bin119 -> 119 bytes
-rw-r--r--tests/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980 (renamed from tests/resources/pack-odb/7b/4384978d2493e851f9cca7858815fac9b10980)bin145 -> 145 bytes
-rw-r--r--tests/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d (renamed from tests/resources/sample-odb/81/4889a078c031f61ed08ab5fa863aea9314344d)bin82 -> 82 bytes
-rw-r--r--tests/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 (renamed from tests/resources/sample-odb/84/96071c1b46c854b31185ea97743be6a8774479)bin126 -> 126 bytes
-rw-r--r--tests/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a (renamed from tests/resources/sample-odb/9f/d738e8f7967c078dceed8190330fc8648ee56a)0
-rw-r--r--tests/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f (renamed from tests/resources/sample-odb/a4/a7dce85cf63874e984719f4fdd239f5145052f)0
-rw-r--r--tests/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd (renamed from tests/resources/sample-odb/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd)bin28 -> 28 bytes
-rw-r--r--tests/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 (renamed from tests/resources/sample-odb/a8/233120f6ad708f843d861ce2b7228ec4e3dec6)bin26 -> 26 bytes
-rw-r--r--tests/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1 (renamed from tests/resources/pack-odb/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1)0
-rw-r--r--tests/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 (renamed from tests/resources/sample-odb/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644)0
-rw-r--r--tests/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd (renamed from tests/resources/sample-odb/c4/7800c7266a2be04c571c04d5a6614691ea99bd)0
-rw-r--r--tests/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 (renamed from tests/resources/sample-odb/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391)bin15 -> 15 bytes
-rw-r--r--tests/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 (renamed from tests/resources/sample-odb/f6/0079018b664e4e79329a7ef9559c8d9e0378d1)bin82 -> 82 bytes
-rw-r--r--tests/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 (renamed from tests/resources/sample-odb/fa/49b077972391ad58037050f2a75f74e3671e92)bin24 -> 24 bytes
-rw-r--r--tests/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 (renamed from tests/resources/sample-odb/fd/093bff70906175335656e6ce6ae05783708765)bin82 -> 82 bytes
-rw-r--r--tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx (renamed from tests/resources/pack-odb/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx)bin46656 -> 46656 bytes
-rw-r--r--tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack (renamed from tests/resources/pack-odb/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack)bin386089 -> 386089 bytes
-rw-r--r--tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx (renamed from tests/resources/sample-odb/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx)bin1240 -> 1240 bytes
-rw-r--r--tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack (renamed from tests/resources/sample-odb/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack)bin491 -> 491 bytes
-rw-r--r--tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx (renamed from tests/resources/pack-odb/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx)bin1240 -> 1240 bytes
-rw-r--r--tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack (renamed from tests/resources/pack-odb/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack)bin498 -> 498 bytes
-rw-r--r--tests/t0204-readpack.c2
-rw-r--r--tests/t0205-readheader.c7
-rw-r--r--tests/t0401-parse.c9
-rw-r--r--tests/t0402-details.c8
-rw-r--r--tests/t0403-write.c18
-rw-r--r--tests/t0501-walk.c7
-rw-r--r--tests/t0601-read.c12
-rw-r--r--tests/t0602-write.c4
-rw-r--r--tests/t0603-sort.c4
-rw-r--r--tests/t0801-readtag.c7
-rw-r--r--tests/t0802-write.c9
-rw-r--r--tests/t0901-readtree.c14
-rw-r--r--tests/t0902-modify.c20
-rw-r--r--tests/test_helpers.c19
-rw-r--r--tests/test_helpers.h2
45 files changed, 42 insertions, 102 deletions
diff --git a/tests/resources/pack-odb/info/packs b/tests/resources/pack-odb/info/packs
deleted file mode 100644
index 895b1c3b3..000000000
--- a/tests/resources/pack-odb/info/packs
+++ /dev/null
@@ -1,2 +0,0 @@
-P pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
-
diff --git a/tests/resources/testrepo.git/HEAD b/tests/resources/testrepo.git/HEAD
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/resources/testrepo.git/HEAD
diff --git a/tests/resources/index b/tests/resources/testrepo.git/index
index a27fb9c96..a27fb9c96 100644
--- a/tests/resources/index
+++ b/tests/resources/testrepo.git/index
Binary files differ
diff --git a/tests/resources/sample-odb/13/85f264afb75a56a5bec74243be9b367ba4ca08 b/tests/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
index cedb2a22e..cedb2a22e 100644
--- a/tests/resources/sample-odb/13/85f264afb75a56a5bec74243be9b367ba4ca08
+++ b/tests/resources/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
Binary files differ
diff --git a/tests/resources/sample-odb/18/1037049a54a1eb5fab404658a3a250b44335d7 b/tests/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
index 93a16f146..93a16f146 100644
--- a/tests/resources/sample-odb/18/1037049a54a1eb5fab404658a3a250b44335d7
+++ b/tests/resources/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7
Binary files differ
diff --git a/tests/resources/sample-odb/18/10dff58d8a660512d4832e740f692884338ccd b/tests/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd
index ba0bfb30c..ba0bfb30c 100644
--- a/tests/resources/sample-odb/18/10dff58d8a660512d4832e740f692884338ccd
+++ b/tests/resources/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd
Binary files differ
diff --git a/tests/resources/sample-odb/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 b/tests/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
index 7ca4ceed5..7ca4ceed5 100644
--- a/tests/resources/sample-odb/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
+++ b/tests/resources/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
Binary files differ
diff --git a/tests/resources/sample-odb/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 b/tests/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
index 8953b6cef..8953b6cef 100644
--- a/tests/resources/sample-odb/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
+++ b/tests/resources/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045
diff --git a/tests/resources/sample-odb/5b/5b025afb0b4c913b4c338a42934a3863bf3644 b/tests/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
index c1f22c54f..c1f22c54f 100644
--- a/tests/resources/sample-odb/5b/5b025afb0b4c913b4c338a42934a3863bf3644
+++ b/tests/resources/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644
diff --git a/tests/resources/sample-odb/75/057dd4114e74cca1d750d0aee1647c903cb60a b/tests/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
index 2ef4faa0f..2ef4faa0f 100644
--- a/tests/resources/sample-odb/75/057dd4114e74cca1d750d0aee1647c903cb60a
+++ b/tests/resources/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
Binary files differ
diff --git a/tests/resources/pack-odb/7b/4384978d2493e851f9cca7858815fac9b10980 b/tests/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980
index 23c462f34..23c462f34 100644
--- a/tests/resources/pack-odb/7b/4384978d2493e851f9cca7858815fac9b10980
+++ b/tests/resources/testrepo.git/objects/7b/4384978d2493e851f9cca7858815fac9b10980
Binary files differ
diff --git a/tests/resources/sample-odb/81/4889a078c031f61ed08ab5fa863aea9314344d b/tests/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
index 2f9b6b6e3..2f9b6b6e3 100644
--- a/tests/resources/sample-odb/81/4889a078c031f61ed08ab5fa863aea9314344d
+++ b/tests/resources/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d
Binary files differ
diff --git a/tests/resources/sample-odb/84/96071c1b46c854b31185ea97743be6a8774479 b/tests/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479
index 5df58dda5..5df58dda5 100644
--- a/tests/resources/sample-odb/84/96071c1b46c854b31185ea97743be6a8774479
+++ b/tests/resources/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479
Binary files differ
diff --git a/tests/resources/sample-odb/9f/d738e8f7967c078dceed8190330fc8648ee56a b/tests/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
index a79612435..a79612435 100644
--- a/tests/resources/sample-odb/9f/d738e8f7967c078dceed8190330fc8648ee56a
+++ b/tests/resources/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a
diff --git a/tests/resources/sample-odb/a4/a7dce85cf63874e984719f4fdd239f5145052f b/tests/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
index f8588696b..f8588696b 100644
--- a/tests/resources/sample-odb/a4/a7dce85cf63874e984719f4fdd239f5145052f
+++ b/tests/resources/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f
diff --git a/tests/resources/sample-odb/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd b/tests/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
index d0d7e736e..d0d7e736e 100644
--- a/tests/resources/sample-odb/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
+++ b/tests/resources/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
Binary files differ
diff --git a/tests/resources/sample-odb/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 b/tests/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
index 18a7f61c2..18a7f61c2 100644
--- a/tests/resources/sample-odb/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
+++ b/tests/resources/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
Binary files differ
diff --git a/tests/resources/pack-odb/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1 b/tests/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
index f460f2547..f460f2547 100644
--- a/tests/resources/pack-odb/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
+++ b/tests/resources/testrepo.git/objects/b2/5fa35b38051e4ae45d4222e795f9df2e43f1d1
diff --git a/tests/resources/sample-odb/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 b/tests/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
index 0817229bc..0817229bc 100644
--- a/tests/resources/sample-odb/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
+++ b/tests/resources/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644
diff --git a/tests/resources/sample-odb/c4/7800c7266a2be04c571c04d5a6614691ea99bd b/tests/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
index 75f541f10..75f541f10 100644
--- a/tests/resources/sample-odb/c4/7800c7266a2be04c571c04d5a6614691ea99bd
+++ b/tests/resources/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd
diff --git a/tests/resources/sample-odb/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
index 711223894..711223894 100644
--- a/tests/resources/sample-odb/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
+++ b/tests/resources/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
Binary files differ
diff --git a/tests/resources/sample-odb/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 b/tests/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
index 03770969a..03770969a 100644
--- a/tests/resources/sample-odb/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
+++ b/tests/resources/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
Binary files differ
diff --git a/tests/resources/sample-odb/fa/49b077972391ad58037050f2a75f74e3671e92 b/tests/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92
index 112998d42..112998d42 100644
--- a/tests/resources/sample-odb/fa/49b077972391ad58037050f2a75f74e3671e92
+++ b/tests/resources/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92
Binary files differ
diff --git a/tests/resources/sample-odb/fd/093bff70906175335656e6ce6ae05783708765 b/tests/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765
index 12bf5f3e3..12bf5f3e3 100644
--- a/tests/resources/sample-odb/fd/093bff70906175335656e6ce6ae05783708765
+++ b/tests/resources/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765
Binary files differ
diff --git a/tests/resources/pack-odb/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx b/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx
index 5068f2818..5068f2818 100644
--- a/tests/resources/pack-odb/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx
+++ b/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.idx
Binary files differ
diff --git a/tests/resources/pack-odb/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack b/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack
index a6a1f3020..a6a1f3020 100644
--- a/tests/resources/pack-odb/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack
+++ b/tests/resources/testrepo.git/objects/pack/pack-a81e489679b7d3418f9ab594bda8ceb37dd4c695.pack
Binary files differ
diff --git a/tests/resources/sample-odb/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx b/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
index 94c3c71da..94c3c71da 100644
--- a/tests/resources/sample-odb/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
+++ b/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx
Binary files differ
diff --git a/tests/resources/sample-odb/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack b/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
index 74c7fe4f3..74c7fe4f3 100644
--- a/tests/resources/sample-odb/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
+++ b/tests/resources/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack
Binary files differ
diff --git a/tests/resources/pack-odb/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx b/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx
index 555cfa977..555cfa977 100644
--- a/tests/resources/pack-odb/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx
+++ b/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.idx
Binary files differ
diff --git a/tests/resources/pack-odb/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack b/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
index 4d539ed0a..4d539ed0a 100644
--- a/tests/resources/pack-odb/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
+++ b/tests/resources/testrepo.git/objects/pack/pack-d85f5d483273108c9d8dd0e4728ccf0b2982423a.pack
Binary files differ
diff --git a/tests/t0204-readpack.c b/tests/t0204-readpack.c
index 8310ea3d9..44694543a 100644
--- a/tests/t0204-readpack.c
+++ b/tests/t0204-readpack.c
@@ -2,8 +2,6 @@
#include "test_helpers.h"
#include <git/odb.h>
-#define ODB_FOLDER "../resources/pack-odb"
-
static const char *packed_objects[] = {
"0266163a49e280c4f5ed1e08facd36a2bd716bcf",
"53fc32d17276939fc79ed05badaef2db09990016",
diff --git a/tests/t0205-readheader.c b/tests/t0205-readheader.c
index f1fc0e7aa..626c5a5ac 100644
--- a/tests/t0205-readheader.c
+++ b/tests/t0205-readheader.c
@@ -2,9 +2,6 @@
#include "test_helpers.h"
#include <git/odb.h>
-#define PACK_ODB_FOLDER "../resources/pack-odb"
-#define LOOSE_ODB_FOLDER "../resources/sample-odb"
-
static const char *packed_objects[] = {
"0266163a49e280c4f5ed1e08facd36a2bd716bcf",
"53fc32d17276939fc79ed05badaef2db09990016",
@@ -161,7 +158,7 @@ BEGIN_TEST(readheader_packed_test)
unsigned int i;
git_odb *db;
- must_pass(git_odb_open(&db, PACK_ODB_FOLDER));
+ must_pass(git_odb_open(&db, ODB_FOLDER));
for (i = 0; i < ARRAY_SIZE(packed_objects); ++i) {
git_oid id;
@@ -186,7 +183,7 @@ BEGIN_TEST(readheader_loose_test)
unsigned int i;
git_odb *db;
- must_pass(git_odb_open(&db, LOOSE_ODB_FOLDER));
+ must_pass(git_odb_open(&db, ODB_FOLDER));
for (i = 0; i < ARRAY_SIZE(loose_objects); ++i) {
git_oid id;
diff --git a/tests/t0401-parse.c b/tests/t0401-parse.c
index 06427a185..1a2806bf1 100644
--- a/tests/t0401-parse.c
+++ b/tests/t0401-parse.c
@@ -6,8 +6,6 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/pack-odb";
-
static char *test_commits_broken[] = {
/* empty commit */
@@ -225,11 +223,8 @@ BEGIN_TEST(parse_buffer_test)
int i;
git_repository *repo;
- git_odb *db;
-
- must_pass(git_odb_open(&db, odb_dir));
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
for (i = 0; i < broken_commit_count; ++i) {
@@ -265,6 +260,4 @@ BEGIN_TEST(parse_buffer_test)
}
git_repository_free(repo);
- git_odb_close(db);
-
END_TEST
diff --git a/tests/t0402-details.c b/tests/t0402-details.c
index 1e002942b..d60b6481b 100644
--- a/tests/t0402-details.c
+++ b/tests/t0402-details.c
@@ -7,7 +7,6 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/sample-odb";
static const char *commit_ids[] = {
"a4a7dce85cf63874e984719f4fdd239f5145052f", /* 0 */
"9fd738e8f7967c078dceed8190330fc8648ee56a", /* 1 */
@@ -21,14 +20,10 @@ BEGIN_TEST(query_details_test)
const size_t commit_count = sizeof(commit_ids) / sizeof(const char *);
unsigned int i;
- git_odb *db;
git_repository *repo;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
-
for (i = 0; i < commit_count; ++i) {
git_oid id;
@@ -59,5 +54,4 @@ BEGIN_TEST(query_details_test)
}
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/t0403-write.c b/tests/t0403-write.c
index d4669e0ed..60133c409 100644
--- a/tests/t0403-write.c
+++ b/tests/t0403-write.c
@@ -6,7 +6,6 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/sample-odb";
static const char *commit_ids[] = {
"a4a7dce85cf63874e984719f4fdd239f5145052f", /* 0 */
"9fd738e8f7967c078dceed8190330fc8648ee56a", /* 1 */
@@ -21,16 +20,13 @@ static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
#define COMMITTER_EMAIL "vicent@github.com"
BEGIN_TEST(writenew_test)
- git_odb *db;
git_repository *repo;
git_commit *commit, *parent;
git_tree *tree;
git_oid id;
/* char hex_oid[41]; */
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
/* Create commit in memory */
@@ -71,27 +67,22 @@ This is a commit created in memory and it will be written back to disk\n");
printf("Written new commit, SHA1: %s\n", hex_oid);
*/
- must_pass(remove_loose_object(odb_dir, (git_object *)commit));
+ must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit));
//git_person_free(&author);
//git_person_free(&committer);
git_repository_free(repo);
- git_odb_close(db);
-
END_TEST
BEGIN_TEST(writeback_test)
- git_odb *db;
git_repository *repo;
git_oid id;
git_commit *commit, *parent;
const char *message;
/* char hex_oid[41]; */
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, commit_ids[0]);
@@ -123,8 +114,7 @@ BEGIN_TEST(writeback_test)
printf("New SHA1: %s\n", hex_oid);
*/
- must_pass(remove_loose_object(odb_dir, (git_object *)commit));
+ must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit));
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/t0501-walk.c b/tests/t0501-walk.c
index 9aa7261d2..55ae936d2 100644
--- a/tests/t0501-walk.c
+++ b/tests/t0501-walk.c
@@ -6,7 +6,6 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/sample-odb";
/*
$ git log --oneline --graph --decorate
* a4a7dce (HEAD, br2) Merge branch 'master' into br2
@@ -91,15 +90,12 @@ static int test_walk(git_revwalk *walk, git_commit *start_from,
}
BEGIN_TEST(simple_walk_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_revwalk *walk;
git_commit *head = NULL;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
walk = git_revwalk_alloc(repo);
@@ -130,5 +126,4 @@ BEGIN_TEST(simple_walk_test)
git_revwalk_free(walk);
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/t0601-read.c b/tests/t0601-read.c
index 4c31be9c3..345e5b534 100644
--- a/tests/t0601-read.c
+++ b/tests/t0601-read.c
@@ -5,7 +5,7 @@
#include <git/odb.h>
#include <git/index.h>
-#define TEST_INDEX_PATH "../resources/index"
+#define TEST_INDEX_PATH "../resources/testrepo.git/index"
#define TEST_INDEX2_PATH "../resources/gitgit.index"
#define TEST_INDEX_ENTRY_COUNT 109
@@ -29,7 +29,7 @@ struct test_entry TEST_ENTRIES[] = {
BEGIN_TEST(index_loadempty_test)
git_index *index;
- index = git_index_alloc("in-memory-index");
+ index = git_index_alloc("in-memory-index", NULL);
must_be_true(index != NULL);
must_be_true(index->on_disk == 0);
@@ -46,7 +46,7 @@ BEGIN_TEST(index_load_test)
git_index *index;
unsigned int i;
- index = git_index_alloc(TEST_INDEX_PATH);
+ index = git_index_alloc(TEST_INDEX_PATH, NULL);
must_be_true(index != NULL);
must_be_true(index->on_disk);
@@ -70,7 +70,7 @@ END_TEST
BEGIN_TEST(index2_load_test)
git_index *index;
- index = git_index_alloc(TEST_INDEX2_PATH);
+ index = git_index_alloc(TEST_INDEX2_PATH, NULL);
must_be_true(index != NULL);
must_be_true(index->on_disk);
@@ -88,7 +88,7 @@ BEGIN_TEST(index_find_test)
git_index *index;
unsigned int i;
- index = git_index_alloc(TEST_INDEX_PATH);
+ index = git_index_alloc(TEST_INDEX_PATH, NULL);
must_be_true(index != NULL);
must_pass(git_index_read(index));
@@ -104,7 +104,7 @@ BEGIN_TEST(index_findempty_test)
git_index *index;
unsigned int i;
- index = git_index_alloc("fake-index");
+ index = git_index_alloc("fake-index", NULL);
must_be_true(index != NULL);
for (i = 0; i < ARRAY_SIZE(TEST_ENTRIES); ++i) {
diff --git a/tests/t0602-write.c b/tests/t0602-write.c
index c5e5c7d94..d232193b7 100644
--- a/tests/t0602-write.c
+++ b/tests/t0602-write.c
@@ -5,7 +5,7 @@
#include <git/odb.h>
#include <git/index.h>
-#define TEST_INDEX_PATH "../resources/index"
+#define TEST_INDEX_PATH "../resources/testrepo.git/index"
int filecmp(const char *filename1, const char *filename2)
{
@@ -35,7 +35,7 @@ BEGIN_TEST(index_load_test)
git_index *index;
git_filelock out_file;
- index = git_index_alloc(TEST_INDEX_PATH);
+ index = git_index_alloc(TEST_INDEX_PATH, NULL);
must_be_true(index != NULL);
must_pass(git_index_read(index));
must_be_true(index->on_disk);
diff --git a/tests/t0603-sort.c b/tests/t0603-sort.c
index 28292377a..dfbb6e175 100644
--- a/tests/t0603-sort.c
+++ b/tests/t0603-sort.c
@@ -36,7 +36,7 @@ BEGIN_TEST(index_sort_test)
git_index *index;
unsigned int i;
- index = git_index_alloc(TEST_INDEX_PATH);
+ index = git_index_alloc(TEST_INDEX_PATH, NULL);
must_be_true(index != NULL);
must_pass(git_index_read(index));
@@ -54,7 +54,7 @@ END_TEST
BEGIN_TEST(index_sort_empty_test)
git_index *index;
- index = git_index_alloc("fake-index");
+ index = git_index_alloc("fake-index", NULL);
must_be_true(index != NULL);
git_index__sort(index);
diff --git a/tests/t0801-readtag.c b/tests/t0801-readtag.c
index 9e675e8b7..798fa8f49 100644
--- a/tests/t0801-readtag.c
+++ b/tests/t0801-readtag.c
@@ -6,21 +6,17 @@
#include <git/commit.h>
#include <git/tag.h>
-static const char *odb_dir = "../resources/pack-odb";
static const char *tag1_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
static const char *tag2_id = "7b4384978d2493e851f9cca7858815fac9b10980";
static const char *tagged_commit = "e90810b8df3e80c413d903f631643c716887138d";
BEGIN_TEST(readtag)
- git_odb *db;
git_repository *repo;
git_tag *tag1, *tag2;
git_commit *commit;
git_oid id1, id2, id_commit;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id1, tag1_id);
@@ -44,5 +40,4 @@ BEGIN_TEST(readtag)
must_be_true(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/t0802-write.c b/tests/t0802-write.c
index 4fc262177..20c1eab0a 100644
--- a/tests/t0802-write.c
+++ b/tests/t0802-write.c
@@ -6,19 +6,15 @@
#include <git/tag.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/pack-odb";
static const char *tag_id = "b25fa35b38051e4ae45d4222e795f9df2e43f1d1";
BEGIN_TEST(tag_writeback_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_tag *tag;
/* char hex_oid[41]; */
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tag_id);
@@ -36,8 +32,7 @@ BEGIN_TEST(tag_writeback_test)
printf("TAG New SHA1: %s\n", hex_oid);
*/
- must_pass(remove_loose_object(odb_dir, (git_object *)tag));
+ must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tag));
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/t0901-readtree.c b/tests/t0901-readtree.c
index eba6ecf46..e3a85c52d 100644
--- a/tests/t0901-readtree.c
+++ b/tests/t0901-readtree.c
@@ -6,18 +6,14 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/sample-odb";
static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
BEGIN_TEST(tree_entry_access_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_tree *tree;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tree_oid);
@@ -34,19 +30,15 @@ BEGIN_TEST(tree_entry_access_test)
must_be_true(git_tree_entry_byindex(tree, -1) == NULL);
git_repository_free(repo);
- git_odb_close(db);
END_TEST
BEGIN_TEST(tree_read_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_tree *tree;
git_tree_entry *entry;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tree_oid);
@@ -61,9 +53,7 @@ BEGIN_TEST(tree_read_test)
must_be_true(strcmp(git_tree_entry_name(entry), "README") == 0);
-
must_be_true(git_tree_entry_2object(entry) != NULL);
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/t0902-modify.c b/tests/t0902-modify.c
index 67ae1fa64..23fc03cb2 100644
--- a/tests/t0902-modify.c
+++ b/tests/t0902-modify.c
@@ -6,22 +6,17 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/sample-odb";
static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
BEGIN_TEST(tree_in_memory_add_test)
const unsigned int entry_count = 128;
-
- git_odb *db;
git_repository *repo;
git_tree *tree;
unsigned int i;
git_oid entry_id;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
tree = git_tree_new(repo);
@@ -36,16 +31,14 @@ BEGIN_TEST(tree_in_memory_add_test)
must_be_true(git_tree_entrycount(tree) == entry_count);
must_pass(git_object_write((git_object *)tree));
- must_pass(remove_loose_object(odb_dir, (git_object *)tree));
+ must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tree));
git_object_free((git_object *)tree);
git_repository_free(repo);
- git_odb_close(db);
END_TEST
BEGIN_TEST(tree_add_entry_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_tree *tree;
@@ -53,9 +46,7 @@ BEGIN_TEST(tree_add_entry_test)
unsigned int i;
/* char hex_oid[41]; */
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tree_oid);
@@ -92,10 +83,7 @@ BEGIN_TEST(tree_add_entry_test)
printf("TREE New SHA1: %s\n", hex_oid);
*/
- must_pass(remove_loose_object(odb_dir, (git_object *)tree));
-
+ must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)tree));
git_object_free((git_object *)tree);
-
git_repository_free(repo);
- git_odb_close(db);
END_TEST
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index 08434b8e1..86192233a 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -84,18 +84,23 @@ int remove_object_files(const char *odb_dir, object_data *d)
return 0;
}
-int remove_loose_object(const char *odb_dir, git_object *object)
+int remove_loose_object(const char *repository_folder, git_object *object)
{
+ static const char *objects_folder = "objects/";
+
char *ptr, *full_path, *top_folder;
- int path_length;
+ int path_length, objects_length;
+
+ assert(repository_folder && object);
- assert(odb_dir && object);
+ objects_length = strlen(objects_folder);
+ path_length = strlen(repository_folder);
+ ptr = full_path = git__malloc(path_length + objects_length + GIT_OID_HEXSZ + 3);
- path_length = strlen(odb_dir);
- ptr = full_path = git__malloc(path_length + GIT_OID_HEXSZ + 3);
+ strcpy(ptr, repository_folder);
+ strcpy(ptr + path_length, objects_folder);
- strcpy(ptr, odb_dir);
- ptr = top_folder = ptr + path_length;
+ ptr = top_folder = ptr + path_length + objects_length;
*ptr++ = '/';
git_oid_pathfmt(ptr, git_object_id(object));
ptr += GIT_OID_HEXSZ + 1;
diff --git a/tests/test_helpers.h b/tests/test_helpers.h
index 0d79d43bb..7085c645e 100644
--- a/tests/test_helpers.h
+++ b/tests/test_helpers.h
@@ -29,6 +29,8 @@
#include "test_lib.h"
#include <git/odb.h>
+#define ODB_FOLDER "../resources/testrepo.git/objects/"
+#define REPOSITORY_FOLDER "../resources/testrepo.git/"
typedef struct object_data {
unsigned char *bytes; /* (compressed) bytes stored in object store */