]> git.proxmox.com Git - libgit2.git/log
libgit2.git
7 years agotreebuilder: exit early if running OOM in `write_with_buffer`
Patrick Steinhardt [Mon, 27 Mar 2017 11:14:48 +0000 (13:14 +0200)]
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.

7 years agotreebuilder: remove shadowing variable in `write_with_buffer`
Patrick Steinhardt [Mon, 27 Mar 2017 11:14:05 +0000 (13:14 +0200)]
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.

7 years agotreebuilder: fix memory leaks in `write_with_buffer`
Patrick Steinhardt [Mon, 27 Mar 2017 11:11:38 +0000 (13:11 +0200)]
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.

7 years agoMerge pull request #4180 from pks-t/pks/pass-blame-fix
Patrick Steinhardt [Tue, 28 Mar 2017 06:38:24 +0000 (08:38 +0200)]
Merge pull request #4180 from pks-t/pks/pass-blame-fix

Fix memory leaks

7 years agoworktree: unconditionally free the worktree's name
Patrick Steinhardt [Fri, 24 Mar 2017 08:26:31 +0000 (09:26 +0100)]
worktree: unconditionally free the worktree's name

7 years agoblame_git: remove spuriuous goto
Patrick Steinhardt [Fri, 24 Mar 2017 07:36:12 +0000 (08:36 +0100)]
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.

7 years agoMerge pull request #4175 from libgit2/ethomson/dont_trunc_and_excl
Patrick Steinhardt [Fri, 24 Mar 2017 07:26:33 +0000 (08:26 +0100)]
Merge pull request #4175 from libgit2/ethomson/dont_trunc_and_excl

git_futils: don't O_EXCL and O_TRUNC

7 years agoMerge pull request #4178 from libgit2/ethomson/enfasten_sha1
Carlos Martín Nieto [Thu, 23 Mar 2017 19:45:28 +0000 (20:45 +0100)]
Merge pull request #4178 from libgit2/ethomson/enfasten_sha1

sha1dc: perf improvements from upstream

7 years agosha1dc: `SHA1DCUpdate` now takes a `size_t`
Edward Thomson [Thu, 23 Mar 2017 17:25:11 +0000 (17:25 +0000)]
sha1dc: `SHA1DCUpdate` now takes a `size_t`

7 years agoMerge branch 'pr/3957'
Edward Thomson [Thu, 23 Mar 2017 09:49:09 +0000 (09:49 +0000)]
Merge branch 'pr/3957'

7 years agomerge: indentation fixup
Edward Thomson [Thu, 23 Mar 2017 09:46:22 +0000 (09:46 +0000)]
merge: indentation fixup

7 years agoMerge pull request #4176 from libgit2/ethomson/3872
Edward Thomson [Thu, 23 Mar 2017 09:33:09 +0000 (09:33 +0000)]
Merge pull request #4176 from libgit2/ethomson/3872

inet_pton: don't assume addr families don't exist

7 years agosha1dc: perf improvements from upstream
Edward Thomson [Thu, 23 Mar 2017 09:16:24 +0000 (09:16 +0000)]
sha1dc: perf improvements from upstream

Update SHA-1 collision detection code (cr-marcstevens/sha1collisiondetection)
to master to include performance improvements.

7 years agoMerge pull request #4163 from pks-t/pks/submodules-with-worktrees
Edward Thomson [Wed, 22 Mar 2017 20:32:55 +0000 (20:32 +0000)]
Merge pull request #4163 from pks-t/pks/submodules-with-worktrees

Worktree fixes

7 years agoMerge pull request #4030 from libgit2/ethomson/fsync
Edward Thomson [Wed, 22 Mar 2017 20:29:22 +0000 (20:29 +0000)]
Merge pull request #4030 from libgit2/ethomson/fsync

fsync all the things

7 years agoMerge pull request #4167 from pks-t/pks/ci-fixes
Edward Thomson [Wed, 22 Mar 2017 20:26:52 +0000 (20:26 +0000)]
Merge pull request #4167 from pks-t/pks/ci-fixes

