Skip to content

Extending checkout support #457

Closed

Description

@tiennou

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 ;-).

Activity

  1. tiennou commented on Apr 8, 2015

    @tiennou
    ContributorAuthor

    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).

  2. tiennou commented on Apr 8, 2015

    @tiennou
    ContributorAuthor

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

  3. jspahrsummers commented on Apr 10, 2015

    @jspahrsummers
    Contributor

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

  4. added a commit that references this issue on Apr 10, 2015
    de9f512
  5. added a commit that references this issue on Sep 8, 2015
    4edb350
  6. added a commit that references this issue on Jun 28, 2016
    c6607dc
  7. added a commit that references this issue on Jul 18, 2016
    ace15a7
  8. added a commit that references this issue on Aug 15, 2016
    fb80c7c
  9. added a commit that references this issue on Dec 18, 2016
    b65755c
  10. added a commit that references this issue on Jan 15, 2017
    311ca45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions