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

WIP/RFC remote-vfs transport. #190

Conversation

jeffhostetler
Copy link

Basic functionality. See remote-vfs.c for overview.

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

I left a couple of comments, and have to admit that I was quite a bit distracted by those ///// lines, unnecessary if (ret == HTTP_OK) ... blocks and it seems that at least parts of the code are not necessarily DRY (I also have to admit that reviewer fatigue kicked in around the do_post() function...).

return HTTP_OK;

if (ret != HTTP_REAUTH)
return ret;
Copy link
Member

Choose a reason for hiding this comment

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

Is if (ret == HTTP_OK) return HTTP_OK; really necessary? That case is already handled by the ret != HTTP_REAUTH clause, so it just adds distracting code...

Copy link
Author

Choose a reason for hiding this comment

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

this aids in debugging, since we can set breakpoints on either the success or failure cases independently.

&http_response_code, error_message);
trace2_region_leave("remote-vfs", "GET/object/main2", NULL);
if (ret == HTTP_OK)
return HTTP_OK;
Copy link
Member

Choose a reason for hiding this comment

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

Again, deleting these two lines will make the code easier to read, without actually changing the behavior.

Copy link
Author

Choose a reason for hiding this comment

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

again, this is for debugging and breakpoints. the compiler should be able to flatten it out.

Copy link
Member

Choose a reason for hiding this comment

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

Sure. The compiler can optimize this. I, however, cannot optimize this, when reviewing, and my eyes and my mind tires from such repetition...

return ret;

if (!rv_opts.param__allow_fallback)
return ret;
Copy link
Member

Choose a reason for hiding this comment

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

How about combining conditions into a single if, when the conditional action is the same anyway?

Copy link
Author

Choose a reason for hiding this comment

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

combining a bunch of unrelated logic just to DRY a "return" statement IMHO obscures the meaning. and again, makes it more difficult to set specific breakpoints.

Copy link

@derrickstolee derrickstolee 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 few small comments to get started while I had some downtime. I need to get this running on my machine for local testing, but then the end-to-end tests will be the real key to having confidence in the change. (the functional test suite will give it a real exercise.)

// none := assume neither mode.
//
// The <mode> is used to look for mode-specific config settings:
// "<mode>.cache-server" and "core.<mode>".

Choose a reason for hiding this comment

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

Note: at the moment, we still use core.gvfs. This may change in the future, so having the comment here is helpful.


odb = the_repository->objects->odb;
if (!odb)
return;

Choose a reason for hiding this comment

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

Should this be an error state? Or should we assign rv_opts.param__*_odb_path = the_repository->objects->path?

Copy link
Author

Choose a reason for hiding this comment

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

Funny story. Turns out that prepare_alt_obj() will segfault before we get here if there isn't an ODB. The fix is to require the process to be inside a worktree.

@jeffhostetler
Copy link
Author

abandoning this PR in favor of a new one after a major refactoring.

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.

6 participants