git: add subcommand for setting custom README

Assigned to
1 year, 8 months ago
8 months ago
No labels applied.

~xenrox 1 year, 8 months ago

hut can already do this. It was added in this commit, which is not released yet. That is why I haven't yet send a patch to update man.sr.ht.

~sircmpwn 1 year, 8 months ago


~xenrox 1 year, 8 months ago

I have created a simple example repository, that uses a build manifest with the hut development version to set the custom README. Maybe this is enough of a reference point for now.

~vladh (edited) 1 year, 6 months ago

This currently works, except that there is a bug. To set the README back to normal, i.e. to the README.md file or whatever, the API expects to receive null in the "readme" field. However, null can't be sent from hut(1), because gqlclientgen will then simply omit the field altogether. The solution needs to distinguish between (1) the "readme" field being absent (2) the "readme" field being null (3) the "readme" field being a string. I've looked around a bunch but haven't figured out a good solution. :(

[18:45:49] <vladh> gqlclientgen always adds `json:"...,omitempty"` to generated structs. this means that `null` values can't be meaningfully used. in hut(1), a repo's "readme" field should be a string to set the readme to, or `null` to set it back to normal. this behaviour is not possible so there's a bug there. not sure what the solution is, seems like a pain tbh.
[20:02:41] <emersion> vladh: there are cases where null isn't desirable either
[20:02:55] <emersion> for instance if you don't want to update the readme at all
[20:03:11] <emersion> so we'd need a tri-state of some kind
[20:32:59] <vladh> I agree, I just don't think the default JSON marshalling stuff supports that, so it feels like hut(1) might need some custom marshalling stuff...

~emersion (edited) 8 months ago

Thorben G√ľnther referenced this ticket in commit 14fd389.

~xenrox REPORTED CLOSED 8 months ago

Have prepared a patch for the docs.

Register here or Log in to comment, or comment via email.