Skip to content

Fix docurium missing includes#4530

Merged
pks-t merged 15 commits into
libgit2:masterfrom
tiennou:fix/docurium-missing-includes
Jun 1, 2018
Merged

Fix docurium missing includes#4530
pks-t merged 15 commits into
libgit2:masterfrom
tiennou:fix/docurium-missing-includes

Conversation

@tiennou

@tiennou tiennou commented Feb 12, 2018

Copy link
Copy Markdown
Contributor

The first commit makes git_oid & git_buf "globally" visible (ie. less likely to be forgotten) by including them from types.h. If that's not really appropriate, it could be fixed more precisely by going through each error from this script.

Apart from a typechange (see worktree: commit), the rest is minor fixups + missing documentation.

Fixes #4213, #4495, maybe #4492.

@tiennou

tiennou commented Feb 12, 2018

Copy link
Copy Markdown
Contributor Author

I've pushed my work-in-progress to my own gh-pages branch so it's available here. Note that it requires tweaks to docurium which aren't upstream (yet, there's some in a PR, but now there's more 😉).

Highlights :

  • the transaction section makes its first appearance.
  • I've disabled a check for debugging reasons which makes every valid identifier at least appear (hence the imaxdiv section, which comes from git2/stdint.h, and surely a bunch of others). Still not sure whether we want that or not (the rationale for the change is warnings about undocumented things when docurium-ing)
  • some types lost their documentation (eg. git_odb_backend). IIUC, it stems from parsing the "quick" comment from git2/types.h before the real struct def in git2/sys/odb_backend.h. Still investigating.

@pks-t pks-t left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Really, thanks a lot for working on this! Documentation is always a very important piece of the puzzle that most developers (including myself) hate working on. Some comments below.

Comment thread include/git2/attr.h
* are multiple rules for a given file. The highest priority rule will be
* used.
*
* @see git_attr_foreach.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think there should be a trailing dot here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, I think it reads better, but I checked and the usage is clear. I'll change it, though it seems docurium doesn't know about @see anyways…

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We do have some special syntax for referring to other functions, I just always forget about it... and right now I cannot find any examples for it, either. Maybe prefixing it with an @? No idea...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I haven't been able to pinpoint a specific syntax in the docurium code, or any specific behavior w.r.t javadoc comments for that matter. As far as I can see, it checks function arguments against the list of known types and build links that way, but it only does this on functions. I've tried extending it to struct fields to no avail.

Comment thread include/git2/worktree.h Outdated
/**
* Worktree add options structure
*
* Zero out for defaults. Initialize with `GIT_WORKTREE_ADD_OPTIONS_INIT`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We shouldn't recommend zeroing out the struct, but only using GIT_WORKTREE_ADD_OPTIONS_INIT or the corresponding function, I guess.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IIRC this is copy-pasted from git_checkout_options. So what about something like :

/**
 * $STRUCT_DESCRIPTION
 *
 * Initialize with `$STRUCT_INIT_MACRO`. Alternatively, you can
 * use `$STRUCT_INIT_FN`.
 * 
 * @see $STRUCT_USERS
 */

and I take a look to make sure all conform to this style ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I expected that this was copied from somewhere else, but was too lazy to double-check :P Your proposal would certainly be fine with me, and removing references to zeroing out the structure are definitly welcome.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed with @pks-t, and I like this text you've provided.

Comment thread include/git2/worktree.h Outdated
/**
* Worktree prune options structure
*
* Zero out for defaults. Initialize with `GIT_WORKTREE_PRUNE_OPTIONS_INIT`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here wrt zeroing out the struct.

Comment thread include/git2/worktree.h Outdated
unsigned int version;

uint32_t flags;
git_worktree_prune_t flags;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not correct, though. An enum should always have a valid enum value, only, and not be used as a field of bits. As we're ORing multiple flags into this field this has to bee an uint32.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, I missed the ORing 🙄. Will drop from patchset. I was trying to get nice a link to show up, so I'll make it a doc-comment instead.

@tiennou tiennou force-pushed the fix/docurium-missing-includes branch 2 times, most recently from df10416 to c520b52 Compare February 20, 2018 01:10
@tiennou

tiennou commented Feb 20, 2018

Copy link
Copy Markdown
Contributor Author

Rebased, removed the worktree change, mass-rewritten the options_init comments, fixed a few more things, and merged in my changed which requires upstream support (PR).

This fixes #4495, #4213, makes most of the stuff in git2/sys/ visible, and changes the styling of structs for clarity (fixes #3779).

Some examples :

See my doc branch here.

Some things I don't quite like : I get many errors when docuriuming old tagged releases, and I don't think they can be fixed, or even if it's worth the pain of doing workarounds. As far as I can tell, there are no severe losses in documentation vs. the vanilla docurium.

@tiennou tiennou force-pushed the fix/docurium-missing-includes branch from e94310e to 90be04e Compare March 22, 2018 22:27

@pks-t pks-t left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks all good to me, I noticed one minor typo though. @carlosmn, as you're the one handling doc generation most of the time: do you have any comments?

#define INCLUDE_git_transaction_h__

#include "common.h"
#include "types.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hum. Good enough for now, I'd say. I feel like we should just include "types.h" in "common.h", as nearly every header wants "types.h" to be included. Can be done in a separate PR, though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 on that. I fear the next time an header is added, it will be forgotten and the clang-parse phase of docurium will get incomplete results.

Comment thread include/git2/attr.h Outdated
* @see git_attr_foreach.
*
* @param name The attribute name.
* @param value The attribute value. May be NULL is the attribute is explicitly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Typo: "s/is/if"

@tiennou tiennou force-pushed the fix/docurium-missing-includes branch from 90be04e to 73ce3ea Compare March 26, 2018 18:25
Comment thread include/git2/blame.h
*/
size_t min_line;
/** The last line in the file to blame.
* The default is the last line of the file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Quick drive-by comment as I accidentally stumbled over these lines: the style should rather be

/**
 * Foobar
 */

Comment thread include/git2/describe.h
}

/**
* Initialize git_describe_options structure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one and git_describe_init_format_options both miss the leading short doc string that you're consistently using for the other init_options functions now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed-up !

@tiennou tiennou force-pushed the fix/docurium-missing-includes branch from 8896716 to 04c48af Compare May 7, 2018 19:50
@pks-t pks-t merged commit bae6ed6 into libgit2:master Jun 1, 2018
@pks-t

pks-t commented Jun 1, 2018

Copy link
Copy Markdown
Member

Thanks @tiennou for handling this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

does git_stash_save() exists? Or how to perform "git stash" in libgit2

3 participants