Subject: Re: [GSoC PATCH v3 2/5] pack-write: add helper to fill promisor file after repack

From: Tian Yuchen <[email-masked]>
Date: Tue, 7 Apr 2026 01:22:16 +0800

Hi,

On 4/6/26 08:24, LorenzoPegorari wrote:

> +		while (strbuf_getline(&line, source) != EOF) {
> +			struct strbuf **parts;
> +			struct object_id oid;
> +
> +			/* Split line into <oid>, <ref> and <time> (if <time> exists) */
> +			parts = strbuf_split_max(&line, ' ', 3);
> +
> +			/* Ignore the lines where <oid> doesn't appear in the dest_pack */
> +			strbuf_rtrim(parts[0]);
> +			get_oid_hex_algop(parts[0]->buf, &oid, repo->hash_algo);
> +			if (!find_pack_entry_one(&oid, dest_pack))
> +				continue;

Memory leak here;

> +
> +			/* If <time> doesn't exist, retrieve it and add it to line */
> +			if (!parts[2]) {
> +				struct tm tm;
> +				localtime_r(&source_stat.st_mtim.tv_sec, &tm),

Typo.

> +				strbuf_addch(&line, ' ');
> +				strbuf_addftime(&line, "%Y/%m/%d-%H:%M:%S", &tm, 0, 0);
> +			}
> +
> +			/*
> +			 * Add the finalized line to dest_to_write and dest_content if it
> +			 * wasn't already present inside dest_content
> +			 */
> +			if (strset_add(&dest_content, line.buf)) {
> +				strbuf_addbuf(&dest_to_write, &line);
> +				strbuf_addch(&dest_to_write, '\n');
> +			}

It looks good elsewhere, at least in this patch 2/5. (ゝ∀･)

Regards, Yuchen