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
0cd1c3bb
Commit
0cd1c3bb
authored
Sep 18, 2013
by
Linquize
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make init.templatedir work
parent
3d4f1698
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
src/repository.c
+12
-17
No files found.
src/repository.c
View file @
0cd1c3bb
...
@@ -1132,44 +1132,39 @@ static int repo_init_structure(
...
@@ -1132,44 +1132,39 @@ static int repo_init_structure(
/* Copy external template if requested */
/* Copy external template if requested */
if
(
external_tpl
)
{
if
(
external_tpl
)
{
git_config
*
cfg
;
git_config
*
cfg
=
NULL
;
const
char
*
tdir
;
const
char
*
tdir
=
NULL
;
bool
default_template
=
false
;
git_buf
template_buf
=
GIT_BUF_INIT
;
git_buf
template_buf
=
GIT_BUF_INIT
;
git_futils_find_template_dir
(
&
template_buf
);
if
(
opts
->
template_path
)
if
(
opts
->
template_path
)
tdir
=
opts
->
template_path
;
tdir
=
opts
->
template_path
;
else
if
((
error
=
git_config_open_default
(
&
cfg
))
<
0
)
else
if
((
error
=
git_config_open_default
(
&
cfg
))
>=
0
)
{
return
error
;
else
{
error
=
git_config_get_string
(
&
tdir
,
cfg
,
"init.templatedir"
);
error
=
git_config_get_string
(
&
tdir
,
cfg
,
"init.templatedir"
);
git_config_free
(
cfg
);
if
(
error
&&
error
!=
GIT_ENOTFOUND
)
return
error
;
giterr_clear
();
giterr_clear
();
}
if
(
!
tdir
)
{
git_futils_find_template_dir
(
&
template_buf
);
tdir
=
template_buf
.
ptr
;
tdir
=
template_buf
.
ptr
;
default_template
=
true
;
}
}
error
=
git_futils_cp_r
(
tdir
,
repo_dir
,
error
=
git_futils_cp_r
(
tdir
,
repo_dir
,
GIT_CPDIR_COPY_SYMLINKS
|
GIT_CPDIR_CHMOD_DIRS
|
GIT_CPDIR_COPY_SYMLINKS
|
GIT_CPDIR_CHMOD_DIRS
|
GIT_CPDIR_SIMPLE_TO_MODE
,
dmode
);
GIT_CPDIR_SIMPLE_TO_MODE
,
dmode
);
git_buf_free
(
&
template_buf
);
git_config_free
(
cfg
);
if
(
error
<
0
)
{
if
(
error
<
0
)
{
if
(
strcmp
(
tdir
,
template_buf
.
ptr
)
!=
0
)
{
if
(
!
default_template
)
git_buf_free
(
&
template_buf
);
return
error
;
return
error
;
}
/* if template was default, ignore error and use internal */
/* if template was default, ignore error and use internal */
giterr_clear
();
giterr_clear
();
external_tpl
=
false
;
external_tpl
=
false
;
error
=
0
;
error
=
0
;
}
}
git_buf_free
(
&
template_buf
);
}
}
/* Copy internal template
/* Copy internal template
...
...
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