Skip to content

Commit 0c27a85

Browse files
committed
repo: don't require option when template_path is specified
When a `template_path` is explicitly specified, don't _also_ require an option to indicate that we should use templates. We, obviously, should.
1 parent ccc2028 commit 0c27a85

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libgit2/repository.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,8 @@ static int repo_init_structure(
25382538
int error = 0;
25392539
repo_template_item *tpl;
25402540
bool external_tpl =
2541-
((opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0);
2541+
opts->template_path != NULL ||
2542+
(opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0;
25422543
mode_t dmode = pick_dir_mode(opts);
25432544
bool chmod = opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK;
25442545

tests/libgit2/repo/template.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ void test_repo_template__extended_with_template_and_shared_mode(void)
228228
const char *repo_path;
229229
int filemode;
230230

231-
opts.flags = GIT_REPOSITORY_INIT_MKPATH |
232-
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE;
231+
opts.flags = GIT_REPOSITORY_INIT_MKPATH;
233232
opts.template_path = "template";
234233
opts.mode = GIT_REPOSITORY_INIT_SHARED_GROUP;
235234

0 commit comments

Comments
 (0)