Skip to content

Commit

Permalink
core.fsync: sync loose objects by default on windows
Browse files Browse the repository at this point in the history
Git for Windows has defaulted to core.fsyncObjectFiles=true since
September 2017.  Preceding commits in this series eliminated the
core.fsyncObjectFiles setting, so this commit implements equivalent
behavior.

Loose object file syncing was previously only enabled in the Git for
Windows fork, but now I am setting it in upstream Git so that we can get
coverage for batch mode syncing.

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
  • Loading branch information
neerajsi-msft committed Jan 28, 2022
1 parent 77d5850 commit 9003375
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/config/core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ core.fsync::
* `index` hardens the index when it is modified.
* `objects` is an aggregate option that includes `loose-objects` and `pack`.
* `derived-metadata` is an aggregate option that includes `pack-metadata` and `commit-graph`.
* `default` is an aggregate option that is equivalent to `objects,derived-metadata,-loose-object`
* `default` is an aggregate option that represents the platform-specific default
* `all` is an aggregate option that syncs all individual components above.

core.fsyncMethod::
Expand Down
7 changes: 6 additions & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -1007,9 +1007,14 @@ enum fsync_component {
FSYNC_COMPONENT_INDEX = 1 << 4,
};

#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT
#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENT_NONE
#endif

#define FSYNC_COMPONENTS_DEFAULT (FSYNC_COMPONENT_PACK | \
FSYNC_COMPONENT_PACK_METADATA | \
FSYNC_COMPONENT_COMMIT_GRAPH)
FSYNC_COMPONENT_COMMIT_GRAPH | \
FSYNC_COMPONENTS_PLATFORM_DEFAULT)

#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
FSYNC_COMPONENT_PACK)
Expand Down
2 changes: 2 additions & 0 deletions compat/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ int mingw_getpagesize(void);
int win32_fsync_no_flush(int fd);
#define fsync_no_flush win32_fsync_no_flush

#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENT_LOOSE_OBJECT

struct rlimit {
unsigned int rlim_cur;
};
Expand Down

0 comments on commit 9003375

Please sign in to comment.