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
b206d74c
Commit
b206d74c
authored
May 16, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #703 from carlosmn/consistency
A few indexer consistency checks
parents
54695f40
6a9d61ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
include/git2/errors.h
+1
-0
src/indexer.c
+16
-5
No files found.
include/git2/errors.h
View file @
b206d74c
...
...
@@ -62,6 +62,7 @@ typedef enum {
GITERR_NET
,
GITERR_TAG
,
GITERR_TREE
,
GITERR_INDEXER
,
}
git_error_class
;
/**
...
...
src/indexer.c
View file @
b206d74c
...
...
@@ -110,12 +110,12 @@ static int parse_header(struct git_pack_header *hdr, struct git_pack_file *pack)
}
if
(
hdr
->
hdr_signature
!=
ntohl
(
PACK_SIGNATURE
))
{
giterr_set
(
GITERR_IN
VALID
,
"Wrong pack signature"
);
giterr_set
(
GITERR_IN
DEXER
,
"Wrong pack signature"
);
return
-
1
;
}
if
(
!
pack_version_ok
(
hdr
->
hdr_version
))
{
giterr_set
(
GITERR_IN
VALID
,
"Wrong pack version"
);
giterr_set
(
GITERR_IN
DEXER
,
"Wrong pack version"
);
return
-
1
;
}
...
...
@@ -248,7 +248,7 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
/* FIXME: Parse the object instead of hashing it */
if
(
git_odb__hashobj
(
&
oid
,
obj
)
<
0
)
{
giterr_set
(
GITERR_IN
VALID
,
"Failed to hash object"
);
giterr_set
(
GITERR_IN
DEXER
,
"Failed to hash object"
);
return
-
1
;
}
...
...
@@ -441,10 +441,21 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_indexer_stats *stat
git_oid
file_hash
;
SHA_CTX
ctx
;
/* Test for this before resolve_deltas(), as it plays with idx->off */
if
(
idx
->
off
<
idx
->
pack
->
mwf
.
size
-
GIT_OID_RAWSZ
)
{
giterr_set
(
GITERR_INDEXER
,
"Indexing error: junk at the end of the pack"
);
return
-
1
;
}
if
(
idx
->
deltas
.
length
>
0
)
if
(
resolve_deltas
(
idx
,
stats
)
<
0
)
return
-
1
;
if
(
stats
->
processed
!=
stats
->
total
)
{
giterr_set
(
GITERR_INDEXER
,
"Indexing error: early EOF"
);
return
-
1
;
}
git_vector_sort
(
&
idx
->
objects
);
git_buf_sets
(
&
filename
,
idx
->
pack
->
pack_name
);
...
...
@@ -583,7 +594,7 @@ int git_indexer_new(git_indexer **out, const char *packname)
assert
(
out
&&
packname
);
if
(
git_path_root
(
packname
)
<
0
)
{
giterr_set
(
GITERR_IN
VALID
,
"Path is not absolute"
);
giterr_set
(
GITERR_IN
DEXER
,
"Path is not absolute"
);
return
-
1
;
}
...
...
@@ -815,7 +826,7 @@ int git_indexer_run(git_indexer *idx, git_indexer_stats *stats)
/* FIXME: Parse the object instead of hashing it */
error
=
git_odb__hashobj
(
&
oid
,
&
obj
);
if
(
error
<
0
)
{
giterr_set
(
GITERR_IN
VALID
,
"Failed to hash object"
);
giterr_set
(
GITERR_IN
DEXER
,
"Failed to hash object"
);
goto
cleanup
;
}
...
...
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