|
ef5cfcdb
|
2017-01-14T18:20:59
|
|
win32: use CreateFile in p_open
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
fbc6910f
|
2017-04-01T13:25:14
|
|
win32: teach p_open about do_with_retries
|
|
8a4e1513
|
2017-04-01T00:23:03
|
|
win32: make p_rename use do_with_retries
|
|
a0f67e4a
|
2017-04-01T13:19:51
|
|
win32: teach p_unlink about do_with_retries
|
|
cc8d9a29
|
2017-04-01T10:44:17
|
|
win32: introduce `do_with_retries` macro
Provide a macro that will allow us to run a function with posix-like
return values multiple times in a retry loop, with an optional cleanup
function called between invocations.
|
|
dcaa9099
|
2017-03-29T23:54:47
|
|
win32: map windows error codes to errno
Introduce mapping from windows error codes to errno values. This
allows us to replace our calls to the Windows posix emulation functions
with calls to the Win32 APIs for more fine-grained control over the
emulation.
These mappings match the Windows CRT's mappings for its posix emulation
as they were described to me.
|
|
fcb322f5
|
2017-03-31T23:39:33
|
|
Merge remote-tracking branch 'origin/pr/3790' into win32_posix
|
|
06abbb7f
|
2017-03-27T13:14:48
|
|
treebuilder: exit early if running OOM in `write_with_buffer`
While writing the tree inside of a buffer, we check whether the buffer
runs out of memory after each tree entry. While we set the error code as
soon as we detect the OOM situation, we happily proceed iterating over
the entries. This is not useful at all, as we will try to write into the
buffer repeatedly, which cannot work.
Fix this by exiting as soon as we are OOM.
|
|
8d1e71f5
|
2017-03-27T13:14:05
|
|
treebuilder: remove shadowing variable in `write_with_buffer`
The `git_tree_entry *entry` variable is defined twice inside of this
function. While this is not a problem currently, remove the shadowing
variable to avoid future confusion.
|
|
4f9327fa
|
2017-03-27T13:11:38
|
|
treebuilder: fix memory leaks in `write_with_buffer`
While we detect errors in `git_treebuilder_write_with_buffer`, we just
exit directly instead of freeing allocated memory. Fix this by
remembering error codes and skipping forward to the function's cleanup
code.
|
|
fbdf2a79
|
2017-03-24T09:26:31
|
|
worktree: unconditionally free the worktree's name
|
|
4004d68f
|
2017-03-24T08:36:12
|
|
blame_git: remove spuriuous goto
The recent addition of an error code to `pass_whole_blame` in ff8d2eb15
(blame_git: check return value of object lookup, 2017-03-20) introduced
a spurious goto. Remove it.
|
|
1d39a603
|
2017-03-24T08:26:33
|
|
Merge pull request #4175 from libgit2/ethomson/dont_trunc_and_excl
git_futils: don't O_EXCL and O_TRUNC
|
|
fa86a095
|
2017-03-23T20:45:28
|
|
Merge pull request #4178 from libgit2/ethomson/enfasten_sha1
sha1dc: perf improvements from upstream
|
|
d6729635
|
2017-03-23T17:25:11
|
|
sha1dc: `SHA1DCUpdate` now takes a `size_t`
|
|
69873685
|
2017-03-23T09:49:09
|
|
Merge branch 'pr/3957'
|
|
b53d834f
|
2017-03-23T09:46:22
|
|
merge: indentation fixup
|
|
c9efa995
|
2017-03-23T09:16:24
|
|
sha1dc: perf improvements from upstream
Update SHA-1 collision detection code (cr-marcstevens/sha1collisiondetection)
to master to include performance improvements.
|
|
f623cf89
|
2017-03-22T20:32:55
|
|
Merge pull request #4163 from pks-t/pks/submodules-with-worktrees
Worktree fixes
|
|
6fd6c678
|
2017-03-22T20:29:22
|
|
Merge pull request #4030 from libgit2/ethomson/fsync
fsync all the things
|
|
4a26915d
|
2017-03-22T19:48:50
|
|
git_futils: don't O_EXCL and O_TRUNC
`O_EXCL` and `O_TRUNC` are mutually exclusive flags to open(2); you can't
truncate a file if you're asserting that it can't exist in the first place.
Drop `O_TRUNC`.
|
|
e7330016
|
2017-03-20T12:38:28
|
|
diff_parse: check return value of `git_diff_init_options`
|
|
723bdf48
|
2017-03-20T09:35:23
|
|
patch_parse: check if advancing over header newline succeeds
While parsing patch header lines, we iterate over each line and check if
the line has trailing garbage. What we do not check though is that the
line is actually a line ending with a trailing newline.
Fix this by checking the return code of `parse_advance_expected_str`.
|
|
2cf48e13
|
2017-03-20T09:34:41
|
|
config_file: check if section header buffer runs out of memory
While parsing section headers, we use a buffer to store the actual
section name. We do not check though if the buffer runs out of memory at
any stage. Do so.
|
|
ff8d2eb1
|
2017-03-20T09:34:25
|
|
blame_git: check return value of object lookup
The function `pass_whole_blame` performs an object lookup but does not
check if the lookup actually succeeds. Convert the function to return an
error code and check for it in the calling function.
|
|
8d452448
|
2017-03-20T09:34:59
|
|
odb_pack: initialize `git_rawobj` structure
The `pack_entry_find_prefix` function receives a `git_rawobj` structure
as argument. While the function first initializes the structure to a
sensible state, Coverity is unable to correctly detect this, resulting
in a warning.
Fix this warning by initializing the object to all-zeroes before passing
it to the function.
|
|
dd0b1e8c
|
2017-03-20T09:13:25
|
|
openssl_stream: fix releasing OpenSSL locks
The OpenSSL library may require multiple locks to work correctly, where
it is the caller's responsibility to initialize and release the locks.
While we correctly initialized up to `n` locks, as determined by
`CRYPTO_num_locks`, we were repeatedly freeing the same mutex in our
shutdown procedure.
Fix the issue by freeing locks at the correct index.
|
|
1d50f955
|
2017-03-20T11:29:27
|
|
Merge pull request #4166 from pks-t/pks/map-free-fix
Remove `map_free` macros
|
|
31059923
|
2017-03-20T12:16:18
|
|
Merge pull request #4169 from csware/absolute-symlink
|
|
86a8cd9f
|
2017-03-20T11:21:00
|
|
filebuf: fix resolving absolute symlinks
The symlink destination is always concatenated to the original path. Fix
this by using `git_buf_sets` instead of `git_buf_puts`.
|
|
e30a6ee3
|
2017-03-20T11:06:23
|
|
Merge pull request #4160 from pks-t/pks/diff-fixes
Diff fixes
|
|
44b3b9fe
|
2017-03-20T11:05:03
|
|
Merge pull request #4162 from pks-t/pks/merge-source-fixes
merge_driver: fix const-correctness for source getters
|
|
94af9155
|
2017-03-20T09:01:18
|
|
map: remove `*map_free` macros
The `map_free` functions were not implemented as functions but instead
as macros which also set the map to NULL. While this is most certainly
sensible in most cases, we should prefer the more obvious behavior,
namingly leaving the map pointer intact.
Furthermore, this macro has been refactored incorrectly during the
map-refactorings: the two statements are not actually grouped together
by a `do { ... } while (0)` block, as it is required for macros to
match the behavior of functions more closely. This has led to at least
one subtle nesting error in `pack-objects.c`. The following code block
```
if (pb->object_ix)
git_oidmap_free(pb->object_ix);
```
would be expanded to
```
if (pb->object_ix)
git_oidmap__free(pb->object_ix); pb->object_ix = NULL;
```
which is not what one woudl expect. While it is not a bug here as it
would simply become a no-op, the wrong implementation could lead to bugs
in other occasions.
Fix this by simply removing the macro altogether and replacing it with
real function calls. This leaves the burden of setting the pointer to
NULL afterwards to the caller, but this is actually expected and behaves
like other `free` functions.
|
|
77c8ee74
|
2017-03-20T08:59:30
|
|
checkout: fix double-free of checkout_data's mkdir_map
We currently call `git_strmap_free` on `checkout_data.mkdir_map` in the
`checkout_data_clear` function. The only thing protecting us from a
double-free is that the `git_strmap_free` function is in fact not a
function, but a macro that also sets the map to NULL.
Remove the second call to `git_strmap_free` and explicitly set the map
member to NULL.
|
|
b0c9bc92
|
2017-03-15T13:38:54
|
|
submodule: resolve URLs relative to main worktree
It is possible to specify submodule URLs relative to the repository
location. E.g. having a submodule with URL "../submodule" will look for
the submodule at "repo/../submodule".
With the introduction of worktrees, though, we cannot simply resolve the
URL relative to the repository location itself. If the repository for
which a URL is to be resolved is a working tree, we have to resolve the
URL relative to the parent's repository path. Otherwise, the URL would
change depending on where the working tree is located.
Fix this by special-casing when we have a working tree while getting the
URL base.
|
|
097f0105
|
2017-03-17T08:54:53
|
|
refdb: create references in commondir
References for a repository are usually created inside of its gitdir.
When using worktrees, though, these references are not to be created
inside the worktree gitdir, but instead inside the gitdir of its parent
repository, which is the commondir. Like this, branches will still be
available after the worktree itself has been deleted.
The filesystem refdb currently still creates new references inside of
the gitdir. Fix this and have it create references in commondir.
|
|
8f154be3
|
2017-03-17T08:13:59
|
|
worktree: write resolved paths into link files
The three link files "worktree/.git", ".git/worktrees/<name>/commondir"
and ".git/worktrees/<name>/gitdir" should always contain absolute and
resolved paths. Adjust the logic creating new worktrees to first use
`git_path_prettify_dir` before writing out these files, so that paths
are resolved first.
|
|
7cf7a407
|
2017-03-17T08:06:49
|
|
worktree: rename variable in `git_worktree_add`
|
|
9dcc79bc
|
2017-03-15T16:35:43
|
|
worktree: use fully qualified reference name for created HEAD
When creating a new worktree, we have to set up the initial data
structures. Next to others, this also includes the HEAD pseudo-ref.
We currently set it to the worktree respectively branch name, which is
actually not fully qualified.
Use the fully qualified branch name instead.
|
|
20a368e2
|
2017-03-15T15:29:29
|
|
worktree: parent path should point to the working dir
The working tree's parent path should not point to the parent's gitdir,
but to the parent's working directory. Pointing to the gitdir would not
make any sense, as the parent's working directory is actually equal to
both repository's common directory.
Fix the issue.
|
|
3017ba94
|
2017-03-15T14:24:25
|
|
worktree: implement `git_worktree_open_from_repository`
While we already provide functionality to look up a worktree from a
repository, we cannot do so the other way round. That is given a
repository, we want to look up its worktree if it actually exists.
Getting the worktree of a repository is useful when we want to get
certain meta information like the parent's location, getting the locked
status, etc.
|
|
dfc98706
|
2017-03-15T13:54:14
|
|
worktree: split off function opening working directory
Separate the logic of finding the worktree directory of a repository and
actually opening the working tree's directory. This is a preparatory
step for opening the worktree structure of a repository itself.
|
|
3e9c5d8a
|
2017-03-15T13:42:52
|
|
worktree: have `is_worktree_dir` accept a string instead of buffer
This will be used in later commits, where it becomes cumbersome to
always pass in a buffer.
|
|
6dfb983c
|
2017-03-15T15:03:45
|
|
Merge pull request #4161 from pks-t/pks/submodule-index-fix
submodule: catch when submodule is not staged on update
|
|
bb342159
|
2017-03-15T11:46:15
|
|
merge_driver: fix const-correctness for source getters
|
|
8051b47f
|
2017-03-15T08:20:26
|
|
Merge branch 'gumenikav/merge_driver_source_info'
|
|
0608d5df
|
2017-03-06T12:30:31
|
|
merge_driver: add unresolved getters for git_merge_driver_source
|
|
13bf4d7f
|
2017-03-14T15:04:18
|
|
Merge pull request #4146 from pks-t/pks/winhttp-errors
winhttp: disambiguate error messages when sending requests
|
|
32ecc98e
|
2017-03-14T14:53:32
|
|
submodule: catch when submodule is not staged on update
When calling `git_submodule_update` on a submodule, we have to retrieve
the ID of the submodule entry in the index. If the function is called on
a submodule which is only partly initialized, the submodule entry may
not be added to the index yet. This leads to an assert when trying to
look up the blob later on.
Fix the issue by checking if the index actually holds the submodule's
ID and erroring out if it does not.
|
|
c0eba379
|
2017-03-14T11:01:19
|
|
diff_parse: correctly set options for parsed diffs
The function `diff_parsed_alloc` allocates and initializes a
`git_diff_parsed` structure. This structure also contains diff options.
While we initialize its flags, we fail to do a real initialization of
its values. This bites us when we want to actually use the generated
diff as we do not se the option's version field, which is required to
operate correctly.
Fix the issue by executing `git_diff_init_options` on the embedded
struct.
|
|
ad5a909c
|
2017-03-14T09:39:37
|
|
patch_parse: fix parsing minimal trailing diff line
In a diff, the shortest possible hunk with a modification (that is, no
deletion) results from a file with only one line with a single character
which is removed. Thus the following hunk
@@ -1 +1 @@
-a
+
is the shortest valid hunk modifying a line. The function parsing the
hunk body though assumes that there must always be at least 4 bytes
present to make up a valid hunk, which is obviously wrong in this case.
The absolute minimum number of bytes required for a modification is
actually 2 bytes, that is the "+" and the following newline. Note: if
there is no trailing newline, the assumption will not be offended as the
diff will have a line "\ No trailing newline" at its end.
This patch fixes the issue by lowering the amount of bytes required.
|
|
62a2fc06
|
2017-03-14T13:06:25
|
|
patch_generate: move `git_diff_foreach` to diff.c
Now that the `git_diff_foreach` function does not depend on internals of
the `git_patch_generated` structure anymore, we can easily move it to
the actual diff code.
|
|
ace3508f
|
2017-03-14T10:37:47
|
|
patch_generate: fix `git_diff_foreach` only working with generated diffs
The current logic of `git_diff_foreach` makes the assumption that all
diffs passed in are actually derived from generated diffs. With these
assumptions we try to derive the actual diff by inspecting either the
working directory files or blobs of a repository. This obviously cannot
work for diffs parsed from a file, where we do not necessarily have a
repository at hand.
Since the introduced split of parsed and generated patches, there are
multiple functions which help us to handle patches generically, being
indifferent from where they stem from. Use these functions and remove
the old logic specific to generated patches. This allows re-using the
same code for invoking the callbacks on the deltas.
|
|
41019152
|
2017-03-14T10:01:56
|
|
patch_generate: remove duplicated logic
Under the existing logic, we try to load patch contents differently,
depending on whether the patch files stem from the working directory or
not. But actually, the executed code paths are completely equal to each
other -- so we were always the code despite the condition.
Remove the condition altogether and conflate both code paths.
|
|
53454be8
|
2017-03-11T19:52:05
|
|
Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting
Skip uninteresting commits in revwalk timesort iterator
|
|
0b3623ac
|
2017-03-11T19:09:27
|
|
Merge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash
git_futils_readbuffer: don't compute sha-1
|
|
ffd4df6b
|
2017-03-09T16:32:38
|
|
Merge pull request #4151 from novalis/dturner/rebase-submodule-untracked
rebase: ignore untracked files in submodules
|
|
c11c08a5
|
2017-03-09T14:01:10
|
|
Skip uninteresting commits in revwalk timesort iterator
Fixes #4099
|
|
11c8e756
|
2017-03-09T12:26:23
|
|
git_futils_readbuffer: don't compute sha-1
Don't compute the sha-1 in `git_futils_readbuffer_updated` unless the
checksum was requested. This means that `git_futils_readbuffer` will
not calculate the checksum unnecessarily.
|
|
83580562
|
2017-03-06T13:14:47
|
|
refdb_fs: honor the namespace
|
|
2270ca9f
|
2017-03-03T13:27:47
|
|
rebase: ignore untracked files in submodules
An untracked file in a submodule should not prevent a rebase from
starting. Even if the submodule's SHA is changed, and that file would
conflict with a new tracked file, it's still OK to start the rebase
and discover the conflict later.
Signed-off-by: David Turner <dturner@twosigma.com>
|
|
52d03f37
|
2017-03-03T13:26:29
|
|
git_commit_create: freshen tree objects in commit
Freshen the tree object that a commit points to during commit time.
|
|
2dfd1294
|
2017-02-24T13:34:01
|
|
hash: include sha1collisiondetection
Include the SHA1 collision attack detection library from
https://github.com/cr-marcstevens/sha1collisiondetection
|
|
a371a8ae
|
2017-02-24T13:03:15
|
|
hash: rename implementation selection constants
|
|
1c04a96b
|
2017-02-28T12:29:29
|
|
Honor `core.fsyncObjectFiles`
|
|
b65a5e9b
|
2017-03-01T07:58:40
|
|
winhttp: disambiguate error messages when sending requests
|
|
3ac05d11
|
2017-02-17T16:48:03
|
|
win32: don't fsync parent directories on Windows
Windows doesn't support it.
|
|
2a5ad7d0
|
2017-02-17T16:42:40
|
|
fsync: call it "synchronous" object writing
Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` ->
`GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
|
|
1229e1c4
|
2017-02-17T16:36:53
|
|
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.
|
|
5a747e0c
|
2016-12-27T23:07:07
|
|
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.
|
|
eb56ed81
|
2016-12-15T14:49:43
|
|
refdb_fs: optionally fsync packed refs
|
|
af3dcb0e
|
2016-12-15T10:56:52
|
|
refdb_fs: optionally fsync loose references
|
|
5312621b
|
2016-12-15T10:51:02
|
|
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.
|
|
1c2c0ae2
|
2016-12-14T12:51:40
|
|
packbuilder: honor git_object__synchronized_writing
Honor `git_object__synchronized_writing` when creating a packfile and
corresponding index.
|
|
e6ed0d2f
|
2016-12-13T11:31:38
|
|
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.
|
|
6d3ad7e0
|
2016-12-13T10:58:43
|
|
Add `ENABLE_SYNCHRONIZED_OBJECT_CREATION` option
Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.
|
|
fc27fe21
|
2016-12-13T10:35:05
|
|
odb_loose: actually honor the fsync option
We've had an fsync option for a long time, but it was "ignored".
Stop ignoring it.
|
|
fc77891f
|
2016-12-13T10:07:42
|
|
git_filebuf: optionally fsync when committing
|
|
1255a9ac
|
2017-02-26T13:34:13
|
|
Fix: make reflog include "(merge)" for merge commits
This fixes issue #4094
|
|
7f875fb4
|
2017-02-24T08:51:50
|
|
Merge pull request #4133 from stinb/khash-cleanup-regression
fix regression from #4092
|
|
685f2251
|
2017-02-22T09:29:00
|
|
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.
|
|
c03f00ea
|
2017-02-22T16:30:57
|
|
Merge pull request #4131 from pks-t/pks/attrcache-cleanups
Attrcache cleanups
|
|
aa5ea47f
|
2017-02-22T10:34:19
|
|
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.)
|
|
ce6f61da
|
2017-02-21T15:14:04
|
|
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.
|
|
c1151010
|
2017-02-21T11:52:15
|
|
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.
|
|
b8ab782a
|
2017-02-21T11:43:32
|
|
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.
|
|
b13f0da1
|
2017-02-17T16:32:14
|
|
Merge pull request #4130 from libgit2/ethomson/clar_messages
Improve clar messages
|
|
cc172642
|
2017-02-17T12:10:19
|
|
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__)
```
|
|
8f1ff26b
|
2017-02-02T13:09:32
|
|
idxmap: remove GIT__USE_IDXMAP
|
|
cee9ca66
|
2017-02-02T12:20:17
|
|
idxmap: convert to use functions instead of macros
|
|
8f5fe903
|
2017-02-02T11:58:48
|
|
offmap: remove GIT__USE_OFFMAP macro
|
|
cf6124d6
|
2017-02-02T11:57:31
|
|
offmap: convert to use functions instead of macros
|
|
0d716905
|
2017-01-27T15:23:15
|
|
oidmap: remove GIT__USE_OIDMAP macro
|
|
659f5d07
|
2017-01-27T14:53:23
|
|
oidmap: convert macros to functions
|
|
13c3bc9a
|
2017-01-27T14:32:23
|
|
strmap: remove GIT__USE_STRMAP macro
|
|
a13cfd2a
|
2017-01-27T14:13:49
|
|
strmap: convert macros to functions
|
|
f14f75d4
|
2017-02-02T13:08:52
|
|
khash: avoid using `kh_resize` directly
|
|
73028af8
|
2017-01-27T14:20:24
|
|
khash: avoid using macro magic to get return address
|
|
85d2748c
|
2017-01-27T14:05:10
|
|
khash: avoid using `kh_key`/`kh_val` as lvalue
|
|
f31cb45a
|
2017-01-25T15:31:12
|
|
khash: avoid using `kh_put` directly
|