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

Extending checkout support #457

Closed
tiennou opened this issue Apr 8, 2015 · 3 comments · Fixed by #459
Closed

Extending checkout support #457

tiennou opened this issue Apr 8, 2015 · 3 comments · Fixed by #459

Comments

@tiennou
Copy link
Contributor

tiennou commented Apr 8, 2015

I've taken a quick peek at where the upcoming stash support is, and noticed there are a few differences with what I had wrote. It now requires a git_checkout_options structure, and I noticed we're woefully under-equipped when it comes to that.

Right now we only support progress & notify callbacks, as well as strategy and notification "flags", but no "paths", and no "labels" (which I think are used for conflicts). And since this structure gets used by cherrypick, merge, reset, revert, stash and submodule, maybe it would be nicer to work on DRYing up those measly 4 parameters we have at the moment before it gets out of hand ;-).

@tiennou
Copy link
Contributor Author

tiennou commented Apr 8, 2015

Note that I'm throwing that out to see if you guys already have some plans on how to do that.

What I would do is add a GTCheckoutOptions (bike-shedding welcome) value-object with a nice and tasty API to wrap the current uses we have while shielding us from the need to change a bunch of places each time we have to convert users' need to libgit2 git_checkout_options.

So, for example, our checkout support would change to :

GTCheckoutOptions *options = [blah checkoutOptionsWithStrategy:strategy notifyFlags:flags progressBlock:progress notifyBlock:notify];

BOOL success = [repository checkoutCommit:myCommit options:options error:NULL];

or you could customize them before handing those to whatever you're trying to do :

GTCheckoutOptions *options = [blah checkoutOptionsWithStrategy:strategy notifyFlags:flags progressBlock:progress notifyBlock:notify];

options.paths = @[@"src", "include"];

GTReference *originMaster = [GTReference referenceByLookingUpReferencedNamed:@"origin/master"];

BOOL success = [repository mergeReference:originMaster options:options error:NULL];

(obviously this last example is completely made up, because I don't think we're that far in handling merges yet).

@tiennou
Copy link
Contributor Author

tiennou commented Apr 8, 2015

Eeek. I don't think it's even sensible to ask for a merge with paths. Let's hope the point gets through anyway 😄.

@jspahrsummers
Copy link
Contributor

Sounds reasonable. We don't use libgit2 checkout ourselves, so I don't feel qualified to comment on the use of its API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants