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
07c0eacd
Commit
07c0eacd
authored
May 28, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2359 from e45lee/chmod-fix
Fixed permissions on template directories.
parents
ab882e21
517341c5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
src/repository.c
+14
-6
No files found.
src/repository.c
View file @
07c0eacd
...
@@ -1190,6 +1190,7 @@ static int repo_init_structure(
...
@@ -1190,6 +1190,7 @@ static int repo_init_structure(
bool
external_tpl
=
bool
external_tpl
=
((
opts
->
flags
&
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE
)
!=
0
);
((
opts
->
flags
&
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE
)
!=
0
);
mode_t
dmode
=
pick_dir_mode
(
opts
);
mode_t
dmode
=
pick_dir_mode
(
opts
);
bool
chmod
=
opts
->
mode
!=
GIT_REPOSITORY_INIT_SHARED_UMASK
;
/* Hide the ".git" directory */
/* Hide the ".git" directory */
#ifdef GIT_WIN32
#ifdef GIT_WIN32
...
@@ -1230,10 +1231,12 @@ static int repo_init_structure(
...
@@ -1230,10 +1231,12 @@ static int repo_init_structure(
default_template
=
true
;
default_template
=
true
;
}
}
if
(
tdir
)
if
(
tdir
)
{
error
=
git_futils_cp_r
(
tdir
,
repo_dir
,
uint32_t
cpflags
=
GIT_CPDIR_COPY_SYMLINKS
|
GIT_CPDIR_SIMPLE_TO_MODE
;
GIT_CPDIR_COPY_SYMLINKS
|
GIT_CPDIR_CHMOD_DIRS
|
if
(
opts
->
mode
!=
GIT_REPOSITORY_INIT_SHARED_UMASK
)
GIT_CPDIR_SIMPLE_TO_MODE
,
dmode
);
cpflags
|=
GIT_CPDIR_CHMOD_DIRS
;
error
=
git_futils_cp_r
(
tdir
,
repo_dir
,
cpflags
,
dmode
);
}
git_buf_free
(
&
template_buf
);
git_buf_free
(
&
template_buf
);
git_config_free
(
cfg
);
git_config_free
(
cfg
);
...
@@ -1254,9 +1257,14 @@ static int repo_init_structure(
...
@@ -1254,9 +1257,14 @@ static int repo_init_structure(
* - only create files if no external template was specified
* - only create files if no external template was specified
*/
*/
for
(
tpl
=
repo_template
;
!
error
&&
tpl
->
path
;
++
tpl
)
{
for
(
tpl
=
repo_template
;
!
error
&&
tpl
->
path
;
++
tpl
)
{
if
(
!
tpl
->
content
)
if
(
!
tpl
->
content
)
{
uint32_t
mkdir_flags
=
GIT_MKDIR_PATH
;
if
(
chmod
)
mkdir_flags
|=
GIT_MKDIR_CHMOD
;
error
=
git_futils_mkdir
(
error
=
git_futils_mkdir
(
tpl
->
path
,
repo_dir
,
dmode
,
GIT_MKDIR_PATH
|
GIT_MKDIR_CHMOD
);
tpl
->
path
,
repo_dir
,
dmode
,
mkdir_flags
);
}
else
if
(
!
external_tpl
)
{
else
if
(
!
external_tpl
)
{
const
char
*
content
=
tpl
->
content
;
const
char
*
content
=
tpl
->
content
;
...
...
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