Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
f9c4dc10
Unverified
Commit
f9c4dc10
authored
3 years ago
by
Edward Thomson
Committed by
GitHub
3 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6106 from ammgws/fixtemplateerr
Fix repo init when template dir is non-existent
parents
19743830
3461aaf7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
+16
-1
src/repository.c
+6
-1
tests/repo/template.c
+10
-0
No files found.
src/repository.c
View file @
f9c4dc10
...
...
@@ -2032,8 +2032,13 @@ static int repo_init_structure(
git_str_dispose
(
&
template_buf
);
git_config_free
(
cfg
);
/* If tdir does not exist, then do not error out. This matches the
* behaviour of git(1), which just prints a warning and continues.
* TODO: issue warning when warning API is available.
* `git` prints to stderr: 'warning: templates not found in /path/to/tdir'
*/
if
(
error
<
0
)
{
if
(
!
default_template
)
if
(
!
default_template
&&
error
!=
GIT_ENOTFOUND
)
return
error
;
/* if template was default, ignore error and use internal */
...
...
This diff is collapsed.
Click to expand it.
tests/repo/template.c
View file @
f9c4dc10
...
...
@@ -293,3 +293,13 @@ void test_repo_template__empty_template_path(void)
setup_repo
(
"foo"
,
&
opts
);
}
void
test_repo_template__nonexistent_template_path
(
void
)
{
git_repository_init_options
opts
=
GIT_REPOSITORY_INIT_OPTIONS_INIT
;
opts
.
flags
=
GIT_REPOSITORY_INIT_MKPATH
|
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE
;
opts
.
template_path
=
"/tmp/path/that/does/not/exist/for/libgit2/test"
;
setup_repo
(
"bar"
,
&
opts
);
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment