]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-tool: rename sha1-array to oid-array
authorJeff King <peff@peff.net>
Mon, 30 Mar 2020 14:04:03 +0000 (10:04 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2020 17:59:08 +0000 (10:59 -0700)
This matches the actual data structure name, as well as the source file
that contains the code we're testing. The test scripts need updating to
use the new name, as well.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/helper/test-oid-array.c [moved from t/helper/test-sha1-array.c with 85% similarity]
t/helper/test-tool.c
t/helper/test-tool.h
t/t0064-sha1-array.sh

index 30fdfb877e0d1c9fa4b665124877cbffc797317d..1e2f1fd912b0edfeb19d70d7ceb987ae3f2afa0a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -738,7 +738,7 @@ TEST_BUILTINS_OBJS += test-run-command.o
 TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
 TEST_BUILTINS_OBJS += test-serve-v2.o
 TEST_BUILTINS_OBJS += test-sha1.o
-TEST_BUILTINS_OBJS += test-sha1-array.o
+TEST_BUILTINS_OBJS += test-oid-array.o
 TEST_BUILTINS_OBJS += test-sha256.o
 TEST_BUILTINS_OBJS += test-sigchain.o
 TEST_BUILTINS_OBJS += test-strcmp-offset.o
similarity index 85%
rename from t/helper/test-sha1-array.c
rename to t/helper/test-oid-array.c
index 6f7d3b939e744e3ab82758eda637963cd42ac726..ce9fd5f0919f76ee3660cec5464b8a31c65eba07 100644 (file)
@@ -8,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
        return 0;
 }
 
-int cmd__sha1_array(int argc, const char **argv)
+int cmd__oid_array(int argc, const char **argv)
 {
        struct oid_array array = OID_ARRAY_INIT;
        struct strbuf line = STRBUF_INIT;
@@ -19,11 +19,11 @@ int cmd__sha1_array(int argc, const char **argv)
 
                if (skip_prefix(line.buf, "append ", &arg)) {
                        if (get_oid_hex(arg, &oid))
-                               die("not a hexadecimal SHA1: %s", arg);
+                               die("not a hexadecimal oid: %s", arg);
                        oid_array_append(&array, &oid);
                } else if (skip_prefix(line.buf, "lookup ", &arg)) {
                        if (get_oid_hex(arg, &oid))
-                               die("not a hexadecimal SHA1: %s", arg);
+                               die("not a hexadecimal oid: %s", arg);
                        printf("%d\n", oid_array_lookup(&array, &oid));
                } else if (!strcmp(line.buf, "clear"))
                        oid_array_clear(&array);
index c9a232d23897b70b051bfd76488ca0e971830b83..c79c6ec7f6599e84c6f66069e43c14e5ff57a89a 100644 (file)
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
        { "match-trees", cmd__match_trees },
        { "mergesort", cmd__mergesort },
        { "mktemp", cmd__mktemp },
+       { "oid-array", cmd__oid_array },
        { "oidmap", cmd__oidmap },
        { "online-cpus", cmd__online_cpus },
        { "parse-options", cmd__parse_options },
@@ -56,7 +57,6 @@ static struct test_cmd cmds[] = {
        { "scrap-cache-tree", cmd__scrap_cache_tree },
        { "serve-v2", cmd__serve_v2 },
        { "sha1", cmd__sha1 },
-       { "sha1-array", cmd__sha1_array },
        { "sha256", cmd__sha256 },
        { "sigchain", cmd__sigchain },
        { "strcmp-offset", cmd__strcmp_offset },
index c8549fd87f23b6372a41b2ad5d7ba28df3e258c7..a082516c951a092bc2d29742e5571293da3a44e2 100644 (file)
@@ -46,7 +46,7 @@ int cmd__run_command(int argc, const char **argv);
 int cmd__scrap_cache_tree(int argc, const char **argv);
 int cmd__serve_v2(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
-int cmd__sha1_array(int argc, const char **argv);
+int cmd__oid_array(int argc, const char **argv);
 int cmd__sha256(int argc, const char **argv);
 int cmd__sigchain(int argc, const char **argv);
 int cmd__strcmp_offset(int argc, const char **argv);
index 5dda570b9a1ef3139165a4b901e16f64a3263209..45685af2fd5095a9901fdb150de1c6fd8703728f 100755 (executable)
@@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
        {
                echoid append 88 44 aa 55 &&
                echo for_each_unique
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        test_cmp expect actual
 '
 
@@ -28,7 +28,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
                echoid append 88 44 aa 55 &&
                echoid append 88 44 aa 55 &&
                echo for_each_unique
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        test_cmp expect actual
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'lookup' '
        {
                echoid append 88 44 aa 55 &&
                echoid lookup 55
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        n=$(cat actual) &&
        test "$n" -eq 1
 '
@@ -45,7 +45,7 @@ test_expect_success 'lookup non-existing entry' '
        {
                echoid append 88 44 aa 55 &&
                echoid lookup 33
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        n=$(cat actual) &&
        test "$n" -lt 0
 '
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
                echoid append 88 44 aa 55 &&
                echoid append 88 44 aa 55 &&
                echoid lookup 55
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        n=$(cat actual) &&
        test "$n" -ge 2 &&
        test "$n" -le 3
@@ -66,7 +66,7 @@ test_expect_success 'lookup non-existing entry with duplicates' '
                echoid append 88 44 aa 55 &&
                echoid append 88 44 aa 55 &&
                echoid lookup 66
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        n=$(cat actual) &&
        test "$n" -lt 0
 '
@@ -81,7 +81,7 @@ test_expect_success 'lookup with almost duplicate values' '
                echo "append $id1" &&
                echo "append $id2" &&
                echoid lookup 55
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        n=$(cat actual) &&
        test "$n" -eq 0
 '
@@ -90,7 +90,7 @@ test_expect_success 'lookup with single duplicate value' '
        {
                echoid append 55 55 &&
                echoid lookup 55
-       } | test-tool sha1-array >actual &&
+       } | test-tool oid-array >actual &&
        n=$(cat actual) &&
        test "$n" -ge 0 &&
        test "$n" -le 1