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

Fire progress and update tips callbacks also for pushes. #2284

Merged
merged 8 commits into from
Apr 25, 2014
Merged

Fire progress and update tips callbacks also for pushes. #2284

merged 8 commits into from
Apr 25, 2014

Conversation

jacquesg
Copy link
Contributor

It's not very useful to only know that a pre-receive hook has declined a push, you probably want to know why. We were only firing of the progress callback for fetch operations.

I've also fixed a leak here if you return < 0 in the callback (and cleaned it up a little) and made it only not fire any more callbacks of that type if you return < 0. I don't think that on receiving a text message from the remote should allow you to cancel the operation. Normally if the operation should not succeed, the remote side will anyway force failure (cancellation) by not allowing the push/fetch to continue.

@jacquesg
Copy link
Contributor Author

We should probably also run the online tests, not sure how to do this?

@jacquesg
Copy link
Contributor Author

Some travis failure :( Will fix it.

@jamill
Copy link
Member

jamill commented Apr 20, 2014

  1. The client might not be making a decision to cancel based on the data in the progress callback - this might just be the first chance that the client has an opportunity to set the cancel flag.

  2. If we don't want to expose cancellation through the progress callback, maybe we should just remove the return value on the callback (so if you sign up for progress callbacks, you always get them).

@jacquesg
Copy link
Contributor Author

Don't you think if you need to be able to cancel the operation, it would be better suited to do it in i.e. completion, transfer_progress or update_tips? Realistically, you will see activity on the progress callback when the remote side is compressing data (for fetches)/ running hooks (for pushes). By the time it is actually running the hooks, its quite late in the operation, that is, data has already been uploaded and its just (possibly) running pre-receive and/or post-receive (when it runs post-receive cancelling will have no effect).

@jacquesg
Copy link
Contributor Author

I actually feel that progress is too overloaded here, because we also have transfer_progress and push_transfer_progress. @carlosmn It may be a good idea to rename this to something like remote_text? Ultimately this callback always receives text that the remote side has sent us and IMHO would be a more apt name.

@jacquesg
Copy link
Contributor Author

Actually the test case failure that I had was attributed to the naming confusion 😄 Checked the incorrect callback...

@arthurschreiber
Copy link
Member

Don't you think if you need to be able to cancel the operation, it would be better suited to do it in i.e. completion, transfer_progress or update_tips?

The main use-case here is for bindings. If e.g. we see an exception getting raised from Ruby-Land in Rugged, we need to somehow signal that to libgit2, and correctly abort the current operation.

@jacquesg
Copy link
Contributor Author

Fair enough.

It's not very useful to only know that a pre-receive hook has declined
a push, you probably want to know why.
@carlosmn
Copy link
Member

@jacquesg 'progress' is the channel used to transmit said data.

@jacquesg
Copy link
Contributor Author

Ok well, then we should probably not change it :)

@jacquesg
Copy link
Contributor Author

I've changed it so the return code of callbacks are checked. If != 0, we convert to GIT_EUSER (based on existing one I found). Also fixed 1 or 2 others that didn't check the return code.

@carlosmn
Copy link
Member

Current (wanted) behaviour is to propagate the error from the caller.

@jacquesg
Copy link
Contributor Author

Ok, so the user is required to return < 0 and we should just set error to that? If so, do we consider return codes >=0 as success?

@jamill
Copy link
Member

jamill commented Apr 20, 2014

'progress' is the channel used to transmit said data.

I also think that progress is a bit generic and can cause confusion - especially for someone not familiar with the names of the channels on the network protocol. What if we named this something a little more descriptive then just progress (e.g. progress_channel, progress_channel_text,...) .

@carlosmn
Copy link
Member

We could call it sideband_progress. I'd rather stay away from anyting with 'text' in it, as we can't really promise that text is going to come out.

@jacquesg
Copy link
Contributor Author

sideband_progress sound reasonable.

@jacquesg
Copy link
Contributor Author

Turns out that we are also never executing update_tips callbacks for pushes. There is some extra work to be done in the test cases, we are recording the information, but never actually checking it.

@jacquesg
Copy link
Contributor Author

Comments?

@jacquesg jacquesg changed the title Fire progress callbacks also for pushes. Fire progress and update tips callbacks also for pushes. Apr 21, 2014
@vmg
Copy link
Member

vmg commented Apr 23, 2014

Looks good to me. @carlosmn?

@jacquesg
Copy link
Contributor Author

Probably ok unless someone still wants to review but hasn't gotten round to it?

vmg pushed a commit that referenced this pull request Apr 25, 2014
Fire progress and update tips callbacks also for pushes.
@vmg vmg merged commit 8443ed6 into libgit2:development Apr 25, 2014
phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
Fire progress and update tips callbacks also for pushes.
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

5 participants