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
f0ab7372
Commit
f0ab7372
authored
May 15, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signature: Lenient when dupping, strict when creating
parent
86c6f74a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
src/signature.c
+14
-5
tests-clar/commit/signature.c
+2
-2
No files found.
src/signature.c
View file @
f0ab7372
...
@@ -66,10 +66,12 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
...
@@ -66,10 +66,12 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
p
->
name
=
extract_trimmed
(
name
,
strlen
(
name
));
p
->
name
=
extract_trimmed
(
name
,
strlen
(
name
));
p
->
email
=
extract_trimmed
(
email
,
strlen
(
email
));
p
->
email
=
extract_trimmed
(
email
,
strlen
(
email
));
if
(
p
->
name
==
NULL
||
p
->
email
==
NULL
||
if
(
p
->
name
==
NULL
||
p
->
email
==
NULL
)
p
->
name
[
0
]
==
'\0'
||
p
->
email
[
0
]
==
'\0'
)
{
return
-
1
;
/* oom */
if
(
p
->
name
[
0
]
==
'\0'
)
{
git_signature_free
(
p
);
git_signature_free
(
p
);
return
signature_error
(
"
Empty name or email
"
);
return
signature_error
(
"
Signature cannot have an empty name
"
);
}
}
p
->
when
.
time
=
time
;
p
->
when
.
time
=
time
;
...
@@ -81,9 +83,16 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
...
@@ -81,9 +83,16 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
git_signature
*
git_signature_dup
(
const
git_signature
*
sig
)
git_signature
*
git_signature_dup
(
const
git_signature
*
sig
)
{
{
git_signature
*
new
;
git_signature
*
new
=
git__calloc
(
1
,
sizeof
(
git_signature
));
if
(
git_signature_new
(
&
new
,
sig
->
name
,
sig
->
email
,
sig
->
when
.
time
,
sig
->
when
.
offset
)
<
0
)
if
(
new
==
NULL
)
return
NULL
;
return
NULL
;
new
->
name
=
git__strdup
(
sig
->
name
);
new
->
email
=
git__strdup
(
sig
->
email
);
new
->
when
.
time
=
sig
->
when
.
time
;
new
->
when
.
offset
=
sig
->
when
.
offset
;
return
new
;
return
new
;
}
}
...
...
tests-clar/commit/signature.c
View file @
f0ab7372
...
@@ -54,8 +54,8 @@ void test_commit_signature__create_empties(void)
...
@@ -54,8 +54,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_
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
));
cl_git_
pass
(
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