Commit Graph

10132 Commits

Author SHA1 Message Date
Edward Thomson
2a5ad7d0f2 fsync: call it "synchronous" object writing
Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` ->
`GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
2017-02-28 13:29:01 +00:00
Edward Thomson
1229e1c4d7 fsync parent directories when fsyncing
When fsync'ing files, fsync the parent directory in the case where we
rename a file into place, or create a new file, to ensure that the
directory entry is flushed correctly.
2017-02-28 13:28:36 +00:00
Edward Thomson
5a747e0c6c git_futils_writebuffer: default only when flags==0
Only use defaults for `git_futils_writebuffer` when flags == 0, lest
(1 << 31) be treated as the defaults.
2017-02-28 13:28:36 +00:00
Edward Thomson
eb56ed81af refdb_fs: optionally fsync packed refs 2017-02-28 13:28:36 +00:00
Edward Thomson
af3dcb0e50 refdb_fs: optionally fsync loose references 2017-02-28 13:28:36 +00:00
Edward Thomson
5312621bd4 git_futils_writebuffer: optionally fsync
Add a custom `O_FSYNC` bit (if it's not been defined by the operating
system`) so that `git_futils_writebuffer` can optionally do an `fsync`
when it's done writing.

We call `fsync` ourselves, even on systems that define `O_FSYNC` because
its definition is no guarantee of its actual support.  Mac, for
instance, defines it but doesn't support it in an `open(2)` call.
2017-02-28 13:27:50 +00:00
Edward Thomson
1c2c0ae2a4 packbuilder: honor git_object__synchronized_writing
Honor `git_object__synchronized_writing` when creating a packfile and
corresponding index.
2017-02-28 13:27:50 +00:00
Edward Thomson
e6ed0d2f03 odb_loose: fsync tests
Introduce a simple counter that `p_fsync` implements.  This is useful
for ensuring that `p_fsync` is called when we expect it to be, for
example when we have enabled an odb backend to perform `fsync`s when
writing objects.
2017-02-28 13:27:49 +00:00
Edward Thomson
6d3ad7e09e Add ENABLE_SYNCHRONIZED_OBJECT_CREATION option
Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.
2017-02-28 13:27:49 +00:00
Edward Thomson
fc27fe213c odb_loose: actually honor the fsync option
We've had an fsync option for a long time, but it was "ignored".
Stop ignoring it.
2017-02-28 13:27:49 +00:00
Edward Thomson
fc77891f63 git_filebuf: optionally fsync when committing 2017-02-28 13:27:49 +00:00
Richard Ipsum
1255a9ac0c Fix: make reflog include "(merge)" for merge commits
This fixes issue #4094
2017-02-27 23:53:12 +00:00
Edward Thomson
a4b5ac643c Merge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test
tests: Add create__symbolic_with_arbitrary_content
2017-02-26 16:12:30 +00:00
Edward Thomson
55d911d69a Merge pull request #4142 from pblesi/patch-1
Fix minor typos in CONVENTIONS.md
2017-02-26 16:08:00 +00:00
Edward Thomson
6313a20855 Merge pull request #4141 from kainjow/patch-2
Fix inet_pton tests triggering an assert in Haiku
2017-02-26 16:01:32 +00:00
Patrick Blesi
c1239e3327 Fix minor typos in CONVENTIONS.md 2017-02-25 23:09:42 -06:00
Kevin Wojniak
4017017740 Fix inet_pton tests triggering an assert in Haiku
Haiku will assert in a nightly build if the "dst" input to inet_pton() is NULL.
2017-02-25 10:21:59 -08:00
Richard Ipsum
b84e58f45d Whitespace and style fixes
Use C style comments as per style guide,
and fix mismatching indentation.
2017-02-25 14:18:16 +00:00
Richard Ipsum
d2b3a21f2b tests: Add create__symbolic_with_arbitrary_content
This test ensures that it's possible to create a symbolic ref that
has arbitrary data as its target. It also ensures it's possible
to obtain the target of that symbolic reference from the git_reference
object.
2017-02-25 14:18:16 +00:00
Edward Thomson
7143145f2f Merge pull request #4137 from libgit2/ethomson/appveyor
appveyor: don't rewrite the system mingw
2017-02-25 12:45:14 +00:00
Edward Thomson
408a7b7737 appveyor: don't rewrite system mingw
Download mingw-w64 into our build directory and execute it there, don't
try to overwrite the system's mingw.
2017-02-24 20:25:45 +00:00
Edward Thomson
c3abb1d261 appveyor: always build the 'appveyor' branch
The 'appveyor' branch is useful for testing AppVeyor builds.
2017-02-24 17:39:01 +00:00
Patrick Steinhardt
7f875fb4f6 Merge pull request #4133 from stinb/khash-cleanup-regression
fix regression from #4092
2017-02-24 08:51:50 +01:00
Jason Haslam
685f22519c pack: fix looping over cache entries
Fixes a regression from #4092. This is a crash on 32-bit and I assume that
it doesn't do the right thing on 64-bit either. MSVC emits a warning for this,
but of course, it's easy to get lost among all of the similar 'possible loss
of data' warnings.
2017-02-22 09:29:00 -07:00
Carlos Martín Nieto
c03f00ea9c Merge pull request #4131 from pks-t/pks/attrcache-cleanups
Attrcache cleanups
2017-02-22 16:30:57 +01:00
Carlos Martín Nieto
86201b92c3 Merge pull request #4135 from libgit2/ethomson/ancient_gcc_not_threadsafe
Provide error on gcc < 4.1 when THREADSAFE
2017-02-22 16:17:54 +01:00
Edward Thomson
aa5ea47f73 Provide error on gcc < 4.1 when THREADSAFE
Provide a descriptive error message when compiling THREADSAFE on gcc
versions < 4.1.  We require the atomic primitives (eg
`__sync_synchronize`) that were introduced in that version.

(Note, clang setes `__GNUC__` but appears to set its version > 4.1.)
2017-02-22 11:21:56 +00:00
Patrick Steinhardt
ce6f61daf0 attrcache: remove useless do_init indirection
Remove useless indirection from `git_attr_cache__init` to
`git_attr_cache__do_init`. The difference is that the
`git_attr_cache__init` macro first checks if the cache is already
initialized and, if so, not call `git_attr_cache__do_init`. But
actually, `git_attr_cache__do_init` already does the same thing and
returns immediately if the cache is already initialized.

Remove the indirection.
2017-02-21 16:17:36 +01:00
Patrick Steinhardt
c11510103d attrcache: replace existing file entry with git__swap
When doing an upsert of a file, we used to use `git__compare_and_swap`,
comparing the entry's file which is to be replaced with itself. This can
be more easily formulated by using `git__swap`, which unconditionally
replaces the value.
2017-02-21 16:17:36 +01:00
Patrick Steinhardt
b8ab782a6d attrcache: do not lock/unlock the mutex directly
Improve encapsulation by not referencing the attrcache mutex directly
but instead using the `attr_cache_lock` and `attr_cache_unlock`
functions.
2017-02-21 16:17:31 +01:00
Edward Thomson
b13f0da153 Merge pull request #4130 from libgit2/ethomson/clar_messages
Improve clar messages
2017-02-17 16:32:14 +00:00
Edward Thomson
c52480fde5 cl_git_exec -> cl_git_expect 2017-02-17 13:01:49 +00:00
Edward Thomson
a1dcc83030 tests: provide better pass/failure error messages
Provide more detailed messages when conditions pass or fail
unexpectedly.  In particular, this provides the error messages when a
test fails with a different error code than was expected.
2017-02-17 12:58:57 +00:00
Edward Thomson
cc17264270 p_snprintf: no need for arguments to a format
`snprintf` requires a _format_ but does not require _arguments_ to the
format.  eg: `snprintf(buf, 42, "hi")` is perfectly legal.  Expand the
macro to match.

Without this, `p_sprintf(buf, 42, "hi")` errors with:

```
error: expected expression
                p_snprintf(msg, 42, "hi");
                ^
src/unix/posix.h:53:34: note: expanded from macro 'p_snprintf'
                                 ^
/usr/include/secure/_stdio.h:57:73: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str),
__VA_ARGS__)
```
2017-02-17 12:10:19 +00:00
Patrick Steinhardt
d0c72a92ef Merge pull request #4092 from pks-t/pks/khash-cleanups
khash cleanups
2017-02-17 12:41:05 +01:00
Patrick Steinhardt
8f1ff26bd3 idxmap: remove GIT__USE_IDXMAP 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
cee9ca6609 idxmap: convert to use functions instead of macros 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
8f5fe903d6 offmap: remove GIT__USE_OFFMAP macro 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
cf6124d68b offmap: convert to use functions instead of macros 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
0d71690549 oidmap: remove GIT__USE_OIDMAP macro 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
659f5d07d5 oidmap: convert macros to functions 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
13c3bc9adf strmap: remove GIT__USE_STRMAP macro 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
a13cfd2af2 strmap: convert macros to functions 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
f14f75d4a1 khash: avoid using kh_resize directly 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
73028af85c khash: avoid using macro magic to get return address 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
85d2748c6f khash: avoid using kh_key/kh_val as lvalue 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
f31cb45ad2 khash: avoid using kh_put directly 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
a8cd560b10 khash: avoid using kh_del directly 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
71a54317ef khash: avoid using kh_key directly 2017-02-17 11:41:06 +01:00
Patrick Steinhardt
cb18386f72 khash: avoid using kh_val/kh_value directly 2017-02-17 11:41:06 +01:00