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
ba1bdf86
Commit
ba1bdf86
authored
Mar 18, 2011
by
nulltoken
Committed by
Vicent Marti
Mar 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve test coverage of new path prettifying behavior
parent
3644e98f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletions
+34
-1
tests/t12-repo.c
+34
-1
No files found.
tests/t12-repo.c
View file @
ba1bdf86
...
@@ -158,7 +158,7 @@ BEGIN_TEST(init1, "initialize a bare repo")
...
@@ -158,7 +158,7 @@ BEGIN_TEST(init1, "initialize a bare repo")
must_pass
(
ensure_repository_init
(
TEMP_REPO_FOLDER_NS
,
BARE_REPOSITORY
,
NULL
,
path_repository
,
NULL
));
must_pass
(
ensure_repository_init
(
TEMP_REPO_FOLDER_NS
,
BARE_REPOSITORY
,
NULL
,
path_repository
,
NULL
));
END_TEST
END_TEST
BEGIN_TEST
(
init2
,
"Initialize a bare repo with a relative path escaping out of the current working directory"
)
BEGIN_TEST
(
init2
,
"Initialize a
nd open a
bare repo with a relative path escaping out of the current working directory"
)
char
path_repository
[
GIT_PATH_MAX
];
char
path_repository
[
GIT_PATH_MAX
];
char
current_workdir
[
GIT_PATH_MAX
];
char
current_workdir
[
GIT_PATH_MAX
];
const
int
mode
=
0755
;
/* or 0777 ? */
const
int
mode
=
0755
;
/* or 0777 ? */
...
@@ -176,6 +176,38 @@ BEGIN_TEST(init2, "Initialize a bare repo with a relative path escaping out of t
...
@@ -176,6 +176,38 @@ BEGIN_TEST(init2, "Initialize a bare repo with a relative path escaping out of t
git_repository_free
(
repo
);
git_repository_free
(
repo
);
must_pass
(
git_repository_open
(
&
repo
,
"../d/e.git"
));
git_repository_free
(
repo
);
must_pass
(
chdir
(
current_workdir
));
rmdir_recurs
(
TEMP_REPO_FOLDER
);
END_TEST
BEGIN_TEST
(
open2
,
"Open a bare repository with a relative path escaping out of the current working directory"
)
char
new_current_workdir
[
GIT_PATH_MAX
];
char
current_workdir
[
GIT_PATH_MAX
];
char
path_repository
[
GIT_PATH_MAX
];
const
int
mode
=
0755
;
/* or 0777 ? */
git_repository
*
repo
;
/* Setup the repository to open */
must_pass
(
gitfo_getcwd
(
current_workdir
,
sizeof
(
current_workdir
)));
strcpy
(
path_repository
,
current_workdir
);
git__joinpath_n
(
path_repository
,
3
,
path_repository
,
TEMP_REPO_FOLDER
,
"a/d/e.git"
);
must_pass
(
gitfo_mkdir_recurs
(
path_repository
,
mode
));
must_pass
(
copydir_recurs
(
REPOSITORY_FOLDER
,
path_repository
));
/* Change the current working directory */
git__joinpath
(
new_current_workdir
,
TEMP_REPO_FOLDER
,
"a/b/c/"
);
must_pass
(
gitfo_mkdir_recurs
(
new_current_workdir
,
mode
));
must_pass
(
chdir
(
new_current_workdir
));
must_pass
(
git_repository_open
(
&
repo
,
"../../d/e.git"
));
git_repository_free
(
repo
);
must_pass
(
chdir
(
current_workdir
));
must_pass
(
chdir
(
current_workdir
));
rmdir_recurs
(
TEMP_REPO_FOLDER
);
rmdir_recurs
(
TEMP_REPO_FOLDER
);
END_TEST
END_TEST
...
@@ -186,5 +218,6 @@ BEGIN_SUITE(repository)
...
@@ -186,5 +218,6 @@ BEGIN_SUITE(repository)
ADD_TEST
(
init0
);
ADD_TEST
(
init0
);
ADD_TEST
(
init1
);
ADD_TEST
(
init1
);
ADD_TEST
(
init2
);
ADD_TEST
(
init2
);
ADD_TEST
(
open2
);
END_SUITE
END_SUITE
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