Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs for PushUpdate, push_negotiation, plus a bit more #1044

Merged
merged 3 commits into from Apr 15, 2024

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Apr 14, 2024

For PushUpdate, I took some of the phrasing from
https://libgit2.org/libgit2/#HEAD/type/git_push_update

Before looking at the code, I didn't realize that the functions returning None means the reference name is not UTF-8, as opposed to the reference not existing.

(I wish the return value for ..._refname functions would just be Result<&str, UTFDecodeError>, but that would be a breaking change.)

For PushNegotiation and push_negotiation, only the latter has docs accessible via docs.rs, but its docstring was less helpful. See also the commit description.

I took some of the phrasing from
https://libgit2.org/libgit2/#HEAD/type/git_push_update

Before looking at the code, I didn't realize that the functions
returning `None` means the reference name is not UTF-8, as opposed to
the reference not existing.
@ilyagr ilyagr marked this pull request as ready for review April 14, 2024 03:33
@ilyagr ilyagr marked this pull request as draft April 14, 2024 03:36
@ilyagr ilyagr changed the title Improve docs for PushUpdate Improve docs for PushUpdate, push_negotiation, plus a bit more Apr 14, 2024
@ilyagr ilyagr marked this pull request as ready for review April 14, 2024 03:45
This was motivated by the observations that:

- The [`PushNegotiation` docstring] was previously much more informative
  than the docstring for `push_negotiation`.

- The `PushNegotiation` docstring does not seem to be accessible via
  https://docs.rs/git2/0.18.3/git2/index.html. Only the less helpful
docstring is accessible at
https://docs.rs/git2/0.18.3/git2/struct.RemoteCallbacks.html#method.push_negotiation.

[`PushNegotiation` docstring]: rust-lang@920c838#diff-ccd8cf48c67bd6cc71379f93a6b51abdb10954497a0db353908a7cf20995ef61R92-R99
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I pushed a small change to fix the indentation in the documentation.

@ehuss ehuss enabled auto-merge April 15, 2024 17:12
@ehuss ehuss added this pull request to the merge queue Apr 15, 2024
Merged via the queue into rust-lang:master with commit c3454fe Apr 15, 2024
7 checks passed
@ilyagr ilyagr deleted the docs branch April 15, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants