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
1c9c081a
Commit
1c9c081a
authored
Apr 13, 2012
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indexer: add git_indexer_stream_free() and _hash()
parent
907ebe85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
include/git2/indexer.h
+17
-0
src/indexer.c
+29
-0
No files found.
include/git2/indexer.h
View file @
1c9c081a
...
...
@@ -53,6 +53,23 @@ GIT_EXTERN(int) git_indexer_stream_add(git_indexer_stream *idx, void *data, size
GIT_EXTERN
(
int
)
git_indexer_stream_finalize
(
git_indexer_stream
*
idx
,
git_indexer_stats
*
stats
);
/**
* Get the packfile's hash
*
* A packfile's name is derived from the sorted hashing of all object
* names. This is only correct after the index has been finalized.
*
* @param idx the indexer instance
*/
GIT_EXTERN
(
const
git_oid
*
)
git_indexer_stream_hash
(
git_indexer_stream
*
idx
);
/**
* Free the indexer and its resources
*
* @param idx the indexer to free
*/
GIT_EXTERN
(
void
)
git_indexer_stream_free
(
git_indexer_stream
*
idx
);
/**
* Create a new indexer instance
*
* @param out where to store the indexer instance
...
...
src/indexer.c
View file @
1c9c081a
...
...
@@ -60,6 +60,11 @@ const git_oid *git_indexer_hash(git_indexer *idx)
return
&
idx
->
hash
;
}
const
git_oid
*
git_indexer_stream_hash
(
git_indexer_stream
*
idx
)
{
return
&
idx
->
hash
;
}
static
int
open_pack
(
struct
git_pack_file
**
out
,
const
char
*
filename
)
{
size_t
namelen
;
...
...
@@ -544,6 +549,30 @@ on_error:
return
-
1
;
}
void
git_indexer_stream_free
(
git_indexer_stream
*
idx
)
{
unsigned
int
i
;
struct
entry
*
e
;
struct
git_pack_entry
*
pe
;
struct
delta_info
*
delta
;
if
(
idx
==
NULL
)
return
;
p_close
(
idx
->
pack
->
mwf
.
fd
);
git_vector_foreach
(
&
idx
->
objects
,
i
,
e
)
git__free
(
e
);
git_vector_free
(
&
idx
->
objects
);
git_vector_foreach
(
&
idx
->
pack
->
cache
,
i
,
pe
)
git__free
(
pe
);
git_vector_free
(
&
idx
->
pack
->
cache
);
git_vector_foreach
(
&
idx
->
deltas
,
i
,
delta
)
git__free
(
delta
);
git_vector_free
(
&
idx
->
deltas
);
git__free
(
idx
->
pack
);
git__free
(
idx
);
}
int
git_indexer_new
(
git_indexer
**
out
,
const
char
*
packname
)
{
git_indexer
*
idx
;
...
...
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