You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
As far as I can tell, there is no way to set the work-tree for a repository (a command like "git --git-dir=first/directory/.git --work-tree=second/directory init" would do the trick, but it looks like the plugin does not have support for libgit2's git_repository_init_ext method -- which accepts a git_repository_init_options argument ... or the git_repository_set_workdir function may also work).
I'd like to request a feature that would let me accomplish work-tree assignment in some way.
Can you copy and paste here the entry in the v0.18.json file for git_repository_init_ext and whatever other functions you need? I'd like to guide you through making this enhancement yourself.
At a high level, the process is to remove the ignore: true attribute and set async to true. Then you'll need to add a definition for git_repository_init_options. To do this you need to make something analogous to diff_range, which is another struct, just like ..._init_options. You'll want to populate an entry for each of the fields in the struct. Here is how diff_range looks:
In the above example, oldStart is a field. If you just follow the conventions you see elsewhere you may be able to do this by yourself!
Finally, you'll want to make sure this compiles and works in your project. npm run-script gen && npm install && npm test. Test it out with npm link. When all is good, submit a pull request!
Oh, additionally, you'll need to add the file you'll create init_options.h as a dependency to repo.h (see the dependencies field). Next, add an initialize line in base.cc, as in:
I've added support for this issue, I've greatly reduced down the amount of work it takes to bind, so the diff is relatively small. Still missing a unit test.
Activity
nkallen commentedon Sep 23, 2013
Can you copy and paste here the entry in the v0.18.json file for git_repository_init_ext and whatever other functions you need? I'd like to guide you through making this enhancement yourself.
jcmoore commentedon Sep 26, 2013
Thanks for your help.
{
"cFunctionName": "git_repository_init_ext",
"args": [
{
"name": "out",
"isReturn": true,
"cType": "git_repository **",
"cppClassName": "GitRepo",
"jsClassName": "Repository",
"comment": "Pointer to the repo which will be created or reinitialized."
},
{
"name": "repo_path",
"cType": "const char *",
"cppClassName": "String",
"jsClassName": "String",
"comment": "The path to the repository."
},
{
"name": "opts",
"cType": "git_repository_init_options *",
"cppClassName": "RepositoryInitOptions",
"jsClassName": "RepositoryInitOptions",
"comment": "Pointer to git_repository_init_options struct."
}
],
"ignore": true,
"isAsync": false,
"isConstructorMethod": true,
"isPrototypeMethod": false,
"jsFunctionName": "initExt",
"cppFunctionName": "InitExt",
"return": {
"cType": "int",
"cppClassName": "Int32",
"isErrorCode": true,
"comment": "0 or an error code on failure.",
"jsClassName": "Number"
},
"description": "
Create a new Git repository in the given folder with extended controls.
\n"},
nkallen commentedon Sep 26, 2013
OK this isn't a super-simple one.
At a high level, the process is to remove the
ignore: trueattribute and setasynctotrue. Then you'll need to add a definition forgit_repository_init_options. To do this you need to make something analogous todiff_range, which is another struct, just like..._init_options. You'll want to populate an entry for each of the fields in the struct. Here is howdiff_rangelooks:In the above example, oldStart is a field. If you just follow the conventions you see elsewhere you may be able to do this by yourself!
Finally, you'll want to make sure this compiles and works in your project.
npm run-script gen && npm install && npm test. Test it out withnpm link. When all is good, submit a pull request!Let me know if this is too confusing!
nkallen commentedon Sep 26, 2013
Oh, additionally, you'll need to add the file you'll create
init_options.has a dependency torepo.h(see thedependenciesfield). Next, add an initialize line inbase.cc, as in:Finally, add
'src/submodule.cc',to binding.gyp.tbranyen commentedon Jul 3, 2014
I've added support for this issue, I've greatly reduced down the amount of work it takes to bind, so the diff is relatively small. Still missing a unit test.
tbranyen commentedon Oct 11, 2014
We're still working on options, but we're super close thanks to @johnhaley81. This should be landed next week. #208
johnhaley81 commentedon Nov 21, 2014
This is now in the latest version. Give it a shot and if doesn't work then feel free to reopen this issue.