Re: [PATCH 19/21] t/helper: remove dependency on `the_repository` in "oidtree"
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jun 11, 2024, 23:17 UTC
- Message-ID
- <ZmjbJU1Rnnx0ggHt@tapette.crustytoothpaste.net>
- In-Reply-To
- <339d668da837ab5b4b11399ece4efaf5bc27d313.1718106285.git.ps@pks.im>
On 2024-06-11 at 11:59:01, Patrick Steinhardt wrote:
Show 31 quoted lines
> diff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c
> index c7a1d4c642..04ec24cc84 100644
> --- a/t/helper/test-oidtree.c
> +++ b/t/helper/test-oidtree.c
> @@ -1,7 +1,6 @@
> #include "test-tool.h"
> #include "hex.h"
> #include "oidtree.h"
> -#include "setup.h"
> #include "strbuf.h"
>
> static enum cb_next print_oid(const struct object_id *oid, void *data UNUSED)
> @@ -14,11 +13,9 @@ int cmd__oidtree(int argc UNUSED, const char **argv UNUSED)
> {
> struct oidtree ot;
> struct strbuf line = STRBUF_INIT;
> - int nongit_ok;
> int algo = GIT_HASH_UNKNOWN;
>
> oidtree_init(&ot);
> - setup_git_directory_gently(&nongit_ok);
>
> while (strbuf_getline(&line, stdin) != EOF) {
> const char *arg;
> @@ -30,7 +27,7 @@ int cmd__oidtree(int argc UNUSED, const char **argv UNUSED)
> algo = oid.algo;
> oidtree_insert(&ot, &oid);
> } else if (skip_prefix(line.buf, "contains ", &arg)) {
> - if (get_oid_hex(arg, &oid))
> + if (get_oid_hex_any(arg, &oid) == GIT_HASH_UNKNOWN)
> die("contains not a hexadecimal oid: %s", arg);This is not a problem in your code, but this might read more naturally as "does not contain a hexadecimal oid" or "contains no hexadecimal oid".
-- brian m. carlson (they/them or he/him) Toronto, Ontario, CA