Skip to content

remote: add typedef to normalize push_update_reference callback#4363

Merged
ethomson merged 1 commit into
libgit2:masterfrom
cjhoward92:typedef-push-update-reference
Oct 6, 2017
Merged

remote: add typedef to normalize push_update_reference callback#4363
ethomson merged 1 commit into
libgit2:masterfrom
cjhoward92:typedef-push-update-reference

Conversation

@cjhoward92

Copy link
Copy Markdown
Contributor

I added a typedef for push_update_reference in remote.h to make the callback fit with other well defined callbacks. If this is inappropriate or there is some reason for not having a typedef, let me know.

@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.

Hi @cjhoward92, thank you for your PR.

I guess the change itself is okay. There are some minor things that can be improved, though. It would be cool if you could address those issues. Furthermore, I'd appreciate it if you squash together all commits here, as they are logically a single unit of change, only. Additional kudos if you could prefix the commit message's subject with a scope, e.g. "remote: add typedef for git_push_update_reference_cb". Note also the tense, where we (adopted from core git) prefer to describe what the commit does instead of saying what we have done (so no past tense here).

If you address those things I'm happy to merge 👍

Comment thread include/git2/remote.h

/**
* Called for each updated reference on push. If `status` is
* not `NULL`, the update was rejected by the remote server

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.

The style for function documentation is usually as follows:

/**
 * Short summary of that thing
 *
 * A longer description which may span multiple lines
 * and describes what that symbol actually is/does.
 *
 * @param frobnicate frobnicate all the stuff
 * @return 0 on foo, otherwise an error
 */

So please separate the summary and descriptions here and add an @return description, such that developers know what they may return from that callback.

Comment thread include/git2/remote.h Outdated
*/
typedef int (*git_push_update_reference_cb)(const char *refname, const char *status, void *data);


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.

There's one newline too many here

Comment thread include/git2/remote.h
@@ -456,7 +468,7 @@ struct git_remote_callbacks {
* not `NULL`, the update was rejected by the remote server
* and `status` contains the reason given.
*/

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 comment is duplicated now. You may replace it with something like "See documentation of git_push_update_reference_cb".

Very many callbacks in libgit2 have some sort of typedef to normalize the name at git_<name_of_operation>_cb. Add a typedef for push_update_references in the remote so the name follows the same conventions.
@cjhoward92 cjhoward92 force-pushed the typedef-push-update-reference branch from 4488036 to 7138ce3 Compare October 6, 2017 14:16
@cjhoward92 cjhoward92 changed the title Added typedef for push-update-reference remote: add typedef to normalize push_update_reference callback Oct 6, 2017
@cjhoward92

Copy link
Copy Markdown
Contributor Author

@pks-t Thanks for the feedback! I would very much like to get this merged. Hopefully the changes I made suit the needs of libgit2 better. Let me know if there is anything else I can do for you!

@ethomson

ethomson commented Oct 6, 2017

Copy link
Copy Markdown
Member

Thanks for fixing this up @cjhoward92. These changes look 👍 to me - appreciate you making them.

Since this is a blocker for nodegit, I'm going to go ahead and merge this. If there are additional changes we can iterate from here.

@ethomson ethomson merged commit 668fa07 into libgit2:master Oct 6, 2017
@cjhoward92

Copy link
Copy Markdown
Contributor Author

Thanks Ed! Right now we should be set. If you apply need someone to go through and add more callback typedefs or clean anything up I'd be more than happy to. One of those simple maintenance things that a new contributor like me can do!

@cjhoward92 cjhoward92 deleted the typedef-push-update-reference branch October 9, 2017 14:05
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.

3 participants