git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 07/14] refs/iterator: separate lifecycle from iteration

From
Karthik Nayak <karthik.188@gmail.com>
Date
Feb 18, 2025, 17:13 UTC
Message-ID
<CAOLa=ZQzEwWci350dhhTFiG3WZB67JUB4O9L3coiXeexYGTNZw@mail.gmail.com>
In-Reply-To
<20250217-pks-update-ref-optimization-v1-7-a2b6d87a24af@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 58 quoted lines
> The ref and reflog iterators have their lifecycle attached to iteration:
> once the iterator reaches its end, it is automatically released and the
> caller doesn't have to care about that anymore. When the iterator should
> be released before it has been exhausted, callers must explicitly abort
> the iterator via `ref_iterator_abort()`.
>
> This lifecycle is somewhat unusual in the Git codebase and creates two
> problems:
>
>   - Callsites need to be very careful about when exactly they call
>     `ref_iterator_abort()`, as calling the function is only valid when
>     the iterator itself still is. This leads to somewhat awkward calling
>     patterns in some situations.
>
>   - It is impossible to reuse iterators and re-seek them to a different
>     prefix. This feature isn't supported by any iterator implementation
>     except for the reftable iterators anyway, but if it was implemented
>     it would allow us to optimize cases where we need to search for
>     specific references repeatedly by reusing internal state.
>
> Detangle the lifecycle from iteration so that we don't deallocate the
> iterator anymore once it is exhausted. Instead, callers are now expected
> to always call a newly introduce `ref_iterator_free()` function that
> deallocates the iterator and its internal state.
>
> While at it, drop the return value of `ref_iterator_abort()`, which
> wasn't really required by any of the iterator implementations anyway.
> Furthermore, stop calling `base_ref_iterator_free()` in any of the
> backends, but instead call it in `ref_iterator_free()`.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  builtin/clone.c              |  2 +
>  dir-iterator.c               | 24 +++++------
>  dir-iterator.h               | 13 ++----
>  refs.c                       |  7 +++-
>  refs/debug.c                 |  9 ++---
>  refs/files-backend.c         | 36 +++++------------
>  refs/iterator.c              | 95 ++++++++++++++------------------------------
>  refs/packed-backend.c        | 27 ++++++-------
>  refs/ref-cache.c             |  9 ++---
>  refs/refs-internal.h         | 31 +++++----------
>  refs/reftable-backend.c      | 34 ++++------------
>  t/helper/test-dir-iterator.c |  1 +
>  12 files changed, 99 insertions(+), 189 deletions(-)
>
> diff --git a/builtin/clone.c b/builtin/clone.c
> index fd001d800c6..ac3e84b2b18 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -426,6 +426,8 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
>  		strbuf_setlen(src, src_len);
>  		die(_("failed to iterate over '%s'"), src->buf);
>  	}
> +
> +	dir_iterator_free(iter);
>  }
>

A bit puzzled to see `dir_iterator_*` change here, I'm assuming it's linked to the 'files-backend' and perhaps similar to the changes mentioned about `ref_iterator_*` in the commit message. Would be nice to call out in the commit message too.

[snip]
Show 25 quoted lines
> @@ -223,7 +223,7 @@ int dir_iterator_advance(struct dir_iterator *dir_iterator)
>  		} else {
>  			if (level->entries_idx >= level->entries.nr) {
>  				if (pop_level(iter) == 0)
> -					return dir_iterator_abort(dir_iterator);
> +					return ITER_DONE;
>  				continue;
>  			}
>
> @@ -232,22 +232,21 @@ int dir_iterator_advance(struct dir_iterator *dir_iterator)
>
>  		if (prepare_next_entry_data(iter, name)) {
>  			if (errno != ENOENT && iter->flags & DIR_ITERATOR_PEDANTIC)
> -				goto error_out;
> +				return ITER_ERROR;
>  			continue;
>  		}
>
>  		return ITER_OK;
>  	}
> -
> -error_out:
> -	dir_iterator_abort(dir_iterator);
> -	return ITER_ERROR;
>  }

Okay yeah, we're getting rid of `dir_iterator_abort` so potentially add `dir_iterator_free` below

Show 20 quoted lines
>
> -int dir_iterator_abort(struct dir_iterator *dir_iterator)
> +void dir_iterator_free(struct dir_iterator *dir_iterator)
>  {
>  	struct dir_iterator_int *iter = (struct dir_iterator_int *)dir_iterator;
>
> +	if (!iter)
> +		return;
> +
>  	for (; iter->levels_nr; iter->levels_nr--) {
>  		struct dir_iterator_level *level =
>  			&iter->levels[iter->levels_nr - 1];
> @@ -266,7 +265,6 @@ int dir_iterator_abort(struct dir_iterator *dir_iterator)
>  	free(iter->levels);
>  	strbuf_release(&iter->base.path);
>  	free(iter);
> -	return ITER_DONE;
>  }
>
>  struct dir_iterator *dir_iterator_begin(const char *path, unsigned int flags)
Okay this makes sense!
[snip]
Show 13 quoted lines
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 29f08dced40..9511b6f3448 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -919,10 +919,6 @@ static int files_ref_iterator_advance(struct ref_iterator *ref_iterator)
>  		return ITER_OK;
>  	}
>
> -	iter->iter0 = NULL;
> -	if (ref_iterator_abort(ref_iterator) != ITER_DONE)
> -		ok = ITER_ERROR;
> -
>
Since we're explicitly going to call `ref_iterator_free`, this makes sense.
Show 22 quoted lines
>  	return ok;
>  }
>
> @@ -935,23 +931,17 @@ static int files_ref_iterator_peel(struct ref_iterator *ref_iterator,
>  	return ref_iterator_peel(iter->iter0, peeled);
>  }
>
> -static int files_ref_iterator_abort(struct ref_iterator *ref_iterator)
> +static void files_ref_iterator_release(struct ref_iterator *ref_iterator)
>  {
>  	struct files_ref_iterator *iter =
>  		(struct files_ref_iterator *)ref_iterator;
> -	int ok = ITER_DONE;
> -
> -	if (iter->iter0)
> -		ok = ref_iterator_abort(iter->iter0);
> -
> -	base_ref_iterator_free(ref_iterator);
> -	return ok;
> +	ref_iterator_free(iter->iter0);
>  }
>
I like how much more cleaner it looks now.
[snip]
Show 14 quoted lines
> diff --git a/refs/packed-backend.c b/refs/packed-backend.c
> index a7b6f74b6e3..38a1956d1a8 100644
> --- a/refs/packed-backend.c
> +++ b/refs/packed-backend.c
> @@ -954,9 +954,6 @@ static int packed_ref_iterator_advance(struct ref_iterator *ref_iterator)
>  		return ITER_OK;
>  	}
>
> -	if (ref_iterator_abort(ref_iterator) != ITER_DONE)
> -		ok = ITER_ERROR;
> -
>  	return ok;
>  }
>

The merged_iterator is used to combine the files and packed backend iterators to provide a uniform view over them. Likewise the changes here seem similar too.

