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
bbc1d4a0
Commit
bbc1d4a0
authored
Mar 06, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #588 from authmillenon/development
Rename git_oid_to_string to git_oid_tostr
parents
864ac49e
5621d809
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
24 deletions
+24
-24
include/git2/oid.h
+1
-1
src/diff_output.c
+2
-2
src/oid.c
+1
-1
src/reflog.c
+2
-2
tests-clar/object/raw/convert.c
+7
-7
tests/t01-rawobj.c
+7
-7
tests/t10-refs.c
+4
-4
No files found.
include/git2/oid.h
View file @
bbc1d4a0
...
@@ -119,7 +119,7 @@ GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *oid);
...
@@ -119,7 +119,7 @@ GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *oid);
* @return the out buffer pointer, assuming no input parameter
* @return the out buffer pointer, assuming no input parameter
* errors, otherwise a pointer to an empty string.
* errors, otherwise a pointer to an empty string.
*/
*/
GIT_EXTERN
(
char
*
)
git_oid_to
_string
(
char
*
out
,
size_t
n
,
const
git_oid
*
oid
);
GIT_EXTERN
(
char
*
)
git_oid_to
str
(
char
*
out
,
size_t
n
,
const
git_oid
*
oid
);
/**
/**
* Copy an oid from one structure to another.
* Copy an oid from one structure to another.
...
...
src/diff_output.c
View file @
bbc1d4a0
...
@@ -532,8 +532,8 @@ static int print_oid_range(diff_print_info *pi, git_diff_delta *delta)
...
@@ -532,8 +532,8 @@ static int print_oid_range(diff_print_info *pi, git_diff_delta *delta)
char
start_oid
[
8
],
end_oid
[
8
];
char
start_oid
[
8
],
end_oid
[
8
];
/* TODO: Determine a good actual OID range to print */
/* TODO: Determine a good actual OID range to print */
git_oid_to
_string
(
start_oid
,
sizeof
(
start_oid
),
&
delta
->
old_file
.
oid
);
git_oid_to
str
(
start_oid
,
sizeof
(
start_oid
),
&
delta
->
old_file
.
oid
);
git_oid_to
_string
(
end_oid
,
sizeof
(
end_oid
),
&
delta
->
new_file
.
oid
);
git_oid_to
str
(
end_oid
,
sizeof
(
end_oid
),
&
delta
->
new_file
.
oid
);
/* TODO: Match git diff more closely */
/* TODO: Match git diff more closely */
if
(
delta
->
old_file
.
mode
==
delta
->
new_file
.
mode
)
{
if
(
delta
->
old_file
.
mode
==
delta
->
new_file
.
mode
)
{
...
...
src/oid.c
View file @
bbc1d4a0
...
@@ -88,7 +88,7 @@ char *git_oid_allocfmt(const git_oid *oid)
...
@@ -88,7 +88,7 @@ char *git_oid_allocfmt(const git_oid *oid)
return
str
;
return
str
;
}
}
char
*
git_oid_to
_string
(
char
*
out
,
size_t
n
,
const
git_oid
*
oid
)
char
*
git_oid_to
str
(
char
*
out
,
size_t
n
,
const
git_oid
*
oid
)
{
{
char
str
[
GIT_OID_HEXSZ
];
char
str
[
GIT_OID_HEXSZ
];
...
...
src/reflog.c
View file @
bbc1d4a0
...
@@ -237,7 +237,7 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
...
@@ -237,7 +237,7 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
return
error
;
return
error
;
}
}
git_oid_to
_string
(
new
,
GIT_OID_HEXSZ
+
1
,
oid
);
git_oid_to
str
(
new
,
GIT_OID_HEXSZ
+
1
,
oid
);
git_reference_free
(
r
);
git_reference_free
(
r
);
...
@@ -263,7 +263,7 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
...
@@ -263,7 +263,7 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
goto
cleanup
;
goto
cleanup
;
if
(
oid_old
)
if
(
oid_old
)
git_oid_to
_string
(
old
,
sizeof
(
old
),
oid_old
);
git_oid_to
str
(
old
,
sizeof
(
old
),
oid_old
);
else
else
p_snprintf
(
old
,
sizeof
(
old
),
"%0*d"
,
GIT_OID_HEXSZ
,
0
);
p_snprintf
(
old
,
sizeof
(
old
),
"%0*d"
,
GIT_OID_HEXSZ
,
0
);
...
...
tests-clar/object/raw/convert.c
View file @
bbc1d4a0
...
@@ -14,24 +14,24 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
...
@@ -14,24 +14,24 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
cl_git_pass
(
git_oid_fromstr
(
&
in
,
exp
));
cl_git_pass
(
git_oid_fromstr
(
&
in
,
exp
));
/* NULL buffer pointer, returns static empty string */
/* NULL buffer pointer, returns static empty string */
str
=
git_oid_to
_string
(
NULL
,
sizeof
(
out
),
&
in
);
str
=
git_oid_to
str
(
NULL
,
sizeof
(
out
),
&
in
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
/* zero buffer size, returns static empty string */
/* zero buffer size, returns static empty string */
str
=
git_oid_to
_string
(
out
,
0
,
&
in
);
str
=
git_oid_to
str
(
out
,
0
,
&
in
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
/* NULL oid pointer, returns static empty string */
/* NULL oid pointer, returns static empty string */
str
=
git_oid_to
_string
(
out
,
sizeof
(
out
),
NULL
);
str
=
git_oid_to
str
(
out
,
sizeof
(
out
),
NULL
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
/* n == 1, returns out as an empty string */
/* n == 1, returns out as an empty string */
str
=
git_oid_to
_string
(
out
,
1
,
&
in
);
str
=
git_oid_to
str
(
out
,
1
,
&
in
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
==
out
);
cl_assert
(
str
&&
*
str
==
'\0'
&&
str
==
out
);
for
(
i
=
1
;
i
<
GIT_OID_HEXSZ
;
i
++
)
{
for
(
i
=
1
;
i
<
GIT_OID_HEXSZ
;
i
++
)
{
out
[
i
+
1
]
=
'Z'
;
out
[
i
+
1
]
=
'Z'
;
str
=
git_oid_to
_string
(
out
,
i
+
1
,
&
in
);
str
=
git_oid_to
str
(
out
,
i
+
1
,
&
in
);
/* returns out containing c-string */
/* returns out containing c-string */
cl_assert
(
str
&&
str
==
out
);
cl_assert
(
str
&&
str
==
out
);
/* must be '\0' terminated */
/* must be '\0' terminated */
...
@@ -43,7 +43,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
...
@@ -43,7 +43,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
}
}
/* returns out as hex formatted c-string */
/* returns out as hex formatted c-string */
str
=
git_oid_to
_string
(
out
,
sizeof
(
out
),
&
in
);
str
=
git_oid_to
str
(
out
,
sizeof
(
out
),
&
in
);
cl_assert
(
str
&&
str
==
out
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
cl_assert
(
str
&&
str
==
out
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
cl_assert
(
strcmp
(
exp
,
out
)
==
0
);
cl_assert
(
strcmp
(
exp
,
out
)
==
0
);
}
}
...
@@ -64,7 +64,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
...
@@ -64,7 +64,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
big
[
GIT_OID_HEXSZ
+
3
]
=
'Z'
;
/* ditto */
big
[
GIT_OID_HEXSZ
+
3
]
=
'Z'
;
/* ditto */
/* returns big as hex formatted c-string */
/* returns big as hex formatted c-string */
str
=
git_oid_to
_string
(
big
,
sizeof
(
big
),
&
in
);
str
=
git_oid_to
str
(
big
,
sizeof
(
big
),
&
in
);
cl_assert
(
str
&&
str
==
big
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
cl_assert
(
str
&&
str
==
big
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
cl_assert
(
strcmp
(
exp
,
big
)
==
0
);
cl_assert
(
strcmp
(
exp
,
big
)
==
0
);
...
...
tests/t01-rawobj.c
View file @
bbc1d4a0
...
@@ -237,24 +237,24 @@ BEGIN_TEST(oid14, "convert raw oid to string")
...
@@ -237,24 +237,24 @@ BEGIN_TEST(oid14, "convert raw oid to string")
must_pass
(
git_oid_fromstr
(
&
in
,
exp
));
must_pass
(
git_oid_fromstr
(
&
in
,
exp
));
/* NULL buffer pointer, returns static empty string */
/* NULL buffer pointer, returns static empty string */
str
=
git_oid_to
_string
(
NULL
,
sizeof
(
out
),
&
in
);
str
=
git_oid_to
str
(
NULL
,
sizeof
(
out
),
&
in
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
/* zero buffer size, returns static empty string */
/* zero buffer size, returns static empty string */
str
=
git_oid_to
_string
(
out
,
0
,
&
in
);
str
=
git_oid_to
str
(
out
,
0
,
&
in
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
/* NULL oid pointer, returns static empty string */
/* NULL oid pointer, returns static empty string */
str
=
git_oid_to
_string
(
out
,
sizeof
(
out
),
NULL
);
str
=
git_oid_to
str
(
out
,
sizeof
(
out
),
NULL
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
!=
out
);
/* n == 1, returns out as an empty string */
/* n == 1, returns out as an empty string */
str
=
git_oid_to
_string
(
out
,
1
,
&
in
);
str
=
git_oid_to
str
(
out
,
1
,
&
in
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
==
out
);
must_be_true
(
str
&&
*
str
==
'\0'
&&
str
==
out
);
for
(
i
=
1
;
i
<
GIT_OID_HEXSZ
;
i
++
)
{
for
(
i
=
1
;
i
<
GIT_OID_HEXSZ
;
i
++
)
{
out
[
i
+
1
]
=
'Z'
;
out
[
i
+
1
]
=
'Z'
;
str
=
git_oid_to
_string
(
out
,
i
+
1
,
&
in
);
str
=
git_oid_to
str
(
out
,
i
+
1
,
&
in
);
/* returns out containing c-string */
/* returns out containing c-string */
must_be_true
(
str
&&
str
==
out
);
must_be_true
(
str
&&
str
==
out
);
/* must be '\0' terminated */
/* must be '\0' terminated */
...
@@ -266,7 +266,7 @@ BEGIN_TEST(oid14, "convert raw oid to string")
...
@@ -266,7 +266,7 @@ BEGIN_TEST(oid14, "convert raw oid to string")
}
}
/* returns out as hex formatted c-string */
/* returns out as hex formatted c-string */
str
=
git_oid_to
_string
(
out
,
sizeof
(
out
),
&
in
);
str
=
git_oid_to
str
(
out
,
sizeof
(
out
),
&
in
);
must_be_true
(
str
&&
str
==
out
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
must_be_true
(
str
&&
str
==
out
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
must_be_true
(
strcmp
(
exp
,
out
)
==
0
);
must_be_true
(
strcmp
(
exp
,
out
)
==
0
);
END_TEST
END_TEST
...
@@ -286,7 +286,7 @@ BEGIN_TEST(oid15, "convert raw oid to string (big)")
...
@@ -286,7 +286,7 @@ BEGIN_TEST(oid15, "convert raw oid to string (big)")
big
[
GIT_OID_HEXSZ
+
3
]
=
'Z'
;
/* ditto */
big
[
GIT_OID_HEXSZ
+
3
]
=
'Z'
;
/* ditto */
/* returns big as hex formatted c-string */
/* returns big as hex formatted c-string */
str
=
git_oid_to
_string
(
big
,
sizeof
(
big
),
&
in
);
str
=
git_oid_to
str
(
big
,
sizeof
(
big
),
&
in
);
must_be_true
(
str
&&
str
==
big
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
must_be_true
(
str
&&
str
==
big
&&
*
(
str
+
GIT_OID_HEXSZ
)
==
'\0'
);
must_be_true
(
strcmp
(
exp
,
big
)
==
0
);
must_be_true
(
strcmp
(
exp
,
big
)
==
0
);
...
...
tests/t10-refs.c
View file @
bbc1d4a0
...
@@ -1234,17 +1234,17 @@ BEGIN_TEST(reflog0, "write a reflog for a given reference and ensure it can be r
...
@@ -1234,17 +1234,17 @@ BEGIN_TEST(reflog0, "write a reflog for a given reference and ensure it can be r
entry
=
(
git_reflog_entry
*
)
git_vector_get
(
&
reflog
->
entries
,
0
);
entry
=
(
git_reflog_entry
*
)
git_vector_get
(
&
reflog
->
entries
,
0
);
must_pass
(
assert_signature
(
committer
,
entry
->
committer
));
must_pass
(
assert_signature
(
committer
,
entry
->
committer
));
git_oid_to
_string
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_old
);
git_oid_to
str
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_old
);
must_be_true
(
strcmp
(
"0000000000000000000000000000000000000000"
,
oid_str
)
==
0
);
must_be_true
(
strcmp
(
"0000000000000000000000000000000000000000"
,
oid_str
)
==
0
);
git_oid_to
_string
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_cur
);
git_oid_to
str
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_cur
);
must_be_true
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
must_be_true
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
must_be_true
(
entry
->
msg
==
NULL
);
must_be_true
(
entry
->
msg
==
NULL
);
entry
=
(
git_reflog_entry
*
)
git_vector_get
(
&
reflog
->
entries
,
1
);
entry
=
(
git_reflog_entry
*
)
git_vector_get
(
&
reflog
->
entries
,
1
);
must_pass
(
assert_signature
(
committer
,
entry
->
committer
));
must_pass
(
assert_signature
(
committer
,
entry
->
committer
));
git_oid_to
_string
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_old
);
git_oid_to
str
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_old
);
must_be_true
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
must_be_true
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
git_oid_to
_string
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_cur
);
git_oid_to
str
(
oid_str
,
GIT_OID_HEXSZ
+
1
,
&
entry
->
oid_cur
);
must_be_true
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
must_be_true
(
strcmp
(
current_master_tip
,
oid_str
)
==
0
);
must_be_true
(
strcmp
(
commit_msg
,
entry
->
msg
)
==
0
);
must_be_true
(
strcmp
(
commit_msg
,
entry
->
msg
)
==
0
);
...
...
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