Skip to content

Remove git_push_set_refspecs#2221

Closed
tiennou wants to merge 9 commits intolibgit2:developmentfrom
tiennou:merge-refspec-parsing
Closed

Remove git_push_set_refspecs#2221
tiennou wants to merge 9 commits intolibgit2:developmentfrom
tiennou:merge-refspec-parsing

Conversation

@tiennou
Copy link
Contributor

@tiennou tiennou commented Mar 30, 2014

This makes push use the refspec code to parse refspecs instead of duplicated code, and removes git_push_set_refspecs in favor of getting whatever is set in the remote push specs when git_push is created.

@tiennou
Copy link
Contributor Author

tiennou commented Mar 30, 2014

Note that I couldn't run the online tests, because lack of documentation (and, agreed, unwillingness to try). If someone has any pointers, I'm listening ;-). EDIT: especially since Travis hates me now.

I plan on working on push some more, so if someone provides me with a list of things to fix, that'll be a start. What I have on my mind at the moment is :

  • look at progress reporting for local pushes,
  • try to move the callbacks push uses back to git_remote_callbacks.

@vmg
Copy link
Member

vmg commented Mar 31, 2014

cc @carlosmn

@carlosmn
Copy link
Member

This moves in a good direction, but I don't think it goes far enough. Since we're putting the push refspecs into the remote, we should get rid of the git_push object completely and make the workflow for pushing be adding push refspecs and calling git_remote_push(), analogous to how we perform a fetch. The callbacks would go to live in the same struct as the rest.

The reporting for the local "transport" should be part of a different PR, otherwise it's going to get confusing.

@tiennou take a look at the first few lines of script/cibuild which sets up the environment for pushing. All you need is a bare repository and a git-daemon serving it.

@tiennou
Copy link
Contributor Author

tiennou commented Mar 31, 2014

Heh, I wasn't sure how'd you react to a "public" API removal (especially since I wasn't sure what your point on refspecs meant on #2136).

Bringing git_push under the remote namespace is my "long-term" objective, but I planned to do that in little steps. I guess I'll do the local transport reporting once that's done (since it's already missing anyway). So do you prefer me to use that PR as the main "rework push" thing (meaning I'll keep on piling commits until git_push is no more) ?

The only thing I'm still curious about is the "refs/heads/master:" refspecs that were used in the tests; are those "standard", or a convenience thing that I kill when simplyfing refspec parsing ?

@carlosmn
Copy link
Member

Yeah, you can do multiple commits that go towards removing git_push, but those should all go in together, and be part of this PR.

Refspecs allow for many shorthands. and they're asymmetrical on the fetch and push side. I don't recall off-hand what refs/heads/master: means, but it does look a bit off. A colon at the end does not look right, but we should make sure of how it got there and check git's documentation as well as its behaviour.

tiennou added 4 commits March 31, 2014 22:51
git_revspec_parse returns empty strings instead of NULLs, so "delete" refspecs would try to have "" resolved and fail.
@tiennou
Copy link
Contributor Author

tiennou commented Mar 31, 2014

Tests "fixed". The quotes are there because even though I know what refs/heads/master: means now (means fetch the reference but don't create a tracking branch, and it's invalid for a push refspec), I've found one nugget that I can't grasp (and neither can Core Git), so I'm disabling that one test for now.

Maybe the names of `git_transfer_progress_callback` should be made clearer though.
@tiennou
Copy link
Contributor Author

tiennou commented Apr 2, 2014

What's preferable ? Removing git_push entirely by moving its functions under the remote namespace, or just making it private ? I feel like the second one would be cleaner (akin to how fetch is done)...

@carlosmn
Copy link
Member

Sorry, forgot to answer.

We can incrementally build towards the removal of git_push. As a first step, I'd say to remove git_push from the public API and make git_remote_push() use it by copying the configured push refspecs and setting the callbacks as they appear on the remote. Something like

int git_remote_push(git_remote *remote)
{
    git_push_new();
    git_push_add_refspec(<from git_remote_get_push_refspecs()>);
    git_push_set_callbacks(<from remote.callbacks>);
   git_push_finish();
}

We can then remove the git_push struct and make the code live under the remote directly.

@tiennou tiennou mentioned this pull request Aug 13, 2014
@tiennou tiennou closed this Aug 13, 2014
@tiennou tiennou deleted the merge-refspec-parsing branch August 1, 2017 18:45
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