Skip to content
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
This repository was archived by the owner on Dec 2, 2026. It is now read-only.

Passing CloneOptions #127

Closed
Closed

Description

@cazgp

I tried using a javascript object, and various combinations of arrays and strings.

I then tried instantiating git.CloneOptions, but it was complaining about needing git_clone_options. There appears to be a libgit2 macro GIT_CLONE_OPTIONS_INIT but I've no idea how to call it.

Any help / pointers would be great, thank you.

Activity

  1. Glavin001 commented on Jan 20, 2014

    @Glavin001

    +1, I would also like some more documentation on what CloneOptions is. Thanks!

    Update:
    I just found: http://libgit2.github.com/libgit2/#HEAD/type/git_clone_options

  2. scottnath commented on Feb 18, 2014

    @scottnath

    Do you have a use example from your update @Glavin001 ?

    I found this page too with seemingly more options:
    http://libgit2.github.com/libgit2/#v0.18.0/type/git_clone_options
    but I don't know how to implement.

    This did nothing:

      git.Repo.clone("https://github.com/nodegit/nodegit.git", path, (remote_name='test'), function(error, repo) {...
    

    thanks,
    Scott

  3. Glavin001 commented on Feb 18, 2014

    @Glavin001

    Do you have a use example from your update @Glavin001 ?

    I did not end up trying it, unfortunately. You can see my basic usage here: https://github.com/Coders-Classroom/Coders-Classroom/blob/master/server/index.js#L80

    This did nothing:
    git.Repo.clone("https://github.com/nodegit/nodegit.git", path, (remote_name='test'), function(error, repo) {...

    That's how I would suppose the usage would work.

    Although, I don't follow your syntax for the object (typo?):

    (remote_name='test')
    

    Maybe try it with an exist branch (see https://github.com/nodegit/nodegit/branches ) such as gh-pages.

    git.Repo.clone("https://github.com/nodegit/nodegit.git", path, { remote_name: 'gh-pages' }, function(error, repo) {
    // ...
    }

    I am unable to try right now but I'll try and take a look later tonight.

  4. scottnath commented on Feb 18, 2014

    @scottnath

    Thanks for getting back to me!

    Tried an object in there, got this error when trying to run it:

    Assertion failed: (handle->InternalFieldCount() > 0), function Unwrap, file /Users/person/.node-gyp/0.10.22/src/node_object_wrap.h, line 61.
    Abort trap: 6
    

    when it's an array, no error, but nothing changes. Using gh-pages had no effect either.

    thanks,
    Scott

  5. mccormicka commented on Feb 24, 2014

    @mccormicka

    I also can not get this to work. I am trying to pass checkout_branch as an argument.

    git.Repo.clone('url', path, {checkout_branch:'name'}, callback);
    
  6. mccormicka commented on Feb 25, 2014

    @mccormicka

    If I add the clone_options.cc file to the binding.gyp and build using npm install file then I can create a new CloneOptions() object.
    However it seems that on line 42 it is calling a method ->IsExternal() which is then throwing the error stated above by @cazcazn Error: git_clone_options is required. Is there a way to print out the contents of args in this file?

  7. mccormicka commented on Feb 27, 2014

    @mccormicka

    ok I have worked out that the clone_options do not need to be included in the gyp file because the repo.cc file checks that the value is an object and then tries to convert it into clone_options for you. So in theory clone('url', path', {'checkout_branch' " 'name' }, callback ); should work and in fact does pass the object to the clone_options.cc file. However the clone_options is unable to convert the object into the format it requires.

  8. scottnath commented on Feb 27, 2014

    @scottnath

    Thank you for delving into this @mccormicka
    Do you think this is an issue with nodegit or libgit2?

  9. mccormicka commented on Feb 27, 2014

    @mccormicka

    Hi @scottnath I think this is an issue with nodegit. It can not convert the javascript object to the correct GitCloneOptions object that nodegit requires. Unfortunately I can not find any good documentation on how to do this and I do not really have the time to get much deeper into the code. It would be great if one of the authors could pitch in on this issue.

  10. goloroden commented on Mar 13, 2014

    @goloroden

    +1, same issue here.

  11. jaypozo commented on Apr 13, 2014

    @jaypozo

    Would like to be able to pass the --mirror option to clone. +1 for getting this to work.

  12. xogeny commented on Apr 28, 2014

    @xogeny

    I was impressed by the richness of the nodegit API, but almost immediately ran into the limitation that I need to work with something besides HEAD. Given how long this issue has been here and the fact that I don't see any developer comments, I'm somewhat pessimistic.

    +1

  13. webjay commented on May 14, 2014

    @webjay

    +1 for mirror

  14. tbranyen commented on Jul 3, 2014

    @tbranyen
    Member

    Will be available once #187 lands.

  15. tbranyen commented on Oct 11, 2014

    @tbranyen
    Member

    We're working on this right now and should land sometime next week. #187 wasn't sufficient unfortunately. #195 will have the CloneMethods struct exposed and usable.

  16. johnhaley81 commented on Oct 23, 2014

    @johnhaley81
    Collaborator

    This should be fixed on master now.

  17. danielbeeke commented on Jan 28, 2016

    @danielbeeke
                Git.Clone(commit.repo, builder.getSourcePath(commit), { checkoutBranch: commit.branch })
    
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