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

Re: [PATCH v2 3/8] refs: make errno output explicit for read_raw_ref_fn

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 1, 2021, 11:34 UTC
Message-ID
<87h7hedz9z.fsf@evledraar.gmail.com>
In-Reply-To
<3e2831e59c8e4cb8aef416a41b55083887b4559c.1623329869.git.gitgitgadget@gmail.com>
On Thu, Jun 10 2021, Han-Wen Nienhuys via GitGitGadget wrote:
Show 37 quoted lines
> From: Han-Wen Nienhuys <hanwen@google.com>
>
> read_raw_ref_fn needs to supply a credible errno for a number of cases. These
> are primarily:
>
> 1) The files backend calls read_raw_ref from lock_raw_ref, and uses the
> resulting error codes to create/remove directories as needed.
>
> 2) ENOENT should be translated in a zero OID, optionally with REF_ISBROKEN set,
> returning the last successfully resolved symref. This is necessary so
> read_raw_ref("HEAD") on an empty repo returns refs/heads/main (or the default branch
> du-jour), and we know on which branch to create the first commit.
>
> Make this information flow explicit by adding a failure_errno to the signature
> of read_raw_ref. All errnos from the files backend are still propagated
> unchanged, even though inspection suggests only ENOTDIR, EISDIR and ENOENT are
> relevant.
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  refs.c                |  8 ++++++--
>  refs/debug.c          |  4 ++--
>  refs/files-backend.c  | 24 ++++++++++++------------
>  refs/packed-backend.c |  8 ++++----
>  refs/refs-internal.h  | 17 +++++++++--------
>  5 files changed, 33 insertions(+), 28 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 8c9490235ea6..bebe3f584da7 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1675,13 +1675,17 @@ int refs_read_raw_ref(struct ref_store *ref_store,
>  		      const char *refname, struct object_id *oid,
>  		      struct strbuf *referent, unsigned int *type)
>  {
> +	int result, failure;

Style nit: Different variables should be on different lines, except where they're the same, so "int i, j", not "int ret, i". Perhaps "ret" and "errno" are similar enough, but I'd split them, just my 0.02.

Also nit: s/failure/failure_errno/, just like the function signature.
Show 13 quoted lines
>  	if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) {
>  		return refs_read_special_head(ref_store, refname, oid, referent,
>  					      type);
>  	}
>  
> -	return ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
> -					   type);
> +	failure = 0;
> +	result = ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
> +					     type, &failure);
> +	errno = failure;
> +	return result;
>  }

Is there some subtlety here where this isn't equivalent to the more simple/straightforward:

	diff --git a/refs.c b/refs.c
	index bebe3f584da..49ab7555de9 100644
	--- a/refs.c
	+++ b/refs.c
	@@ -1675,17 +1675,14 @@ int refs_read_raw_ref(struct ref_store *ref_store,
	 		      const char *refname, struct object_id *oid,
	 		      struct strbuf *referent, unsigned int *type)
	 {
	-	int result, failure;
	 	if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) {
	 		return refs_read_special_head(ref_store, refname, oid, referent,
	 					      type);
	 	}
	 
	-	failure = 0;
	-	result = ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
	-					     type, &failure);
	-	errno = failure;
	-	return result;
	+	errno = 0;
	+	return ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
	+					     type, &errno);
	 }
	 
	 /* This function needs to return a meaningful errno on failure */

In that case adding the "failure_errno" to the signature won't be needed either, but I'm assuming we're heading towards some reftable end-state where that makes more sense.

I can only imagine a case where we think files_read_raw_ref() would encounter a new errno after it assigned to *failure_errno, which is just a couple of strbuf_release() calls.

if that is a case we're worried about then like in my comment on 2/8
shouldn't we be explicitly checking for such a lost/different errno?
I.e. something like (should probably be less fatal than BUG(...):
		
	diff --git a/refs.c b/refs.c
	index bebe3f584da..9584ddae392 100644
	--- a/refs.c
	+++ b/refs.c
	@@ -1675,16 +1675,22 @@ int refs_read_raw_ref(struct ref_store *ref_store,
	 		      const char *refname, struct object_id *oid,
	 		      struct strbuf *referent, unsigned int *type)
	 {
	-	int result, failure;
	+	int result, failure_errno = 0;
	+
	 	if (!strcmp(refname, "FETCH_HEAD") || !strcmp(refname, "MERGE_HEAD")) {
	 		return refs_read_special_head(ref_store, refname, oid, referent,
	 					      type);
	 	}
	 
	-	failure = 0;
	+	errno = 0;
	 	result = ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
	-					     type, &failure);
	-	errno = failure;
	+					     type, &failure_errno);
	+	if (errno)
	+		BUG("Got another errno from read_raw_ref()?: %s, failure errno: %s",
	+		    strerror(errno),
	+		    strerror(failure_errno));
	+	else
	+		errno = failure_errno;
	 	return result;
	 }
	 
	diff --git a/refs/files-backend.c b/refs/files-backend.c
	index 8f969c8f711..57cfdf738da 100644
	--- a/refs/files-backend.c
	+++ b/refs/files-backend.c
	@@ -458,8 +458,10 @@ static int files_read_raw_ref(struct ref_store *ref_store, const char *refname,
	 	ret = parse_loose_ref_contents(buf, oid, referent, type);
	 
	 out:
	-	if (failure_errno)
	+	if (failure_errno) {
	 		*failure_errno = errno;
	+		errno = 0;
	+	}
	 	strbuf_release(&sb_path);
	 	strbuf_release(&sb_contents);
	 	return ret;
	diff --git a/refs/packed-backend.c b/refs/packed-backend.c
	index a457f18e93c..4bcb4777f0f 100644
	--- a/refs/packed-backend.c
	+++ b/refs/packed-backend.c
	@@ -740,6 +740,7 @@ static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
	 	if (!rec) {
	 		/* refname is not a packed reference. */
	 		*failure_errno = ENOENT;
	+		errno = 0;
	 		return -1;
	 	}

Which also passes all our tests, and the packed_read_raw_ref() suggests how you may have come up with the current pattern.

Show 13 quoted lines
> [...]
> - * Return 0 on success. If the ref doesn't exist, set errno to ENOENT
> - * and return -1. If the ref exists but is neither a symbolic ref nor
> - * an object ID, it is broken; set REF_ISBROKEN in type, and return -1
> - * (errno should not be ENOENT) If there is another error reading the
> - * ref, set errno appropriately and return -1.
> + * Return 0 on success. If the ref doesn't exist, set failure_errno to ENOENT
> + * and return -1. If the ref exists but is neither a symbolic ref nor an object
> + * ID, it is broken; set REF_ISBROKEN in type, and return -1 (failure_errno
> + * should not be ENOENT). The files backend may return EISDIR (if the ref name
> + * is a directory) and ENOTDIR (if a ref prefix is not a directory). If there is
> + * another error reading the ref, set failure_errno appropriately and return -1.
>   *

This documentation is a bit confusing in light of the above comments. I assume that "set failure_errno appropriately" here means that it will do it, but it's really worded like it's suggesting that you should do it, and does the "another error" suggest that a caller may need to deal with an arbitrary errno, not just the ENOENT|EISDIR|ENOTDIR?

Previous: Han-Wen Nienhuys via GitGitGadgetNext: Han-Wen Nienhuys
Message 46 of 148 in “refs: cleanup errno sideband ref related functions”
  1. 0/8 refs: cleanup errno sideband ref related functionsHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  2. 1/8 refs: remove EINVAL specification from the errno sideband in read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  3. Junio C HamanoApr 30, 2021
  4. Han-Wen NienhuysMay 19, 2021
  5. Jonathan TanJun 3, 2021
  6. Han-Wen NienhuysJun 9, 2021
  7. 2/8 refs/files-backend: stop setting errno from lock_ref_oid_basicHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  8. Junio C HamanoApr 30, 2021
  9. Han-Wen NienhuysMay 19, 2021
  10. Jonathan TanJun 3, 2021
  11. Han-Wen NienhuysJun 10, 2021
  12. 4/8 refs: make errno output explicit for refs_resolve_ref_unsafeHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  13. Jonathan TanJun 3, 2021
  14. Han-Wen NienhuysJun 10, 2021
  15. 5/8 refs: add failure_errno to refs_read_raw_ref() signatureHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  16. 3/8 refs: make errno output explicit for read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  17. Junio C HamanoApr 30, 2021
  18. Junio C HamanoApr 30, 2021
  19. Han-Wen NienhuysMay 19, 2021
  20. Jonathan TanJun 3, 2021
  21. Han-Wen NienhuysJun 10, 2021
  22. 8/8 refs: explicitly propagate errno from refs_read_raw_refHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  23. 6/8 refs: clear errno return in refs_resolve_ref_unsafe()Han-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  24. Jonathan TanJun 3, 2021
  25. Han-Wen NienhuysJun 10, 2021
  26. 7/8 refs: stop setting EINVAL and ELOOP in symref resolutionHan-Wen Nienhuys via GitGitGadget, Apr 29, 2021
  27. Jonathan TanJun 3, 2021
  28. Han-Wen NienhuysJun 10, 2021
  29. Jonathan TanJun 3, 2021
  30. Han-Wen NienhuysJun 9, 2021
  31. 0/8 refs: cleanup errno sideband ref related functionsHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  32. 5/8 refs: use refs_resolve_ref_unsafe_with_errno() where neededHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  33. Ævar Arnfjörð BjarmasonJul 1, 2021
  34. 4/8 refs: make errno output explicit for refs_resolve_ref_unsafeHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  35. Ævar Arnfjörð BjarmasonJul 1, 2021
  36. 8/8 refs: explicitly propagate errno from refs_read_raw_refHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  37. Ævar Arnfjörð BjarmasonJul 1, 2021
  38. Han-Wen NienhuysJul 5, 2021
  39. Ævar Arnfjörð BjarmasonJul 5, 2021
  40. Han-Wen NienhuysJul 5, 2021
  41. 1/8 refs: remove EINVAL errno output from specification of read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  42. 2/8 refs/files-backend: stop setting errno from lock_ref_oid_basicHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  43. Ævar Arnfjörð BjarmasonJul 1, 2021
  44. Han-Wen NienhuysJul 5, 2021
  45. 3/8 refs: make errno output explicit for read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  46. Ævar Arnfjörð BjarmasonJul 1, 2021
  47. Han-Wen NienhuysJul 5, 2021
  48. 6/8 refs: add failure_errno to refs_read_raw_ref() signatureHan-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  49. Ævar Arnfjörð BjarmasonJul 1, 2021
  50. 7/8 refs: clear errno return in refs_resolve_ref_unsafe()Han-Wen Nienhuys via GitGitGadget, Jun 10, 2021
  51. Ævar Arnfjörð BjarmasonJul 1, 2021
  52. Han-Wen NienhuysJun 14, 2021
  53. 0/5 refs: cleanup errno sideband ref related functionsHan-Wen Nienhuys via GitGitGadget, Jul 5, 2021
  54. 1/5 refs: remove EINVAL errno output from specification of read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jul 5, 2021
  55. 2/5 refs/files-backend: stop setting errno from lock_ref_oid_basicHan-Wen Nienhuys via GitGitGadget, Jul 5, 2021
  56. 3/5 refs: make errno output explicit for read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jul 5, 2021
  57. 4/5 refs: add failure_errno to refs_read_raw_ref() signatureHan-Wen Nienhuys via GitGitGadget, Jul 5, 2021
  58. Junio C HamanoJul 6, 2021
  59. 5/5 refs: make errno output explicit for refs_resolve_ref_unsafeHan-Wen Nienhuys via GitGitGadget, Jul 5, 2021
  60. Ævar Arnfjörð BjarmasonJul 6, 2021
  61. Han-Wen NienhuysJul 6, 2021
  62. Ævar Arnfjörð BjarmasonJul 6, 2021
  63. Han-Wen NienhuysJul 6, 2021
  64. 0/6 refs: cleanup errno sideband ref related functionsHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  65. 1/6 refs: remove EINVAL errno output from specification of read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  66. 2/6 refs/files-backend: stop setting errno from lock_ref_oid_basicHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  67. 5/6 refs: explicitly return failure_errno from parse_loose_ref_contentsHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  68. Junio C HamanoJul 6, 2021
  69. Han-Wen NienhuysJul 7, 2021
  70. 3/6 refs: make errno output explicit for read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  71. 4/6 refs: add failure_errno to refs_read_raw_ref() signatureHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  72. Junio C HamanoJul 6, 2021
  73. 6/6 refs: make errno output explicit for refs_resolve_ref_unsafeHan-Wen Nienhuys via GitGitGadget, Jul 6, 2021
  74. 0/6 refs: cleanup errno sideband ref related functionsHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  75. 1/6 refs: remove EINVAL errno output from specification of read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  76. 2/6 refs/files-backend: stop setting errno from lock_ref_oid_basicHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  77. Ævar Arnfjörð BjarmasonJul 11, 2021
  78. Han-Wen NienhuysJul 13, 2021
  79. 3/6 refs: make errno output explicit for read_raw_ref_fnHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  80. Ævar Arnfjörð BjarmasonJul 11, 2021
  81. 4/6 refs: add failure_errno to refs_read_raw_ref() signatureHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  82. Ævar Arnfjörð BjarmasonJul 11, 2021
  83. Han-Wen NienhuysJul 13, 2021
  84. 5/6 refs: explicitly return failure_errno from parse_loose_ref_contentsHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  85. Ævar Arnfjörð BjarmasonJul 11, 2021
  86. 6/6 refs: make errno output explicit for refs_resolve_ref_unsafeHan-Wen Nienhuys via GitGitGadget, Jul 7, 2021
  87. Junio C HamanoJul 7, 2021
  88. 00/17 refs API: get rid of errno setting entirelyÆvar Arnfjörð Bjarmason, Jul 11, 2021
  89. 01/17 refs: remove EINVAL errno output from specification of read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 11, 2021
  90. 03/17 refs: make errno output explicit for read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 11, 2021
  91. 02/17 refs/files-backend: stop setting errno from lock_ref_oid_basicÆvar Arnfjörð Bjarmason, Jul 11, 2021
  92. 04/17 refs: add failure_errno to refs_read_raw_ref() signatureÆvar Arnfjörð Bjarmason, Jul 11, 2021
  93. 05/17 refs: explicitly return failure_errno from parse_loose_ref_contentsÆvar Arnfjörð Bjarmason, Jul 11, 2021
  94. 06/17 refs: make errno output explicit for refs_resolve_ref_unsafeÆvar Arnfjörð Bjarmason, Jul 11, 2021
  95. 07/17 refs: make errno ignoring explicit in lock_ref_oid_basic()Ævar Arnfjörð Bjarmason, Jul 11, 2021
  96. 10/17 refs API: remove refs_read_ref_full() wrapperÆvar Arnfjörð Bjarmason, Jul 11, 2021
  97. 11/17 refs API: make resolve_gitlink_ref() not set errnoÆvar Arnfjörð Bjarmason, Jul 11, 2021
  98. 08/17 refs file-backend.c: stop setting "EBUSY" in verify_lock()Ævar Arnfjörð Bjarmason, Jul 11, 2021
  99. Han-Wen NienhuysJul 13, 2021
  100. 09/17 refs file-backend.c: deal with errno directly in verify_lock()Ævar Arnfjörð Bjarmason, Jul 11, 2021
  101. 12/17 refs API: make refs_resolve_ref_unsafe() staticÆvar Arnfjörð Bjarmason, Jul 11, 2021
  102. 13/17 refs API: make refs_resolve_refdup() not set errnoÆvar Arnfjörð Bjarmason, Jul 11, 2021
  103. 14/17 refs API: make refs_ref_exists() not set errnoÆvar Arnfjörð Bjarmason, Jul 11, 2021
  104. 15/17 refs API: make resolve_ref_unsafe() not set errnoÆvar Arnfjörð Bjarmason, Jul 11, 2021
  105. Han-Wen NienhuysJul 13, 2021
  106. Ævar Arnfjörð BjarmasonJul 14, 2021
  107. 17/17 refs API: don't leak "errno" in run_transaction_hook()Ævar Arnfjörð Bjarmason, Jul 11, 2021
  108. 16/17 refs API: make expand_ref() and repo_dwim_log() not set errnoÆvar Arnfjörð Bjarmason, Jul 11, 2021
  109. Han-Wen NienhuysJul 13, 2021
  110. Ævar Arnfjörð BjarmasonJul 13, 2021
  111. Ævar Arnfjörð BjarmasonJul 14, 2021
  112. Han-Wen NienhuysJul 14, 2021
  113. 0/6 refs: cleanup errno sideband ref related functionsÆvar Arnfjörð Bjarmason, Jul 14, 2021
  114. 1/6 refs: remove EINVAL errno output from specification of read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 14, 2021
  115. 2/6 refs/files-backend: stop setting errno from lock_ref_oid_basicÆvar Arnfjörð Bjarmason, Jul 14, 2021
  116. 3/6 refs: make errno output explicit for read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 14, 2021
  117. 4/6 refs: add failure_errno to refs_read_raw_ref() signatureÆvar Arnfjörð Bjarmason, Jul 14, 2021
  118. 5/6 refs: explicitly return failure_errno from parse_loose_ref_contentsÆvar Arnfjörð Bjarmason, Jul 14, 2021
  119. 6/6 refs: make errno output explicit for refs_resolve_ref_unsafeÆvar Arnfjörð Bjarmason, Jul 14, 2021
  120. 0/7 refs: cleanup errno sideband ref related functionsÆvar Arnfjörð Bjarmason, Jul 16, 2021
  121. 1/7 refs file backend: move raceproof_create_file() hereÆvar Arnfjörð Bjarmason, Jul 16, 2021
  122. 3/7 refs/files-backend: stop setting errno from lock_ref_oid_basicÆvar Arnfjörð Bjarmason, Jul 16, 2021
  123. 2/7 refs: remove EINVAL errno output from specification of read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 16, 2021
  124. 4/7 refs: make errno output explicit for read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 16, 2021
  125. 5/7 refs: add failure_errno to refs_read_raw_ref() signatureÆvar Arnfjörð Bjarmason, Jul 16, 2021
  126. 6/7 refs: explicitly return failure_errno from parse_loose_ref_contentsÆvar Arnfjörð Bjarmason, Jul 16, 2021
  127. 7/7 refs: make errno output explicit for refs_resolve_ref_unsafeÆvar Arnfjörð Bjarmason, Jul 16, 2021
  128. 0/7 refs: cleanup errno sideband ref related functionsÆvar Arnfjörð Bjarmason, Jul 20, 2021
  129. 1/7 refs file backend: move raceproof_create_file() hereÆvar Arnfjörð Bjarmason, Jul 20, 2021
  130. 2/7 refs: remove EINVAL errno output from specification of read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 20, 2021
  131. 3/7 refs/files-backend: stop setting errno from lock_ref_oid_basicÆvar Arnfjörð Bjarmason, Jul 20, 2021
  132. 4/7 refs: make errno output explicit for read_raw_ref_fnÆvar Arnfjörð Bjarmason, Jul 20, 2021
  133. Han-Wen NienhuysAug 16, 2021
  134. 5/7 refs: add failure_errno to refs_read_raw_ref() signatureÆvar Arnfjörð Bjarmason, Jul 20, 2021
  135. 6/7 refs: explicitly return failure_errno from parse_loose_ref_contentsÆvar Arnfjörð Bjarmason, Jul 20, 2021
  136. Jonathan TanAug 13, 2021
  137. 7/7 refs: make errno output explicit for refs_resolve_ref_unsafeÆvar Arnfjörð Bjarmason, Jul 20, 2021
  138. Ævar Arnfjörð BjarmasonJul 26, 2021
  139. Junio C HamanoJul 27, 2021
  140. 0/8 refs: cleanup errno sideband ref related functionsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  141. 1/8 refs file backend: move raceproof_create_file() hereÆvar Arnfjörð Bjarmason, Aug 23, 2021
  142. 2/8 refs: remove EINVAL errno output from specification of read_raw_ref_fnÆvar Arnfjörð Bjarmason, Aug 23, 2021
  143. 3/8 refs/files-backend: stop setting errno from lock_ref_oid_basicÆvar Arnfjörð Bjarmason, Aug 23, 2021
  144. 4/8 refs: make errno output explicit for read_raw_ref_fnÆvar Arnfjörð Bjarmason, Aug 23, 2021
  145. 5/8 refs: add failure_errno to refs_read_raw_ref() signatureÆvar Arnfjörð Bjarmason, Aug 23, 2021
  146. 6/8 branch tests: test for errno propagating on failing readÆvar Arnfjörð Bjarmason, Aug 23, 2021
  147. 7/8 refs: explicitly return failure_errno from parse_loose_ref_contentsÆvar Arnfjörð Bjarmason, Aug 23, 2021
  148. 8/8 refs: make errno output explicit for refs_resolve_ref_unsafeÆvar Arnfjörð Bjarmason, Aug 23, 2021

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.