Re: [PATCH 19/21] t/helper: remove dependency on `the_repository` in "oidtree"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-06-11 at 11:59:01, Patrick Steinhardt wrote:
> 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux