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
3a495c19
Commit
3a495c19
authored
Sep 10, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2558 from libgit2/cmn/signature-empty-email
signature: don't allow empty emails
parents
31e752b6
76e3c43f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
src/signature.c
+2
-2
tests/commit/signature.c
+2
-2
No files found.
src/signature.c
View file @
3a495c19
...
@@ -70,9 +70,9 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
...
@@ -70,9 +70,9 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
if
(
p
->
name
==
NULL
||
p
->
email
==
NULL
)
if
(
p
->
name
==
NULL
||
p
->
email
==
NULL
)
return
-
1
;
/* oom */
return
-
1
;
/* oom */
if
(
p
->
name
[
0
]
==
'\0'
)
{
if
(
p
->
name
[
0
]
==
'\0'
||
p
->
email
[
0
]
==
'\0'
)
{
git_signature_free
(
p
);
git_signature_free
(
p
);
return
signature_error
(
"Signature cannot have an empty name"
);
return
signature_error
(
"Signature cannot have an empty name
or email
"
);
}
}
p
->
when
.
time
=
time
;
p
->
when
.
time
=
time
;
...
...
tests/commit/signature.c
View file @
3a495c19
...
@@ -56,8 +56,8 @@ void test_commit_signature__create_empties(void)
...
@@ -56,8 +56,8 @@ void test_commit_signature__create_empties(void)
cl_git_fail
(
try_build_signature
(
""
,
"emeric.fermas@gmail.com"
,
1234567890
,
60
));
cl_git_fail
(
try_build_signature
(
""
,
"emeric.fermas@gmail.com"
,
1234567890
,
60
));
cl_git_fail
(
try_build_signature
(
" "
,
"emeric.fermas@gmail.com"
,
1234567890
,
60
));
cl_git_fail
(
try_build_signature
(
" "
,
"emeric.fermas@gmail.com"
,
1234567890
,
60
));
cl_git_
pass
(
try_build_signature
(
"nulltoken"
,
""
,
1234567890
,
60
));
cl_git_
fail
(
try_build_signature
(
"nulltoken"
,
""
,
1234567890
,
60
));
cl_git_
pass
(
try_build_signature
(
"nulltoken"
,
" "
,
1234567890
,
60
));
cl_git_
fail
(
try_build_signature
(
"nulltoken"
,
" "
,
1234567890
,
60
));
}
}
void
test_commit_signature__create_one_char
(
void
)
void
test_commit_signature__create_one_char
(
void
)
...
...
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