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

Rename options initialization functions #5101

Merged
merged 2 commits into from
Jun 14, 2019
Merged

Rename options initialization functions #5101

merged 2 commits into from
Jun 14, 2019

Conversation

ethomson
Copy link
Member

@ethomson ethomson commented Jun 8, 2019

Rename opt init functions to options_init

In libgit2 nomenclature, when we need to verb a direct object, we name a function git_directobject_verb. Thus, if we need to init an options structure named git_foo_options, then the name of the function that does that should be git_foo_options_init.

The previous names of git_foo_init_options is close - it sounds as if it's initializing the options of a foo, but in fact git_foo_options is its own noun that should be respected.

Deprecate the old names; they'll now call directly to the new ones.

Additionally, add an initializer function for git_apply_options.

Copy link
Contributor

@tiennou tiennou left a comment

Choose a reason for hiding this comment

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

Just a nitpick. I'm 👍 on the normalization.

@@ -520,19 +520,19 @@ void test_diff_blob__can_compare_a_binary_blob_and_a_text_blob(void)
* +++ b/a0f7217
* @@ -1,6 +1,6 @@
* Here is some stuff at the start
*
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Spurious whitespace change ? The build was red, but I haven't yet looked at the build log.

@ethomson
Copy link
Member Author

The build was red

Thanks, I forgot to build locally with hard deprecation enabled.

@ethomson
Copy link
Member Author

Hey @pks-t, are you also 👍 on renaming these? I think that they're more "correct" this way, but naming is pretty subjective.

@pks-t
Copy link
Member

pks-t commented Jun 13, 2019

I'm 👍 Those names have bothered me several times, so the change is very welcome. You forgot to convert one instance in "src/proxy.c", otherwise this looks good to me!

@ethomson
Copy link
Member Author

I'm 👍 Those names have bothered me several times, so the change is very welcome. You forgot to convert one instance in "src/proxy.c", otherwise this looks good to me!

I'm not seeing it, I only see git_proxy_options_init as the new impl (which git_proxy_init_options delegates to).

@pks-t
Copy link
Member

pks-t commented Jun 14, 2019

git_proxy_options_dup still makes use of git_proxy_init_options.

In libgit2 nomenclature, when we need to verb a direct object, we name
a function `git_directobject_verb`.  Thus, if we need to init an options
structure named `git_foo_options`, then the name of the function that
does that should be `git_foo_options_init`.

The previous names of `git_foo_init_options` is close - it _sounds_ as
if it's initializing the options of a `foo`, but in fact
`git_foo_options` is its own noun that should be respected.

Deprecate the old names; they'll now call directly to the new ones.
@ethomson
Copy link
Member Author

git_proxy_options_dup still makes use of git_proxy_init_options.

Aha - yes! I missed that twice. Thanks, and fixed.

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

3 participants