Re: [PATCH 06/17] t/helper: add 'pack-mtimes' test-tool
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Dec 6, 2021, 21:16 UTC
- Message-ID
- <15f1bbc6-7ae6-0ed3-872a-51feebd1296c@gmail.com>
- In-Reply-To
- <e0a7b3b310c69350d8e2c0561e0991bb7045a66d.1638224692.git.me@ttaylorr.com>
On 11/29/2021 5:25 PM, Taylor Blau wrote:
> +static int dump_mtimes(struct packed_git *p)
nit: you return an int here so you can use it as an error code...
Show 15 quoted lines
> +{
> + uint32_t i;
> + if (load_pack_mtimes(p) < 0)
> + die("could not load pack .mtimes");
> +
> + for (i = 0; i < p->num_objects; i++) {
> + struct object_id oid;
> + if (nth_packed_object_id(&oid, p, i) < 0)
> + die("could not load object id at position %"PRIu32, i);
> +
> + printf("%s %"PRIu32"\n",
> + oid_to_hex(&oid), nth_packed_mtime(p, i));
> + }
> +
> + return 0;But always return 0 unless you die().
> + return p ? dump_mtimes(p) : 1;
It makes this line concise, I suppose.
Perhaps just use "return dump_mtimes(p)" and have dump_mtimes() return 1 if the given pack is NULL?
Thanks, -Stolee