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
2cfa31c4
Commit
2cfa31c4
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path: remove unused git_path_topdir
parent
1a724625
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 additions
and
47 deletions
+1
-47
src/path.c
+0
-18
src/path.h
+0
-2
tests/core/path.c
+1
-27
No files found.
src/path.c
View file @
2cfa31c4
...
...
@@ -274,24 +274,6 @@ size_t git_path_basename_offset(git_buf *buffer)
return
0
;
}
const
char
*
git_path_topdir
(
const
char
*
path
)
{
size_t
len
;
ssize_t
i
;
assert
(
path
);
len
=
strlen
(
path
);
if
(
!
len
||
path
[
len
-
1
]
!=
'/'
)
return
NULL
;
for
(
i
=
(
ssize_t
)
len
-
2
;
i
>=
0
;
--
i
)
if
(
path
[
i
]
==
'/'
)
break
;
return
&
path
[
i
+
1
];
}
int
git_path_root
(
const
char
*
path
)
{
int
offset
=
0
,
prefix_len
;
...
...
src/path.h
View file @
2cfa31c4
...
...
@@ -67,8 +67,6 @@ extern int git_path_basename_r(git_buf *buffer, const char *path);
*/
extern
size_t
git_path_basename_offset
(
git_buf
*
buffer
);
extern
const
char
*
git_path_topdir
(
const
char
*
path
);
/**
* Find offset to root of path if path has one.
*
...
...
tests/core/path.c
View file @
2cfa31c4
...
...
@@ -32,15 +32,6 @@ check_basename(const char *A, const char *B)
}
static
void
check_topdir
(
const
char
*
A
,
const
char
*
B
)
{
const
char
*
dir
;
cl_assert
((
dir
=
git_path_topdir
(
A
))
!=
NULL
);
cl_assert_equal_s
(
B
,
dir
);
}
static
void
check_joinpath
(
const
char
*
path_a
,
const
char
*
path_b
,
const
char
*
expected_path
)
{
git_buf
joined_path
=
GIT_BUF_INIT
;
...
...
@@ -119,23 +110,6 @@ void test_core_path__01_basename(void)
check_basename
(
REP1024
(
"/abc"
),
"abc"
);
}
/* get the latest component in a path */
void
test_core_path__02_topdir
(
void
)
{
check_topdir
(
".git/"
,
".git/"
);
check_topdir
(
"/.git/"
,
".git/"
);
check_topdir
(
"usr/local/.git/"
,
".git/"
);
check_topdir
(
"./.git/"
,
".git/"
);
check_topdir
(
"/usr/.git/"
,
".git/"
);
check_topdir
(
"/"
,
"/"
);
check_topdir
(
"a/"
,
"a/"
);
cl_assert
(
git_path_topdir
(
"/usr/.git"
)
==
NULL
);
cl_assert
(
git_path_topdir
(
"."
)
==
NULL
);
cl_assert
(
git_path_topdir
(
""
)
==
NULL
);
cl_assert
(
git_path_topdir
(
"a"
)
==
NULL
);
}
/* properly join path components */
void
test_core_path__05_joins
(
void
)
{
...
...
@@ -285,7 +259,7 @@ void test_core_path__08_self_join(void)
cl_git_pass
(
git_buf_joinpath
(
&
path
,
path
.
ptr
+
4
,
"somethinglongenoughtorealloc"
));
cl_assert_equal_s
(
path
.
ptr
,
"/baz/somethinglongenoughtorealloc"
);
cl_assert
(
asize
<
path
.
asize
);
git_buf_dispose
(
&
path
);
}
...
...
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