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
2d160ef7
Commit
2d160ef7
authored
May 29, 2013
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow (ignore) bare slash in gitignore
parent
17776314
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
1 deletions
+38
-1
src/attr_file.c
+2
-1
src/pool.c
+5
-0
tests-clar/attr/ignore.c
+21
-0
tests-clar/core/pool.c
+10
-0
No files found.
src/attr_file.c
View file @
2d160ef7
...
@@ -397,7 +397,8 @@ int git_attr_fnmatch__parse(
...
@@ -397,7 +397,8 @@ int git_attr_fnmatch__parse(
*
base
=
scan
;
*
base
=
scan
;
spec
->
length
=
scan
-
pattern
;
if
((
spec
->
length
=
scan
-
pattern
)
==
0
)
return
GIT_ENOTFOUND
;
if
(
pattern
[
spec
->
length
-
1
]
==
'/'
)
{
if
(
pattern
[
spec
->
length
-
1
]
==
'/'
)
{
spec
->
length
--
;
spec
->
length
--
;
...
...
src/pool.c
View file @
2d160ef7
...
@@ -194,6 +194,11 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
...
@@ -194,6 +194,11 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
assert
(
pool
&&
str
&&
pool
->
item_size
==
sizeof
(
char
));
assert
(
pool
&&
str
&&
pool
->
item_size
==
sizeof
(
char
));
if
(
n
+
1
==
0
)
{
giterr_set_oom
();
return
NULL
;
}
if
((
ptr
=
git_pool_malloc
(
pool
,
(
uint32_t
)(
n
+
1
)))
!=
NULL
)
{
if
((
ptr
=
git_pool_malloc
(
pool
,
(
uint32_t
)(
n
+
1
)))
!=
NULL
)
{
memcpy
(
ptr
,
str
,
n
);
memcpy
(
ptr
,
str
,
n
);
*
(((
char
*
)
ptr
)
+
n
)
=
'\0'
;
*
(((
char
*
)
ptr
)
+
n
)
=
'\0'
;
...
...
tests-clar/attr/ignore.c
View file @
2d160ef7
...
@@ -34,6 +34,27 @@ void test_attr_ignore__honor_temporary_rules(void)
...
@@ -34,6 +34,27 @@ void test_attr_ignore__honor_temporary_rules(void)
assert_is_ignored
(
true
,
"NewFolder/NewFolder/File.txt"
);
assert_is_ignored
(
true
,
"NewFolder/NewFolder/File.txt"
);
}
}
void
test_attr_ignore__allow_root
(
void
)
{
cl_git_rewritefile
(
"attr/.gitignore"
,
"/"
);
assert_is_ignored
(
false
,
"File.txt"
);
assert_is_ignored
(
false
,
"NewFolder"
);
assert_is_ignored
(
false
,
"NewFolder/NewFolder"
);
assert_is_ignored
(
false
,
"NewFolder/NewFolder/File.txt"
);
}
void
test_attr_ignore__ignore_root
(
void
)
{
cl_git_rewritefile
(
"attr/.gitignore"
,
"/
\n\n
/NewFolder
\n
/NewFolder/NewFolder"
);
assert_is_ignored
(
false
,
"File.txt"
);
assert_is_ignored
(
true
,
"NewFolder"
);
assert_is_ignored
(
true
,
"NewFolder/NewFolder"
);
assert_is_ignored
(
true
,
"NewFolder/NewFolder/File.txt"
);
}
void
test_attr_ignore__skip_gitignore_directory
(
void
)
void
test_attr_ignore__skip_gitignore_directory
(
void
)
{
{
cl_git_rewritefile
(
"attr/.git/info/exclude"
,
"/NewFolder
\n
/NewFolder/NewFolder"
);
cl_git_rewritefile
(
"attr/.git/info/exclude"
,
"/NewFolder
\n
/NewFolder/NewFolder"
);
...
...
tests-clar/core/pool.c
View file @
2d160ef7
...
@@ -133,3 +133,13 @@ void test_core_pool__free_list(void)
...
@@ -133,3 +133,13 @@ void test_core_pool__free_list(void)
git_pool_clear
(
&
p
);
git_pool_clear
(
&
p
);
}
}
void
test_core_pool__strndup_limit
(
void
)
{
git_pool
p
;
cl_git_pass
(
git_pool_init
(
&
p
,
1
,
100
));
cl_assert
(
git_pool_strndup
(
&
p
,
"foo"
,
-
1
)
==
NULL
);
git_pool_clear
(
&
p
);
}
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