"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got fetch downloads too much
To:
Christian Weisgerber <naddy@mips.inka.de>, gameoftrees@openbsd.org
Date:
Wed, 6 Oct 2021 20:37:04 +0200

Download raw body.

Thread
On Wed, Oct 06, 2021 at 08:30:33PM +0200, Stefan Sperling wrote:
> @@ -457,6 +480,14 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
>  			err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
>  			goto done;
>  		}
> +		if (match_remote_object_id(have_refs, &want[nref])) {
> +			if (chattygot) {
> +				fprintf(stderr,
> +				    "%s: not fetching %s, we already have %s\n",
> +				    getprogname(), refname, id_str);
> +			}
> +			continue;
> +		}

By the way, id_str should be freed here. But the existing code
does not free it properly and memory for refname is also leaked.
So I would rather fix all of that in a follow-up patch.