Coverity fixes

7 years agoMerge pull request #4172 from rcjsuen/patch-1
Edward Thomson [Wed, 22 Mar 2017 20:22:45 +0000 (20:22 +0000)]
Merge pull request #4172 from rcjsuen/patch-1

Fix the documentation for git_cred_acquire_cb

7 years agoinet_pton: don't assume addr families don't exist
Edward Thomson [Wed, 22 Mar 2017 19:52:38 +0000 (19:52 +0000)]
inet_pton: don't assume addr families don't exist

Address family 5 might exist on some crazy system like Haiku.
Use `INT_MAX-1` as an unsupported address family.

7 years agogit_futils: don't O_EXCL and O_TRUNC
Edward Thomson [Wed, 22 Mar 2017 19:48:50 +0000 (19:48 +0000)]
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`.

7 years agoUse proper documentation tags
Remy Suen [Tue, 21 Mar 2017 21:08:24 +0000 (06:08 +0900)]
Use proper documentation tags

git_cred_acquire_cb isn't using the standard @param and @return tags.
This is causing the generated documentation to not be formatted
properly.

7 years agodiff_parse: check return value of `git_diff_init_options`
Patrick Steinhardt [Mon, 20 Mar 2017 11:38:28 +0000 (12:38 +0100)]
diff_parse: check return value of `git_diff_init_options`

7 years agopatch_parse: check if advancing over header newline succeeds
Patrick Steinhardt [Mon, 20 Mar 2017 08:35:23 +0000 (09:35 +0100)]
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`.

7 years agoodb_pack: initialize `git_rawobj` structure
Patrick Steinhardt [Mon, 20 Mar 2017 08:34:59 +0000 (09:34 +0100)]
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.

7 years agoconfig_file: check if section header buffer runs out of memory
Patrick Steinhardt [Mon, 20 Mar 2017 08:34:41 +0000 (09:34 +0100)]
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.

7 years agoblame_git: check return value of object lookup
Patrick Steinhardt [Mon, 20 Mar 2017 08:34:25 +0000 (09:34 +0100)]
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.

7 years agoMerge pull request #4139 from richardipsum/readme-running-tests
Edward Thomson [Tue, 21 Mar 2017 13:41:24 +0000 (13:41 +0000)]
Merge pull request #4139 from richardipsum/readme-running-tests

README: Mention how to run tests

7 years agoMerge pull request #4171 from rcjsuen/patch-1
Patrick Steinhardt [Mon, 20 Mar 2017 13:32:57 +0000 (14:32 +0100)]
Merge pull request #4171 from rcjsuen/patch-1

Fix typo in remote.h API

7 years agoFix typo in remote.h API
Remy Suen [Mon, 20 Mar 2017 13:30:37 +0000 (22:30 +0900)]
Fix typo in remote.h API

7 years agoopenssl_stream: fix releasing OpenSSL locks
Patrick Steinhardt [Mon, 20 Mar 2017 08:13:25 +0000 (09:13 +0100)]
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.

7 years agoMerge pull request #4166 from pks-t/pks/map-free-fix
Edward Thomson [Mon, 20 Mar 2017 11:29:27 +0000 (11:29 +0000)]
Merge pull request #4166 from pks-t/pks/map-free-fix

Remove `map_free` macros

7 years agoMerge pull request #4169 from csware/absolute-symlink
Patrick Steinhardt [Mon, 20 Mar 2017 11:16:18 +0000 (12:16 +0100)]
Merge pull request #4169 from csware/absolute-symlink

7 years agotests: filebuf: test writing to symlink with absolute paths
Patrick Steinhardt [Mon, 20 Mar 2017 11:11:05 +0000 (12:11 +0100)]
tests: filebuf: test writing to symlink with absolute paths

