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
848d77dc
Commit
848d77dc
authored
Jan 14, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1242 from sba1/init-with-template-fix
Some fixes for external template support
parents
09e29e47
72719e73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
src/repository.c
+11
-1
tests-clar/repo/init.c
+12
-1
tests-clar/resources/template/description
+1
-1
No files found.
src/repository.c
View file @
848d77dc
...
...
@@ -1005,8 +1005,17 @@ static int repo_init_structure(
tdir
=
GIT_TEMPLATE_DIR
;
}
/* FIXME: GIT_CPDIR_CHMOD cannot applied here as an attempt
* would be made to chmod() all directories up to the last
* component of repo_dir, e.g., also /home etc. Recall that
* repo_dir is prettified at this point.
*
* Best probably would be to have the same logic as in
* git_futils_mkdir(), i.e., to separate the base from
* the path.
*/
error
=
git_futils_cp_r
(
tdir
,
repo_dir
,
GIT_CPDIR_COPY_SYMLINKS
|
GIT_CPDIR_CHMOD
,
dmode
);
GIT_CPDIR_COPY_SYMLINKS
/*| GIT_CPDIR_CHMOD*/
,
dmode
);
if
(
error
<
0
)
{
if
(
strcmp
(
tdir
,
GIT_TEMPLATE_DIR
)
!=
0
)
...
...
@@ -1015,6 +1024,7 @@ static int repo_init_structure(
/* if template was default, ignore error and use internal */
giterr_clear
();
external_tpl
=
false
;
error
=
0
;
}
}
...
...
tests-clar/repo/init.c
View file @
848d77dc
...
...
@@ -365,9 +365,12 @@ void test_repo_init__extended_1(void)
void
test_repo_init__extended_with_template
(
void
)
{
git_buf
expected
=
GIT_BUF_INIT
;
git_buf
actual
=
GIT_BUF_INIT
;
git_repository_init_options
opts
=
GIT_REPOSITORY_INIT_OPTIONS_INIT
;
opts
.
flags
=
GIT_REPOSITORY_INIT_MKPATH
|
GIT_REPOSITORY_INIT_BARE
;
opts
.
flags
=
GIT_REPOSITORY_INIT_MKPATH
|
GIT_REPOSITORY_INIT_BARE
|
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE
;
opts
.
template_path
=
cl_fixture
(
"template"
);
cl_git_pass
(
git_repository_init_ext
(
&
_repo
,
"templated.git"
,
&
opts
));
...
...
@@ -375,6 +378,14 @@ void test_repo_init__extended_with_template(void)
cl_assert
(
git_repository_is_bare
(
_repo
));
cl_assert
(
!
git__suffixcmp
(
git_repository_path
(
_repo
),
"/templated.git/"
));
cl_assert
(
git_futils_readbuffer
(
&
expected
,
cl_fixture
(
"template/description"
))
==
GIT_OK
);
cl_assert
(
git_futils_readbuffer
(
&
actual
,
"templated.git/description"
)
==
GIT_OK
);
cl_assert
(
!
git_buf_cmp
(
&
expected
,
&
actual
));
git_buf_free
(
&
expected
);
git_buf_free
(
&
actual
);
cleanup_repository
(
"templated.git"
);
}
...
...
tests-clar/resources/template/description
View file @
848d77dc
Unnamed repository; e
dit this file 'description' to name the repository.
E
dit this file 'description' to name the repository.
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