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
a070f152
Commit
a070f152
authored
Jul 29, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move pack functions to their own file
parent
7d0cdf82
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
23 deletions
+19
-23
src/indexer.c
+4
-4
src/odb_pack.c
+0
-0
src/pack.c
+0
-0
src/pack.h
+15
-19
No files found.
src/indexer.c
View file @
a070f152
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#include "posix.h"
#include "posix.h"
typedef
struct
git_indexer
{
typedef
struct
git_indexer
{
struct
pack_file
*
pack
;
struct
git_
pack_file
*
pack
;
git_vector
objects
;
git_vector
objects
;
git_vector
deltas
;
git_vector
deltas
;
struct
stat
st
;
struct
stat
st
;
...
@@ -42,7 +42,7 @@ typedef struct git_indexer {
...
@@ -42,7 +42,7 @@ typedef struct git_indexer {
static
int
parse_header
(
git_indexer
*
idx
)
static
int
parse_header
(
git_indexer
*
idx
)
{
{
struct
pack_header
hdr
;
struct
git_
pack_header
hdr
;
int
error
;
int
error
;
/* Verify we recognize this pack file format. */
/* Verify we recognize this pack file format. */
...
@@ -96,11 +96,11 @@ int git_indexer_new(git_indexer **out, const char *packname)
...
@@ -96,11 +96,11 @@ int git_indexer_new(git_indexer **out, const char *packname)
memset
(
idx
,
0x0
,
sizeof
(
*
idx
));
memset
(
idx
,
0x0
,
sizeof
(
*
idx
));
namelen
=
strlen
(
packname
);
namelen
=
strlen
(
packname
);
idx
->
pack
=
git__malloc
(
sizeof
(
struct
pack_file
)
+
namelen
+
1
);
idx
->
pack
=
git__malloc
(
sizeof
(
struct
git_
pack_file
)
+
namelen
+
1
);
if
(
idx
->
pack
==
NULL
)
if
(
idx
->
pack
==
NULL
)
goto
cleanup
;
goto
cleanup
;
memset
(
idx
->
pack
,
0x0
,
sizeof
(
struct
pack_file
));
memset
(
idx
->
pack
,
0x0
,
sizeof
(
struct
git_
pack_file
));
memcpy
(
idx
->
pack
->
pack_name
,
packname
,
namelen
);
memcpy
(
idx
->
pack
->
pack_name
,
packname
,
namelen
);
ret
=
p_stat
(
packname
,
&
idx
->
st
);
ret
=
p_stat
(
packname
,
&
idx
->
st
);
...
...
src/odb_pack.c
View file @
a070f152
This diff is collapsed.
Click to expand it.
src/pack.c
View file @
a070f152
This diff is collapsed.
Click to expand it.
src/pack.h
View file @
a070f152
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
#define PACK_SIGNATURE 0x5041434b
/* "PACK" */
#define PACK_SIGNATURE 0x5041434b
/* "PACK" */
#define PACK_VERSION 2
#define PACK_VERSION 2
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
struct
pack_header
{
struct
git_
pack_header
{
uint32_t
hdr_signature
;
uint32_t
hdr_signature
;
uint32_t
hdr_version
;
uint32_t
hdr_version
;
uint32_t
hdr_entries
;
uint32_t
hdr_entries
;
...
@@ -62,12 +62,12 @@ struct pack_header {
...
@@ -62,12 +62,12 @@ struct pack_header {
#define PACK_IDX_SIGNATURE 0xff744f63
/* "\377tOc" */
#define PACK_IDX_SIGNATURE 0xff744f63
/* "\377tOc" */
struct
pack_idx_header
{
struct
git_
pack_idx_header
{
uint32_t
idx_signature
;
uint32_t
idx_signature
;
uint32_t
idx_version
;
uint32_t
idx_version
;
};
};
struct
pack_file
{
struct
git_
pack_file
{
git_mwindow_file
mwf
;
git_mwindow_file
mwf
;
git_map
index_map
;
git_map
index_map
;
...
@@ -84,15 +84,12 @@ struct pack_file {
...
@@ -84,15 +84,12 @@ struct pack_file {
char
pack_name
[
GIT_FLEX_ARRAY
];
/* more */
char
pack_name
[
GIT_FLEX_ARRAY
];
/* more */
};
};
struct
pack_entry
{
struct
git_
pack_entry
{
off_t
offset
;
off_t
offset
;
git_oid
sha1
;
git_oid
sha1
;
struct
pack_file
*
p
;
struct
git_
pack_file
*
p
;
};
};
static
unsigned
char
*
pack_window_open
(
struct
pack_file
*
p
,
git_mwindow
**
w_cursor
,
off_t
offset
,
unsigned
int
*
left
);
int
git_packfile_unpack_header
(
int
git_packfile_unpack_header
(
size_t
*
size_p
,
size_t
*
size_p
,
git_otype
*
type_p
,
git_otype
*
type_p
,
...
@@ -100,19 +97,18 @@ int git_packfile_unpack_header(
...
@@ -100,19 +97,18 @@ int git_packfile_unpack_header(
git_mwindow
**
w_curs
,
git_mwindow
**
w_curs
,
off_t
*
curpos
);
off_t
*
curpos
);
int
packfile_unpack_delta
(
int
git_packfile_unpack
(
git_rawobj
*
obj
,
struct
git_pack_file
*
p
,
off_t
obj_offset
);
git_rawobj
*
obj
,
struct
pack_file
*
p
,
git_mwindow
**
w_curs
,
off_t
curpos
,
size_t
delta_size
,
git_otype
delta_type
,
off_t
obj_offset
);
int
packfile_unpack
(
git_rawobj
*
obj
,
struct
pack_file
*
p
,
off_t
obj_offset
);
off_t
get_delta_base
(
struct
pack_file
*
p
,
git_mwindow
**
w_curs
,
off_t
get_delta_base
(
struct
git_
pack_file
*
p
,
git_mwindow
**
w_curs
,
off_t
*
curpos
,
git_otype
type
,
off_t
*
curpos
,
git_otype
type
,
off_t
delta_obj_offset
);
off_t
delta_obj_offset
);
void
packfile_free
(
struct
git_pack_file
*
p
);
int
git_packfile_check
(
struct
git_pack_file
**
pack_out
,
const
char
*
path
);
int
git_pack_entry_find
(
struct
git_pack_entry
*
e
,
struct
git_pack_file
*
p
,
const
git_oid
*
short_oid
,
unsigned
int
len
);
#endif
#endif
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