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
f23c4a66
Commit
f23c4a66
authored
Jul 07, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start the runner
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent
3412391d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
7 deletions
+45
-7
include/git2/indexer.h
+11
-7
src/indexer.c
+34
-0
No files found.
include/git2/indexer.h
View file @
f23c4a66
#ifndef _INCLUDE_git_indexer_h__
#define _INCLUDE_git_indexer_h__
typedef
struct
git_pack_indexer
{
struct
pack_file
*
pack
;
git_vector
objects
;
git_vector
deltas
;
struct
stat
st
;
}
git_pack_indexer
;
#include "git2/common.h"
typedef
struct
git_indexer_stats
{
unsigned
int
total
;
unsigned
int
parsed
;
}
git_indexer_stats
;
typedef
struct
git_pack_indexer
git_pack_indexer
;
GIT_EXTERN
(
int
)
git_pack_indexer_new
(
git_pack_indexer
**
out
,
const
char
*
packname
);
GIT_EXTERN
(
void
)
git_pack_indexer_free
(
git_pack_indexer
*
idx
)
GIT_EXTERN
(
int
)
git_pack_indexer_run
(
git_pack_indexer
*
idx
,
int
(
*
cb
)(
const
git_indexer_stats
*
,
void
*
),
void
*
data
);
GIT_EXTERN
(
void
)
git_pack_indexer_free
(
git_pack_indexer
*
idx
);
#endif
src/indexer.c
View file @
f23c4a66
...
...
@@ -23,10 +23,21 @@
* Boston, MA 02110-1301, USA.
*/
#include "git2/indexer.h"
#include "common.h"
#include "pack.h"
#include "mwindow.h"
#include "posix.h"
typedef
struct
git_pack_indexer
{
struct
pack_file
*
pack
;
git_vector
objects
;
git_vector
deltas
;
struct
stat
st
;
git_indexer_stats
stats
;
}
git_pack_indexer
;
static
int
parse_header
(
git_pack_indexer
*
idx
)
{
struct
pack_header
hdr
;
...
...
@@ -59,6 +70,8 @@ static int parse_header(git_pack_indexer *idx)
if
(
error
<
GIT_SUCCESS
)
goto
cleanup
;
idx
->
stats
.
total
=
hdr
.
hdr_entries
;
return
GIT_SUCCESS
;
cleanup:
...
...
@@ -123,6 +136,27 @@ cleanup:
return
error
;
}
/*
* Create the index. Every time something interesting happens
* (something has been parse or resolved), the callback gets called
* with some stats so it can tell the user how hard we're working
*/
int
git_pack_indexer_run
(
git_pack_indexer
*
idx
,
int
(
*
cb
)(
const
git_indexer_stats
*
,
void
*
),
void
*
data
)
{
git_mwindow_file
*
mwf
=
&
idx
->
pack
->
mwf
;
int
error
;
error
=
git_mwindow_file_register
(
mwf
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to register mwindow file"
);
/* notify early */
if
(
cb
)
cb
(
&
idx
->
stats
,
data
);
return
error
;
}
void
git_pack_indexer_free
(
git_pack_indexer
*
idx
)
{
p_close
(
idx
->
pack
->
pack_fd
);
...
...
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