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
addc9be4
Commit
addc9be4
authored
Sep 26, 2012
by
Jameson Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error hashing empty file.
parent
5942bd18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
src/odb.c
+1
-1
tests-clar/status/single.c
+16
-0
No files found.
src/odb.c
View file @
addc9be4
...
...
@@ -115,7 +115,7 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
int
hdr_len
;
char
hdr
[
64
],
buffer
[
2048
];
git_hash_ctx
*
ctx
;
ssize_t
read_len
=
-
1
;
ssize_t
read_len
=
0
;
if
(
!
git_object_typeisloose
(
type
))
{
giterr_set
(
GITERR_INVALID
,
"Invalid object type for hash"
);
...
...
tests-clar/status/single.c
View file @
addc9be4
...
...
@@ -25,5 +25,21 @@ void test_status_single__hash_single_file(void)
cl_assert
(
git_oid_cmp
(
&
expected_id
,
&
actual_id
)
==
0
);
}
/* test retrieving OID from an empty file apart from the ODB */
void
test_status_single__hash_single_empty_file
(
void
)
{
static
const
char
file_name
[]
=
"new_empty_file"
;
static
const
char
file_contents
[]
=
""
;
static
const
char
file_hash
[]
=
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
;
git_oid
expected_id
,
actual_id
;
/* initialization */
git_oid_fromstr
(
&
expected_id
,
file_hash
);
cl_git_mkfile
(
file_name
,
file_contents
);
cl_set_cleanup
(
&
cleanup__remove_file
,
(
void
*
)
file_name
);
cl_git_pass
(
git_odb_hashfile
(
&
actual_id
,
file_name
,
GIT_OBJ_BLOB
));
cl_assert
(
git_oid_cmp
(
&
expected_id
,
&
actual_id
)
==
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