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
c103d7b4
Commit
c103d7b4
authored
Sep 29, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
odb: Pass compression settings to filebuf
parent
8af4d074
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
src/filebuf.c
+5
-4
src/filebuf.h
+1
-1
src/odb_loose.c
+4
-4
No files found.
src/filebuf.c
View file @
c103d7b4
...
@@ -129,7 +129,7 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
...
@@ -129,7 +129,7 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
int
git_filebuf_open
(
git_filebuf
*
file
,
const
char
*
path
,
int
flags
)
int
git_filebuf_open
(
git_filebuf
*
file
,
const
char
*
path
,
int
flags
)
{
{
int
error
;
int
error
,
compression
;
size_t
path_len
;
size_t
path_len
;
assert
(
file
&&
path
);
assert
(
file
&&
path
);
...
@@ -155,11 +155,12 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
...
@@ -155,11 +155,12 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
}
}
}
}
/* If we are deflating on-write, */
compression
=
flags
>>
GIT_FILEBUF_DEFLATE_SHIFT
;
if
(
flags
&
GIT_FILEBUF_DEFLATE_CONTENTS
)
{
/* If we are deflating on-write, */
if
(
compression
!=
0
)
{
/* Initialize the ZLib stream */
/* Initialize the ZLib stream */
if
(
deflateInit
(
&
file
->
zs
,
Z_BEST_SPEED
)
!=
Z_OK
)
{
if
(
deflateInit
(
&
file
->
zs
,
compression
)
!=
Z_OK
)
{
error
=
git__throw
(
GIT_EZLIB
,
"Failed to initialize zlib"
);
error
=
git__throw
(
GIT_EZLIB
,
"Failed to initialize zlib"
);
goto
cleanup
;
goto
cleanup
;
}
}
...
...
src/filebuf.h
View file @
c103d7b4
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#define GIT_FILEBUF_APPEND (1 << 2)
#define GIT_FILEBUF_APPEND (1 << 2)
#define GIT_FILEBUF_FORCE (1 << 3)
#define GIT_FILEBUF_FORCE (1 << 3)
#define GIT_FILEBUF_TEMPORARY (1 << 4)
#define GIT_FILEBUF_TEMPORARY (1 << 4)
#define GIT_FILEBUF_DEFLATE_
CONTENTS (1 <<
5)
#define GIT_FILEBUF_DEFLATE_
SHIFT (
5)
#define GIT_FILELOCK_EXTENSION ".lock\0"
#define GIT_FILELOCK_EXTENSION ".lock\0"
#define GIT_FILELOCK_EXTLENGTH 6
#define GIT_FILELOCK_EXTLENGTH 6
...
...
src/odb_loose.c
View file @
c103d7b4
...
@@ -735,8 +735,8 @@ static int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_
...
@@ -735,8 +735,8 @@ static int loose_backend__stream(git_odb_stream **stream_out, git_odb_backend *_
error
=
git_filebuf_open
(
&
stream
->
fbuf
,
tmp_path
,
error
=
git_filebuf_open
(
&
stream
->
fbuf
,
tmp_path
,
GIT_FILEBUF_HASH_CONTENTS
|
GIT_FILEBUF_HASH_CONTENTS
|
GIT_FILEBUF_
DEFLATE_CONTENTS
|
GIT_FILEBUF_
TEMPORARY
|
GIT_FILEBUF_TEMPORARY
);
(
backend
->
object_zlib_level
<<
GIT_FILEBUF_DEFLATE_SHIFT
)
);
if
(
error
<
GIT_SUCCESS
)
{
if
(
error
<
GIT_SUCCESS
)
{
free
(
stream
);
free
(
stream
);
...
@@ -774,8 +774,8 @@ static int loose_backend__write(git_oid *oid, git_odb_backend *_backend, const v
...
@@ -774,8 +774,8 @@ static int loose_backend__write(git_oid *oid, git_odb_backend *_backend, const v
error
=
git_filebuf_open
(
&
fbuf
,
final_path
,
error
=
git_filebuf_open
(
&
fbuf
,
final_path
,
GIT_FILEBUF_HASH_CONTENTS
|
GIT_FILEBUF_HASH_CONTENTS
|
GIT_FILEBUF_
DEFLATE_CONTENTS
|
GIT_FILEBUF_
TEMPORARY
|
GIT_FILEBUF_TEMPORARY
);
(
backend
->
object_zlib_level
<<
GIT_FILEBUF_DEFLATE_SHIFT
)
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
error
;
...
...
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