7 years agofilebuf: fix resolving absolute symlinks
Sven Strickroth2 [Mon, 20 Mar 2017 10:21:00 +0000 (11:21 +0100)]
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`.

7 years agoMerge pull request #4160 from pks-t/pks/diff-fixes
Patrick Steinhardt [Mon, 20 Mar 2017 10:06:23 +0000 (11:06 +0100)]
Merge pull request #4160 from pks-t/pks/diff-fixes

Diff fixes

7 years agoMerge pull request #4162 from pks-t/pks/merge-source-fixes
Patrick Steinhardt [Mon, 20 Mar 2017 10:05:03 +0000 (11:05 +0100)]
Merge pull request #4162 from pks-t/pks/merge-source-fixes

merge_driver: fix const-correctness for source getters

7 years agomap: remove `*map_free` macros
Patrick Steinhardt [Mon, 20 Mar 2017 08:01:18 +0000 (09:01 +0100)]
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.

7 years agocheckout: fix double-free of checkout_data's mkdir_map
Patrick Steinhardt [Mon, 20 Mar 2017 07:59:30 +0000 (08:59 +0100)]
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.

7 years agosubmodule: resolve URLs relative to main worktree
Patrick Steinhardt [Wed, 15 Mar 2017 12:38:54 +0000 (13:38 +0100)]
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.

7 years agorefdb: create references in commondir
Patrick Steinhardt [Fri, 17 Mar 2017 07:54:53 +0000 (08:54 +0100)]
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.

7 years agoworktree: write resolved paths into link files
Patrick Steinhardt [Fri, 17 Mar 2017 07:13:59 +0000 (08:13 +0100)]
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.

7 years agoworktree: rename variable in `git_worktree_add`
Patrick Steinhardt [Fri, 17 Mar 2017 07:06:49 +0000 (08:06 +0100)]
worktree: rename variable in `git_worktree_add`

7 years agoworktree: use fully qualified reference name for created HEAD
Patrick Steinhardt [Wed, 15 Mar 2017 15:35:43 +0000 (16:35 +0100)]
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.

7 years agoworktree: parent path should point to the working dir
Patrick Steinhardt [Wed, 15 Mar 2017 14:29:29 +0000 (15:29 +0100)]
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.

7 years agoworktree: implement `git_worktree_open_from_repository`
Patrick Steinhardt [Wed, 15 Mar 2017 13:24:25 +0000 (14:24 +0100)]
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.

7 years agoworktree: split off function opening working directory
Patrick Steinhardt [Wed, 15 Mar 2017 12:54:14 +0000 (13:54 +0100)]
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.

7 years agoworktree: have `is_worktree_dir` accept a string instead of buffer
Patrick Steinhardt [Wed, 15 Mar 2017 12:42:52 +0000 (13:42 +0100)]
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.

7 years agotests: worktree: use joinpath instead of printf to join paths
Patrick Steinhardt [Wed, 15 Mar 2017 14:04:24 +0000 (15:04 +0100)]
tests: worktree: use joinpath instead of printf to join paths

7 years agoMerge pull request #4161 from pks-t/pks/submodule-index-fix
Edward Thomson [Wed, 15 Mar 2017 15:03:45 +0000 (15:03 +0000)]
Merge pull request #4161 from pks-t/pks/submodule-index-fix

submodule: catch when submodule is not staged on update

7 years agotests: worktree: unify init/cleanup in open tests
Patrick Steinhardt [Wed, 15 Mar 2017 13:23:59 +0000 (14:23 +0100)]
tests: worktree: unify init/cleanup in open tests

7 years agotests: worktree: unify init/cleanup in submodule tests
Patrick Steinhardt [Wed, 15 Mar 2017 11:28:05 +0000 (12:28 +0100)]
tests: worktree: unify init/cleanup in submodule tests

7 years agotests: worktree: move submodule tests into own suite
Patrick Steinhardt [Wed, 15 Mar 2017 11:01:02 +0000 (12:01 +0100)]
tests: worktree: move submodule tests into own suite

7 years agomerge_driver: fix const-correctness for source getters
Patrick Steinhardt [Wed, 15 Mar 2017 10:46:15 +0000 (11:46 +0100)]
merge_driver: fix const-correctness for source getters

7 years agoMerge branch 'gumenikav/merge_driver_source_info'
Patrick Steinhardt [Wed, 15 Mar 2017 07:20:26 +0000 (08:20 +0100)]
Merge branch 'gumenikav/merge_driver_source_info'

7 years agomerge_driver: add unresolved getters for git_merge_driver_source
Gumenik Alexandr [Mon, 6 Mar 2017 09:30:31 +0000 (12:30 +0300)]
merge_driver: add unresolved getters for git_merge_driver_source

7 years agoMerge pull request #4146 from pks-t/pks/winhttp-errors
Patrick Steinhardt [Tue, 14 Mar 2017 14:04:18 +0000 (15:04 +0100)]
Merge pull request #4146 from pks-t/pks/winhttp-errors

winhttp: disambiguate error messages when sending requests

7 years agosubmodule: catch when submodule is not staged on update
Patrick Steinhardt [Tue, 14 Mar 2017 13:53:32 +0000 (14:53 +0100)]
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.

7 years agodiff_parse: correctly set options for parsed diffs
Patrick Steinhardt [Tue, 14 Mar 2017 10:01:19 +0000 (11:01 +0100)]
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.

7 years agopatch_parse: fix parsing minimal trailing diff line
Patrick Steinhardt [Tue, 14 Mar 2017 08:39:37 +0000 (09:39 +0100)]
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.

7 years agopatch_generate: move `git_diff_foreach` to diff.c
Patrick Steinhardt [Tue, 14 Mar 2017 12:06:25 +0000 (13:06 +0100)]
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.

7 years agopatch_generate: fix `git_diff_foreach` only working with generated diffs
Patrick Steinhardt [Tue, 14 Mar 2017 09:37:47 +0000 (10:37 +0100)]
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.

7 years agopatch_generate: remove duplicated logic
Patrick Steinhardt [Tue, 14 Mar 2017 09:01:56 +0000 (10:01 +0100)]
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.

7 years agoMerge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting
Carlos Martín Nieto [Sat, 11 Mar 2017 18:52:05 +0000 (19:52 +0100)]
Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting

Skip uninteresting commits in revwalk timesort iterator

7 years agoMerge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash
Carlos Martín Nieto [Sat, 11 Mar 2017 18:09:27 +0000 (19:09 +0100)]
Merge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash

git_futils_readbuffer: don't compute sha-1

7 years agoMerge pull request #4151 from novalis/dturner/rebase-submodule-untracked
Edward Thomson [Thu, 9 Mar 2017 16:32:38 +0000 (16:32 +0000)]
Merge pull request #4151 from novalis/dturner/rebase-submodule-untracked

rebase: ignore untracked files in submodules

7 years agoSkip uninteresting commits in revwalk timesort iterator
Adam Niedzielski [Thu, 9 Mar 2017 13:01:10 +0000 (14:01 +0100)]
Skip uninteresting commits in revwalk timesort iterator

Fixes #4099

7 years agogit_futils_readbuffer: don't compute sha-1
Edward Thomson [Thu, 9 Mar 2017 12:26:23 +0000 (12:26 +0000)]
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.

7 years agoMerge pull request #4154 from libgit2/ethomson/namespaces
Edward Thomson [Mon, 6 Mar 2017 15:53:57 +0000 (15:53 +0000)]
Merge pull request #4154 from libgit2/ethomson/namespaces

Support namespaced references again

7 years agorefdb_fs: honor the namespace
Edward Thomson [Mon, 6 Mar 2017 13:14:47 +0000 (13:14 +0000)]
refdb_fs: honor the namespace

7 years agorefs::namespace: add namespace tests
Edward Thomson [Mon, 6 Mar 2017 13:13:47 +0000 (13:13 +0000)]
refs::namespace: add namespace tests

These simple tests only ensure that we enforce the existence of a
namespace; these mirror the rugged tests, they are not exhaustive.

7 years agoREADME: Mention how to run tests
Richard Ipsum [Sat, 25 Feb 2017 17:13:15 +0000 (17:13 +0000)]
README: Mention how to run tests

7 years agorebase: ignore untracked files in submodules
David Turner [Fri, 3 Mar 2017 18:27:47 +0000 (13:27 -0500)]
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>
7 years agoMerge pull request #4150 from libgit2/ethomson/freshen_trees
Carlos Martín Nieto [Fri, 3 Mar 2017 15:12:12 +0000 (16:12 +0100)]
Merge pull request #4150 from libgit2/ethomson/freshen_trees

git_commit_create: freshen tree objects in commit

7 years agogit_commit_create: freshen tree objects in commit
Edward Thomson [Fri, 3 Mar 2017 13:26:29 +0000 (13:26 +0000)]
git_commit_create: freshen tree objects in commit

Freshen the tree object that a commit points to during commit time.

7 years agoMerge pull request #4136 from libgit2/ethomson/sha1dc
Carlos Martín Nieto [Fri, 3 Mar 2017 11:36:36 +0000 (12:36 +0100)]
Merge pull request #4136 from libgit2/ethomson/sha1dc

Introduce (optional) SHA1 collision attack detection

7 years agocmake: drop unset `SHA1_TYPE`
Edward Thomson [Thu, 2 Mar 2017 20:56:47 +0000 (20:56 +0000)]
cmake: drop unset `SHA1_TYPE`

We never set `SHA1_TYPE` to `builtin`.  Don't bother testing for it.

7 years agohash: test for sha1 collision attack detection
Edward Thomson [Fri, 24 Feb 2017 14:14:56 +0000 (14:14 +0000)]
hash: test for sha1 collision attack detection

7 years agohash: include sha1collisiondetection
Edward Thomson [Fri, 24 Feb 2017 13:34:01 +0000 (13:34 +0000)]
hash: include sha1collisiondetection

Include the SHA1 collision attack detection library from
https://github.com/cr-marcstevens/sha1collisiondetection

7 years agohash: rename implementation selection constants
Edward Thomson [Fri, 24 Feb 2017 13:03:15 +0000 (13:03 +0000)]
hash: rename implementation selection constants

7 years agoHonor `core.fsyncObjectFiles`
Edward Thomson [Tue, 28 Feb 2017 12:29:29 +0000 (12:29 +0000)]
Honor `core.fsyncObjectFiles`

7 years agoMerge pull request #4148 from pks-t/pks/fix-haiku-builds
Patrick Steinhardt [Wed, 1 Mar 2017 13:51:39 +0000 (14:51 +0100)]
Merge pull request #4148 from pks-t/pks/fix-haiku-builds

cmake: only enable supported compiler warning flags

7 years agocmake: only enable supported compiler warning flags
Patrick Steinhardt [Wed, 1 Mar 2017 12:58:15 +0000 (13:58 +0100)]
cmake: only enable supported compiler warning flags

We currently unconditionally enable the "-Wall" and "-Wextra" flags.
Some platforms rely on compilers which do not support these flags,
though. One of these platforms is Haiku, which does not support
"-Wextra" due to being stuck on GCC version 2.

Fix builds on such platforms by adding these flags only if supported by
the compiler.

7 years agoMerge pull request #4145 from pks-t/pks/refs-create-memleak
Patrick Steinhardt [Wed, 1 Mar 2017 07:45:48 +0000 (08:45 +0100)]
Merge pull request #4145 from pks-t/pks/refs-create-memleak

tests: refs::create: fix memory leak

7 years agowinhttp: disambiguate error messages when sending requests
Patrick Steinhardt [Wed, 1 Mar 2017 06:58:40 +0000 (07:58 +0100)]
winhttp: disambiguate error messages when sending requests

7 years agotests: refs::create: fix memory leak
Patrick Steinhardt [Wed, 1 Mar 2017 06:45:14 +0000 (07:45 +0100)]
tests: refs::create: fix memory leak

7 years agoMerge pull request #4143 from richardipsum/issue-4094
Patrick Steinhardt [Wed, 1 Mar 2017 06:35:44 +0000 (07:35 +0100)]
Merge pull request #4143 from richardipsum/issue-4094

Fix: make reflog include "(merge)" for merge commits

7 years agoAdd test for inclusion of (merge) in reflog
Richard Ipsum [Tue, 28 Feb 2017 22:22:02 +0000 (22:22 +0000)]
Add test for inclusion of (merge) in reflog

This test ensures that the string '(merge)' is included in the reflog
when a merge commit is made.

7 years agowin32: don't fsync parent directories on Windows
Edward Thomson [Fri, 17 Feb 2017 16:48:03 +0000 (16:48 +0000)]
win32: don't fsync parent directories on Windows

Windows doesn't support it.

7 years agofsync: call it "synchronous" object writing
Edward Thomson [Fri, 17 Feb 2017 16:42:40 +0000 (16:42 +0000)]
fsync: call it "synchronous" object writing

Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` ->
`GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.

7 years agofsync parent directories when fsyncing
Edward Thomson [Fri, 17 Feb 2017 16:36:53 +0000 (16:36 +0000)]
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.

7 years agogit_futils_writebuffer: default only when flags==0
Edward Thomson [Tue, 27 Dec 2016 23:07:07 +0000 (23:07 +0000)]
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.

7 years agorefdb_fs: optionally fsync packed refs
Edward Thomson [Thu, 15 Dec 2016 20:49:43 +0000 (14:49 -0600)]
refdb_fs: optionally fsync packed refs

7 years agorefdb_fs: optionally fsync loose references
Edward Thomson [Thu, 15 Dec 2016 16:56:52 +0000 (10:56 -0600)]
refdb_fs: optionally fsync loose references

7 years agogit_futils_writebuffer: optionally fsync
Edward Thomson [Thu, 15 Dec 2016 16:51:02 +0000 (10:51 -0600)]
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.

7 years agopackbuilder: honor git_object__synchronized_writing
Edward Thomson [Wed, 14 Dec 2016 17:51:40 +0000 (12:51 -0500)]
packbuilder: honor git_object__synchronized_writing

Honor `git_object__synchronized_writing` when creating a packfile and
corresponding index.

7 years agoodb_loose: fsync tests
Edward Thomson [Tue, 13 Dec 2016 16:31:38 +0000 (11:31 -0500)]
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.

7 years agoAdd `ENABLE_SYNCHRONIZED_OBJECT_CREATION` option
Edward Thomson [Tue, 13 Dec 2016 15:58:43 +0000 (10:58 -0500)]
Add `ENABLE_SYNCHRONIZED_OBJECT_CREATION` option

Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.

7 years agoodb_loose: actually honor the fsync option
Edward Thomson [Tue, 13 Dec 2016 15:35:05 +0000 (10:35 -0500)]
odb_loose: actually honor the fsync option

We've had an fsync option for a long time, but it was "ignored".
Stop ignoring it.

7 years agogit_filebuf: optionally fsync when committing
Edward Thomson [Tue, 13 Dec 2016 15:07:42 +0000 (10:07 -0500)]
git_filebuf: optionally fsync when committing

7 years agoFix: make reflog include "(merge)" for merge commits
Richard Ipsum [Sun, 26 Feb 2017 13:34:13 +0000 (13:34 +0000)]
Fix: make reflog include "(merge)" for merge commits

This fixes issue #4094

7 years agoMerge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test
Edward Thomson [Sun, 26 Feb 2017 16:12:30 +0000 (16:12 +0000)]
Merge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test

tests: Add create__symbolic_with_arbitrary_content