git_clone supports init_options#1850
Conversation
src/clone.c
Outdated
There was a problem hiding this comment.
Probably better to address this in normalize_options.
There was a problem hiding this comment.
Maybe I should clarify a bit. It turns out that git_repository_init is a wrapper around git_repository_init_ext, so let's just use the _ext variant.
This probably means dropping the bare option, in favor of setting the GIT_REPOSITORY_INIT_BARE bit on init_options.flags.
There was a problem hiding this comment.
Then we have to duplicate the code from git_repository_init(), isn't?
There was a problem hiding this comment.
Just one line of it.
if (!dst->init_options) {
git_repository_init_options dummy_options = GIT_REPOSITORY_INIT_OPTIONS_INIT;
opts.flags = GIT_REPOSITORY_INIT_MKPATH;
dst->init_options = /* allocate and check allocation */;
memcpy(dst->init_options, &dummy_options, sizeof(git_repository_init_options);
}If the caller wants a bare repo, they'll provide a valid init_options and set the proper flag. If they don't, they get the default options. The only hitch is that you'll have to track that allocation somehow, and free it later (maybe just a stack variable in do_clone?).
|
I'm definitely 👍 on this. Clone landed before |
|
Commit updated |
|
I'm still thinking of 💀ing the |
There was a problem hiding this comment.
Can we please keep an eye out for brackets and consistency? :)
git_clone supports init_options
git_clone supports init_options