Show 33 quoted lines
> @@ -976,23 +973,19 @@ static int packed_ref_iterator_peel(struct ref_iterator *ref_iterator,
>  	}
>  }
>
> -static int packed_ref_iterator_abort(struct ref_iterator *ref_iterator)
> +static void packed_ref_iterator_release(struct ref_iterator *ref_iterator)
>  {
>  	struct packed_ref_iterator *iter =
>  		(struct packed_ref_iterator *)ref_iterator;
> -	int ok = ITER_DONE;
> -
>  	strbuf_release(&iter->refname_buf);
>  	free(iter->jump);
>  	release_snapshot(iter->snapshot);
> -	base_ref_iterator_free(ref_iterator);
> -	return ok;
>  }
>
>  static struct ref_iterator_vtable packed_ref_iterator_vtable = {
>  	.advance = packed_ref_iterator_advance,
>  	.peel = packed_ref_iterator_peel,
> -	.abort = packed_ref_iterator_abort
> +	.release = packed_ref_iterator_release,
>  };
>
>  static int jump_list_entry_cmp(const void *va, const void *vb)
> @@ -1362,8 +1355,10 @@ static int write_with_updates(struct packed_ref_store *refs,
>  	 */
>  	iter = packed_ref_iterator_begin(&refs->base, "", NULL,
>  					 DO_FOR_EACH_INCLUDE_BROKEN);
> -	if ((ok = ref_iterator_advance(iter)) != ITER_OK)
> +	if ((ok = ref_iterator_advance(iter)) != ITER_OK) {
> +		ref_iterator_free(iter);
Nit: Since we don't return early here, wouldn't the `ref_iterator_free`
at the end of the function be sufficient? I think the only early return
when `iter == NULL` is towards the end of the function, where it might
be better to add a `goto error`.
[snip]
Previous: shejialuoNext: Patrick Steinhardt
Message 20 of 169 in “refs: batch refname availability checks”
  1. 00/14 refs: batch refname availability checksPatrick Steinhardt, Feb 17, 2025
  2. 01/14 object-name: introduce `repo_get_oid_with_flags()`Patrick Steinhardt, Feb 17, 2025
  3. 02/14 object-name: allow skipping ambiguity checks in `get_oid()` familyPatrick Steinhardt, Feb 17, 2025
  4. 03/14 builtin/update-ref: skip ambiguity checks when parsing object IDsPatrick Steinhardt, Feb 17, 2025
  5. Karthik NayakFeb 18, 2025
  6. 04/14 refs: introduce function to batch refname availability checksPatrick Steinhardt, Feb 17, 2025
  7. 05/14 refs/reftable: start using `refs_verify_refnames_available()`Patrick Steinhardt, Feb 17, 2025
  8. 06/14 refs: stop re-verifying common prefixes for availabilityPatrick Steinhardt, Feb 17, 2025
  9. Karthik NayakFeb 18, 2025
  10. Patrick SteinhardtFeb 19, 2025
  11. 07/14 refs/iterator: separate lifecycle from iterationPatrick Steinhardt, Feb 17, 2025
  12. shejialuoFeb 18, 2025
  13. Patrick SteinhardtFeb 19, 2025
  14. shejialuoFeb 19, 2025
  15. Patrick SteinhardtFeb 19, 2025
  16. shejialuoFeb 19, 2025
  17. Patrick SteinhardtFeb 19, 2025
  18. Patrick SteinhardtFeb 19, 2025
  19. shejialuoFeb 19, 2025
  20. Karthik NayakFeb 18, 2025
  21. Patrick SteinhardtFeb 19, 2025
  22. 08/14 refs/iterator: provide infrastructure to re-seek iteratorsPatrick Steinhardt, Feb 17, 2025
  23. 09/14 refs/iterator: implement seeking for merged iteratorsPatrick Steinhardt, Feb 17, 2025
  24. Karthik NayakFeb 19, 2025
  25. 10/14 refs/iterator: implement seeking for reftable iteratorsPatrick Steinhardt, Feb 17, 2025
  26. Karthik NayakFeb 19, 2025
  27. 11/14 refs/iterator: implement seeking for ref-cache iteratorsPatrick Steinhardt, Feb 17, 2025
  28. 12/14 refs/iterator: implement seeking for `packed-ref` iteratorsPatrick Steinhardt, Feb 17, 2025
  29. 13/14 refs/iterator: implement seeking for "files" iteratorsPatrick Steinhardt, Feb 17, 2025
  30. 14/14 refs: reuse iterators when determining refname availabilityPatrick Steinhardt, Feb 17, 2025
  31. brian m. carlsonFeb 18, 2025
  32. 00/16 refs: batch refname availability checksPatrick Steinhardt, Feb 19, 2025
  33. 01/16 object-name: introduce `repo_get_oid_with_flags()`Patrick Steinhardt, Feb 19, 2025
  34. Justin ToblerFeb 19, 2025
  35. 02/16 object-name: allow skipping ambiguity checks in `get_oid()` familyPatrick Steinhardt, Feb 19, 2025
  36. Jeff KingFeb 21, 2025
  37. Patrick SteinhardtFeb 21, 2025
  38. Jeff KingFeb 21, 2025
  39. 03/16 builtin/update-ref: skip ambiguity checks when parsing object IDsPatrick Steinhardt, Feb 19, 2025
  40. Justin ToblerFeb 19, 2025
  41. Patrick SteinhardtFeb 20, 2025
  42. 04/16 refs: introduce function to batch refname availability checksPatrick Steinhardt, Feb 19, 2025
  43. 05/16 refs/reftable: batch refname availability checksPatrick Steinhardt, Feb 19, 2025
  44. 06/16 refs/files: batch refname availability checks for normal transactionsPatrick Steinhardt, Feb 19, 2025
  45. 07/16 refs/files: batch refname availability checks for initial transactionsPatrick Steinhardt, Feb 19, 2025
  46. 08/16 refs: stop re-verifying common prefixes for availabilityPatrick Steinhardt, Feb 19, 2025
  47. 09/16 refs/iterator: separate lifecycle from iterationPatrick Steinhardt, Feb 19, 2025
  48. 11/16 refs/iterator: implement seeking for merged iteratorsPatrick Steinhardt, Feb 19, 2025
  49. shejialuoFeb 24, 2025
  50. Patrick SteinhardtFeb 25, 2025
  51. 10/16 refs/iterator: provide infrastructure to re-seek iteratorsPatrick Steinhardt, Feb 19, 2025
  52. shejialuoFeb 24, 2025
  53. Patrick SteinhardtFeb 25, 2025
  54. 12/16 refs/iterator: implement seeking for reftable iteratorsPatrick Steinhardt, Feb 19, 2025
  55. shejialuoFeb 24, 2025
  56. Patrick SteinhardtFeb 25, 2025
  57. 13/16 refs/iterator: implement seeking for ref-cache iteratorsPatrick Steinhardt, Feb 19, 2025
  58. shejialuoFeb 24, 2025
  59. Patrick SteinhardtFeb 25, 2025
  60. 14/16 refs/iterator: implement seeking for `packed-ref` iteratorsPatrick Steinhardt, Feb 19, 2025
  61. shejialuoFeb 24, 2025
  62. Patrick SteinhardtFeb 25, 2025
  63. shejialuoFeb 25, 2025
  64. 16/16 refs: reuse iterators when determining refname availabilityPatrick Steinhardt, Feb 19, 2025
  65. shejialuoFeb 24, 2025
  66. 15/16 refs/iterator: implement seeking for "files" iteratorsPatrick Steinhardt, Feb 19, 2025
  67. shejialuoFeb 24, 2025
  68. Patrick SteinhardtFeb 25, 2025
  69. 00/16 refs: batch refname availability checksPatrick Steinhardt, Feb 25, 2025
  70. 01/16 object-name: introduce `repo_get_oid_with_flags()`Patrick Steinhardt, Feb 25, 2025
  71. 02/16 object-name: allow skipping ambiguity checks in `get_oid()` familyPatrick Steinhardt, Feb 25, 2025
  72. 03/16 builtin/update-ref: skip ambiguity checks when parsing object IDsPatrick Steinhardt, Feb 25, 2025
  73. Junio C HamanoFeb 26, 2025
  74. Patrick SteinhardtFeb 27, 2025
  75. 04/16 refs: introduce function to batch refname availability checksPatrick Steinhardt, Feb 25, 2025
  76. 05/16 refs/reftable: batch refname availability checksPatrick Steinhardt, Feb 25, 2025
  77. 06/16 refs/files: batch refname availability checks for normal transactionsPatrick Steinhardt, Feb 25, 2025
  78. 07/16 refs/files: batch refname availability checks for initial transactionsPatrick Steinhardt, Feb 25, 2025
  79. 08/16 refs: stop re-verifying common prefixes for availabilityPatrick Steinhardt, Feb 25, 2025
  80. 10/16 refs/iterator: provide infrastructure to re-seek iteratorsPatrick Steinhardt, Feb 25, 2025
  81. 09/16 refs/iterator: separate lifecycle from iterationPatrick Steinhardt, Feb 25, 2025
  82. 11/16 refs/iterator: implement seeking for merged iteratorsPatrick Steinhardt, Feb 25, 2025
  83. 12/16 refs/iterator: implement seeking for reftable iteratorsPatrick Steinhardt, Feb 25, 2025
  84. 13/16 refs/iterator: implement seeking for ref-cache iteratorsPatrick Steinhardt, Feb 25, 2025
  85. 14/16 refs/iterator: implement seeking for packed-ref iteratorsPatrick Steinhardt, Feb 25, 2025
  86. 15/16 refs/iterator: implement seeking for files iteratorsPatrick Steinhardt, Feb 25, 2025
  87. 16/16 refs: reuse iterators when determining refname availabilityPatrick Steinhardt, Feb 25, 2025
  88. 00/16 refs: batch refname availability checksPatrick Steinhardt, Feb 28, 2025
  89. 01/16 object-name: introduce `repo_get_oid_with_flags()`Patrick Steinhardt, Feb 28, 2025
  90. 02/16 object-name: allow skipping ambiguity checks in `get_oid()` familyPatrick Steinhardt, Feb 28, 2025
  91. Karthik NayakMar 6, 2025
  92. 03/16 builtin/update-ref: skip ambiguity checks when parsing object IDsPatrick Steinhardt, Feb 28, 2025
  93. 04/16 refs: introduce function to batch refname availability checksPatrick Steinhardt, Feb 28, 2025
  94. Karthik NayakMar 6, 2025
  95. 05/16 refs/reftable: batch refname availability checksPatrick Steinhardt, Feb 28, 2025
  96. Karthik NayakMar 6, 2025
  97. Karthik NayakMar 6, 2025
  98. Patrick SteinhardtMar 6, 2025
  99. 06/16 refs/files: batch refname availability checks for normal transactionsPatrick Steinhardt, Feb 28, 2025
  100. 07/16 refs/files: batch refname availability checks for initial transactionsPatrick Steinhardt, Feb 28, 2025
  101. Karthik NayakMar 6, 2025
  102. 08/16 refs: stop re-verifying common prefixes for availabilityPatrick Steinhardt, Feb 28, 2025
  103. 09/16 refs/iterator: separate lifecycle from iterationPatrick Steinhardt, Feb 28, 2025
  104. 10/16 refs/iterator: provide infrastructure to re-seek iteratorsPatrick Steinhardt, Feb 28, 2025
  105. 11/16 refs/iterator: implement seeking for merged iteratorsPatrick Steinhardt, Feb 28, 2025
  106. 12/16 refs/iterator: implement seeking for reftable iteratorsPatrick Steinhardt, Feb 28, 2025
  107. Karthik NayakMar 6, 2025
  108. 13/16 refs/iterator: implement seeking for ref-cache iteratorsPatrick Steinhardt, Feb 28, 2025
  109. 14/16 refs/iterator: implement seeking for packed-ref iteratorsPatrick Steinhardt, Feb 28, 2025
  110. 15/16 refs/iterator: implement seeking for files iteratorsPatrick Steinhardt, Feb 28, 2025
  111. 16/16 refs: reuse iterators when determining refname availabilityPatrick Steinhardt, Feb 28, 2025
  112. Karthik NayakMar 6, 2025
  113. 00/16 refs: batch refname availability checksPatrick Steinhardt, Mar 6, 2025
  114. 01/16 object-name: introduce `repo_get_oid_with_flags()`Patrick Steinhardt, Mar 6, 2025
  115. 02/16 object-name: allow skipping ambiguity checks in `get_oid()` familyPatrick Steinhardt, Mar 6, 2025
  116. shejialuoMar 12, 2025
  117. 03/16 builtin/update-ref: skip ambiguity checks when parsing object IDsPatrick Steinhardt, Mar 6, 2025
  118. 04/16 refs: introduce function to batch refname availability checksPatrick Steinhardt, Mar 6, 2025
  119. shejialuoMar 12, 2025
  120. shejialuoMar 12, 2025
  121. Patrick SteinhardtMar 12, 2025
  122. 05/16 refs/reftable: batch refname availability checksPatrick Steinhardt, Mar 6, 2025
  123. shejialuoMar 12, 2025
  124. Patrick SteinhardtMar 12, 2025
  125. 06/16 refs/files: batch refname availability checks for normal transactionsPatrick Steinhardt, Mar 6, 2025
  126. shejialuoMar 12, 2025
  127. Patrick SteinhardtMar 12, 2025
  128. 07/16 refs/files: batch refname availability checks for initial transactionsPatrick Steinhardt, Mar 6, 2025
  129. shejialuoMar 12, 2025
  130. Patrick SteinhardtMar 12, 2025
  131. 08/16 refs: stop re-verifying common prefixes for availabilityPatrick Steinhardt, Mar 6, 2025
  132. shejialuoMar 12, 2025
  133. Patrick SteinhardtMar 12, 2025
  134. 11/16 refs/iterator: implement seeking for merged iteratorsPatrick Steinhardt, Mar 6, 2025
  135. 09/16 refs/iterator: separate lifecycle from iterationPatrick Steinhardt, Mar 6, 2025
  136. shejialuoMar 12, 2025
  137. Patrick SteinhardtMar 12, 2025
  138. 10/16 refs/iterator: provide infrastructure to re-seek iteratorsPatrick Steinhardt, Mar 6, 2025
  139. 12/16 refs/iterator: implement seeking for reftable iteratorsPatrick Steinhardt, Mar 6, 2025
  140. 13/16 refs/iterator: implement seeking for ref-cache iteratorsPatrick Steinhardt, Mar 6, 2025
  141. 14/16 refs/iterator: implement seeking for packed-ref iteratorsPatrick Steinhardt, Mar 6, 2025
  142. 15/16 refs/iterator: implement seeking for files iteratorsPatrick Steinhardt, Mar 6, 2025
  143. 16/16 refs: reuse iterators when determining refname availabilityPatrick Steinhardt, Mar 6, 2025
  144. Karthik NayakMar 6, 2025
  145. shejialuoMar 12, 2025
  146. 00/16 refs: batch refname availability checksPatrick Steinhardt, Mar 12, 2025
  147. 01/16 object-name: introduce `repo_get_oid_with_flags()`Patrick Steinhardt, Mar 12, 2025
  148. 02/16 object-name: allow skipping ambiguity checks in `get_oid()` familyPatrick Steinhardt, Mar 12, 2025
  149. 03/16 builtin/update-ref: skip ambiguity checks when parsing object IDsPatrick Steinhardt, Mar 12, 2025
  150. 04/16 refs: introduce function to batch refname availability checksPatrick Steinhardt, Mar 12, 2025
  151. 05/16 refs/reftable: batch refname availability checksPatrick Steinhardt, Mar 12, 2025
  152. 06/16 refs/files: batch refname availability checks for normal transactionsPatrick Steinhardt, Mar 12, 2025
  153. 07/16 refs/files: batch refname availability checks for initial transactionsPatrick Steinhardt, Mar 12, 2025
  154. 08/16 refs: stop re-verifying common prefixes for availabilityPatrick Steinhardt, Mar 12, 2025
  155. 11/16 refs/iterator: implement seeking for merged iteratorsPatrick Steinhardt, Mar 12, 2025
  156. 10/16 refs/iterator: provide infrastructure to re-seek iteratorsPatrick Steinhardt, Mar 12, 2025
  157. 09/16 refs/iterator: separate lifecycle from iterationPatrick Steinhardt, Mar 12, 2025
  158. 12/16 refs/iterator: implement seeking for reftable iteratorsPatrick Steinhardt, Mar 12, 2025
  159. 14/16 refs/iterator: implement seeking for packed-ref iteratorsPatrick Steinhardt, Mar 12, 2025
  160. Elijah NewrenApr 3, 2025
  161. brian m. carlsonApr 3, 2025
  162. shejialuoApr 4, 2025
  163. Patrick SteinhardtApr 4, 2025
  164. Patrick SteinhardtApr 4, 2025
  165. Patrick SteinhardtApr 4, 2025
  166. 13/16 refs/iterator: implement seeking for ref-cache iteratorsPatrick Steinhardt, Mar 12, 2025
  167. 15/16 refs/iterator: implement seeking for files iteratorsPatrick Steinhardt, Mar 12, 2025
  168. 16/16 refs: reuse iterators when determining refname availabilityPatrick Steinhardt, Mar 12, 2025
  169. shejialuoMar 13, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.