Thread (41 messages) 41 messages, 2 authors, 2d ago

Re: [PATCH 04/13] odb: refactor `odb_for_each_alternate()` to yield dirs

flat view

From: Karthik Nayak <hidden>
Date: 2026-10-06 08:42:34

Patrick Steinhardt [off-list ref] writes:

[snip]
quoted hunk ↗ jump to hunk
@@ -468,9 +470,11 @@ static int refs_from_alternate_cb(struct odb_source *alternate,
 void odb_for_each_alternate_ref(struct object_database *odb,
 				odb_for_each_alternate_ref_fn cb, void *payload)
 {
-	struct alternate_refs_data data;
-	data.fn = cb;
-	data.payload = payload;
+	struct alternate_refs_data data = {
+		.fn = cb,
+		.payload = payload,
+		.repo = odb->repo,
+	};
 	odb_for_each_alternate(odb, refs_from_alternate_cb, &data);
 }
@@ -481,7 +485,7 @@ int odb_for_each_alternate(struct object_database *odb,
 	int r = 0;

 	for (alternate = odb->sources->next; alternate; alternate = alternate->next) {
-		r = cb(alternate, payload);
+		r = cb(odb_source_files_downcast(alternate)->dirs, payload);
 		if (r)
 			break;
 	}
Okay, so here we call the callbacks with the `dirs` now and this
corresponds with the changes in the rest of the patch. Makes sense.

[snip]

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help