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
6d3ad7e0
Commit
6d3ad7e0
authored
Dec 13, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `ENABLE_SYNCHRONIZED_OBJECT_CREATION` option
Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.
parent
fc27fe21
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
1 deletions
+16
-1
include/git2/common.h
+8
-0
src/object.c
+1
-0
src/object.h
+1
-0
src/odb_loose.c
+2
-1
src/settings.c
+4
-0
No files found.
include/git2/common.h
View file @
6d3ad7e0
...
...
@@ -179,6 +179,7 @@ typedef enum {
GIT_OPT_SET_SSL_CIPHERS
,
GIT_OPT_GET_USER_AGENT
,
GIT_OPT_ENABLE_OFS_DELTA
,
GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION
,
}
git_libgit2_opt_t
;
/**
...
...
@@ -316,6 +317,13 @@ typedef enum {
* > Packfiles containing offset deltas can still be read.
* > This defaults to enabled.
*
* * opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, int enabled)
*
* > Enable synchronized writes of new objects using `fsync`
* > (or the platform equivalent) to ensure that new object data
* > is written to permanent storage, not simply cached. This
* > defaults to disabled.
*
* @param option Option key
* @param ... value to set the option
* @return 0 on success, <0 on failure
...
...
src/object.c
View file @
6d3ad7e0
...
...
@@ -16,6 +16,7 @@
#include "tag.h"
bool
git_object__strict_input_validation
=
true
;
bool
git_object__synchronized_writing
=
false
;
typedef
struct
{
const
char
*
str
;
/* type name string */
...
...
src/object.h
View file @
6d3ad7e0
...
...
@@ -10,6 +10,7 @@
#include "repository.h"
extern
bool
git_object__strict_input_validation
;
extern
bool
git_object__synchronized_writing
;
/** Base git object for inheritance */
struct
git_object
{
...
...
src/odb_loose.c
View file @
6d3ad7e0
...
...
@@ -14,6 +14,7 @@
#include "odb.h"
#include "delta.h"
#include "filebuf.h"
#include "object.h"
#include "git2/odb_backend.h"
#include "git2/types.h"
...
...
@@ -843,7 +844,7 @@ static int filebuf_flags(loose_backend *backend)
int
flags
=
GIT_FILEBUF_TEMPORARY
|
(
backend
->
object_zlib_level
<<
GIT_FILEBUF_DEFLATE_SHIFT
);
if
(
backend
->
fsync_object_files
)
if
(
backend
->
fsync_object_files
||
git_object__synchronized_writing
)
flags
|=
GIT_FILEBUF_FSYNC
;
return
flags
;
...
...
src/settings.c
View file @
6d3ad7e0
...
...
@@ -227,6 +227,10 @@ int git_libgit2_opts(int key, ...)
git_smart__ofs_delta_enabled
=
(
va_arg
(
ap
,
int
)
!=
0
);
break
;
case
GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION
:
git_object__synchronized_writing
=
(
va_arg
(
ap
,
int
)
!=
0
);
break
;
default:
giterr_set
(
GITERR_INVALID
,
"invalid option key"
);
error
=
-
1
;
...
...
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