Thread (172 messages) 172 messages, 10 authors, 2022-06-19

Re: [PATCH 06/17] t/helper: add 'pack-mtimes' test-tool

From: Derrick Stolee <hidden>
Date: 2021-12-06 21:16:26

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...
+{
+	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help