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
2e6fd09c
Commit
2e6fd09c
authored
Jan 25, 2011
by
nulltoken
Committed by
Vicent Marti
Jan 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed naming convention related issue.
parent
eb2f3b47
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
src/fileops.c
+3
-3
src/fileops.h
+2
-2
src/repository.c
+6
-6
tests/t0005-path.c
+2
-2
No files found.
src/fileops.c
View file @
2e6fd09c
...
@@ -391,7 +391,7 @@ static int retrieve_previous_path_component_start(const char *path)
...
@@ -391,7 +391,7 @@ static int retrieve_previous_path_component_start(const char *path)
return
offset
;
return
offset
;
}
}
int
git_prettify_dir_path
(
char
*
buffer_out
,
const
char
*
path
)
int
git
fo
_prettify_dir_path
(
char
*
buffer_out
,
const
char
*
path
)
{
{
int
len
=
0
,
segment_len
,
only_dots
;
int
len
=
0
,
segment_len
,
only_dots
;
char
*
current
;
char
*
current
;
...
@@ -457,7 +457,7 @@ int git_prettify_dir_path(char *buffer_out, const char *path)
...
@@ -457,7 +457,7 @@ int git_prettify_dir_path(char *buffer_out, const char *path)
return
GIT_SUCCESS
;
return
GIT_SUCCESS
;
}
}
int
git_prettify_file_path
(
char
*
buffer_out
,
const
char
*
path
)
int
git
fo
_prettify_file_path
(
char
*
buffer_out
,
const
char
*
path
)
{
{
int
error
,
path_len
,
i
;
int
error
,
path_len
,
i
;
const
char
*
pattern
=
"/.."
;
const
char
*
pattern
=
"/.."
;
...
@@ -470,7 +470,7 @@ int git_prettify_file_path(char *buffer_out, const char *path)
...
@@ -470,7 +470,7 @@ int git_prettify_file_path(char *buffer_out, const char *path)
return
GIT_ERROR
;
return
GIT_ERROR
;
}
}
error
=
git_prettify_dir_path
(
buffer_out
,
path
);
error
=
git
fo
_prettify_dir_path
(
buffer_out
,
path
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
...
...
src/fileops.h
View file @
2e6fd09c
...
@@ -153,7 +153,7 @@ extern int gitfo_close_cached(gitfo_cache *ioc);
...
@@ -153,7 +153,7 @@ extern int gitfo_close_cached(gitfo_cache *ioc);
* - GIT_SUCCESS on success;
* - GIT_SUCCESS on success;
* - GIT_ERROR when the input path is invalid or escapes the current directory.
* - GIT_ERROR when the input path is invalid or escapes the current directory.
*/
*/
GIT_EXTERN
(
int
)
git_prettify_dir_path
(
char
*
buffer_out
,
const
char
*
path
);
GIT_EXTERN
(
int
)
git
fo
_prettify_dir_path
(
char
*
buffer_out
,
const
char
*
path
);
/**
/**
* Clean up a provided absolute or relative file path.
* Clean up a provided absolute or relative file path.
...
@@ -175,6 +175,6 @@ GIT_EXTERN(int) git_prettify_dir_path(char *buffer_out, const char *path);
...
@@ -175,6 +175,6 @@ GIT_EXTERN(int) git_prettify_dir_path(char *buffer_out, const char *path);
* - GIT_SUCCESS on success;
* - GIT_SUCCESS on success;
* - GIT_ERROR when the input path is invalid or escapes the current directory.
* - GIT_ERROR when the input path is invalid or escapes the current directory.
*/
*/
GIT_EXTERN
(
int
)
git_prettify_file_path
(
char
*
buffer_out
,
const
char
*
path
);
GIT_EXTERN
(
int
)
git
fo
_prettify_file_path
(
char
*
buffer_out
,
const
char
*
path
);
#endif
/* INCLUDE_fileops_h__ */
#endif
/* INCLUDE_fileops_h__ */
src/repository.c
View file @
2e6fd09c
...
@@ -102,7 +102,7 @@ static int assign_repository_DIRs(git_repository *repo,
...
@@ -102,7 +102,7 @@ static int assign_repository_DIRs(git_repository *repo,
if
(
git_dir
==
NULL
)
if
(
git_dir
==
NULL
)
return
GIT_ENOTFOUND
;
return
GIT_ENOTFOUND
;
error
=
git_prettify_dir_path
(
path_aux
,
git_dir
);
error
=
git
fo
_prettify_dir_path
(
path_aux
,
git_dir
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
...
@@ -118,7 +118,7 @@ static int assign_repository_DIRs(git_repository *repo,
...
@@ -118,7 +118,7 @@ static int assign_repository_DIRs(git_repository *repo,
if
(
git_object_directory
==
NULL
)
if
(
git_object_directory
==
NULL
)
strcpy
(
repo
->
path_repository
+
git_dir_path_len
,
GIT_OBJECTS_DIR
);
strcpy
(
repo
->
path_repository
+
git_dir_path_len
,
GIT_OBJECTS_DIR
);
else
{
else
{
error
=
git_prettify_dir_path
(
path_aux
,
git_object_directory
);
error
=
git
fo
_prettify_dir_path
(
path_aux
,
git_object_directory
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
}
}
...
@@ -133,7 +133,7 @@ static int assign_repository_DIRs(git_repository *repo,
...
@@ -133,7 +133,7 @@ static int assign_repository_DIRs(git_repository *repo,
if
(
git_index_file
==
NULL
)
if
(
git_index_file
==
NULL
)
strcpy
(
repo
->
path_repository
+
git_dir_path_len
,
GIT_INDEX_FILE
);
strcpy
(
repo
->
path_repository
+
git_dir_path_len
,
GIT_INDEX_FILE
);
else
{
else
{
error
=
git_prettify_file_path
(
path_aux
,
git_index_file
);
error
=
git
fo
_prettify_file_path
(
path_aux
,
git_index_file
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
}
}
...
@@ -148,7 +148,7 @@ static int assign_repository_DIRs(git_repository *repo,
...
@@ -148,7 +148,7 @@ static int assign_repository_DIRs(git_repository *repo,
if
(
git_work_tree
==
NULL
)
if
(
git_work_tree
==
NULL
)
repo
->
is_bare
=
1
;
repo
->
is_bare
=
1
;
else
{
else
{
error
=
git_prettify_dir_path
(
path_aux
,
git_work_tree
);
error
=
git
fo
_prettify_dir_path
(
path_aux
,
git_work_tree
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
repo
->
path_workdir
=
git__strdup
(
path_aux
);
repo
->
path_workdir
=
git__strdup
(
path_aux
);
...
@@ -163,7 +163,7 @@ static int guess_repository_DIRs(git_repository *repo, const char *repository_pa
...
@@ -163,7 +163,7 @@ static int guess_repository_DIRs(git_repository *repo, const char *repository_pa
int
path_len
;
int
path_len
;
int
error
=
GIT_SUCCESS
;
int
error
=
GIT_SUCCESS
;
error
=
git_prettify_dir_path
(
path_aux
,
repository_path
);
error
=
git
fo
_prettify_dir_path
(
path_aux
,
repository_path
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
...
@@ -585,7 +585,7 @@ static int repo_init_find_dir(repo_init *results, const char* path)
...
@@ -585,7 +585,7 @@ static int repo_init_find_dir(repo_init *results, const char* path)
int
path_len
;
int
path_len
;
int
error
=
GIT_SUCCESS
;
int
error
=
GIT_SUCCESS
;
error
=
git_prettify_dir_path
(
temp_path
,
path
);
error
=
git
fo
_prettify_dir_path
(
temp_path
,
path
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
...
...
tests/t0005-path.c
View file @
2e6fd09c
...
@@ -23,12 +23,12 @@ static int ensure_normalized(const char *input_path, const char *expected_path,
...
@@ -23,12 +23,12 @@ static int ensure_normalized(const char *input_path, const char *expected_path,
static
int
ensure_dir_path_normalized
(
const
char
*
input_path
,
const
char
*
expected_path
)
static
int
ensure_dir_path_normalized
(
const
char
*
input_path
,
const
char
*
expected_path
)
{
{
return
ensure_normalized
(
input_path
,
expected_path
,
git_prettify_dir_path
);
return
ensure_normalized
(
input_path
,
expected_path
,
git
fo
_prettify_dir_path
);
}
}
static
int
ensure_file_path_normalized
(
const
char
*
input_path
,
const
char
*
expected_path
)
static
int
ensure_file_path_normalized
(
const
char
*
input_path
,
const
char
*
expected_path
)
{
{
return
ensure_normalized
(
input_path
,
expected_path
,
git_prettify_file_path
);
return
ensure_normalized
(
input_path
,
expected_path
,
git
fo
_prettify_file_path
);
}
}
BEGIN_TEST
(
file_path_prettifying
)
BEGIN_TEST
(
file_path_prettifying
)
...
...
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