Log

Author Commit Date CI Message
Patrick Steinhardt 0b5540b9 2019-11-28T13:56:54 Merge pull request #5307 from palmin/hash_sha256 ssh: include sha256 host key hash when supported
Patrick Steinhardt dfea0713 2019-11-28T13:51:40 Merge pull request #5272 from tiennou/examples/cli-ification Various examples shape-ups
Patrick Steinhardt b63ad958 2019-11-28T13:19:50 Merge pull request #5309 from libgit2/ethomson/trace Improve trace support in tests
Patrick Steinhardt 0e5243b7 2019-11-28T12:42:36 Merge pull request #5123 from libgit2/ethomson/off_t Move `git_off_t` to `git_object_size_t`
Edward Thomson 7198d345 2019-11-28T15:12:05 Merge pull request #5310 from lberk/compat-git-attr-t Add compat typdef for git_attr_t
Lukas Berk 5ace4ccf 2019-11-27T22:40:17 Move deprecated git_attr_t typedef to previous attribute section
Lukas Berk 3739a15c 2019-11-27T21:31:25 Add attr.h include
Lukas Berk aea049b6 2019-11-27T20:05:32 Add compat typdef for git_attr_t Some libraries haven't updated to git_attr_value_t and break. Adding the comapt typedef as suggested.
Edward Thomson b7f70bc2 2019-11-27T12:36:17 tests: optionally show test execution tracing Only show test trace execution when the CLAR_TRACE_TESTS environment variable is set. This reduces the noise during tracing.
Edward Thomson 85efe896 2019-11-27T12:34:10 tests: display trace level with prefix in tests
Edward Thomson 625a3a49 2019-11-27T12:29:34 trace: enable tracing by default Tracing is meant to be extremely low-impact when not enabled. We currently ship no tracing calls in libgit2, but if / when we do, the tracing infrastructure is created to skip tracing as quickly as possible. It should compile to a simple test when tracing is off. Thus, there's on reason to not enable it by default.
Edward Thomson 7805122b 2019-11-27T14:22:27 Merge pull request #5308 from libgit2/ethomson/cifix CI Build Updates
Edward Thomson 6460e8ab 2019-06-23T18:13:29 internal: use off64_t instead of git_off_t Prefer `off64_t` internally.
Edward Thomson 05237ee5 2019-06-23T17:20:17 integer: use int64_t's for checks Use int64_t internally for type visibility.
Edward Thomson ee0c8618 2019-06-23T17:19:31 offmap: store off64_t's instead of git_off_t's Prefer `off64_t` to `git_off_t` internally for visibility.
Edward Thomson 8be12026 2019-06-23T17:09:22 mmap: use a 64-bit signed type `off64_t` for mmap Prefer `off64_t` to `git_off_t` for internal visibility.
Edward Thomson 7e1cc296 2019-11-25T13:17:42 mmap: remove unnecessary assertion 64 bit types are always 64 bit.
Edward Thomson c863b3c8 2019-11-24T16:49:23 ci: enable the VALGRIND flag on builds
Edward Thomson cb77423f 2019-11-24T16:22:31 valgrind: add valgrind hints in OpenSSL Provide usage hints to valgrind. We trust the data coming back from OpenSSL to have been properly initialized. (And if it has not, it's an OpenSSL bug, not a libgit2 bug.) We previously took the `VALGRIND` option to CMake as a hint to disable mmap. Remove that; it's broken. Now use it to pass on the `VALGRIND` definition so that sources can provide valgrind hints.
Edward Thomson 2ad3eb3e 2019-11-24T15:59:26 valgrind: add suppressions for undefined use valgrind will warn that OpenSSL will use undefined data in connect/read when talking to certain other TLS stacks. Thankfully, this only seems to occur when gcc is the compiler, so hopefully valgrind is just misunderstanding an optimization. Regardless, suppress this warning.
Edward Thomson 0005c77a 2019-11-24T15:49:49 test: add an azure repos test We currently talk to Azure Repos for executing an online test (online::clone::path_whitespace). Add a simpler test to talk to Azure Repos to make it obvious that strange test failures are not likely the whitespace in the path, but actually a function of talking to Azure Repos itself.
Edward Thomson b8e00b98 2019-11-23T21:17:15 ci: cache docker layers Our docker builds are getting expensive, let's cache some of this.
Edward Thomson 6df3ec4a 2019-11-23T21:14:32 valgrind: suppress libssh2_rsa_sha1_sign leaks
Edward Thomson c64b7aaa 2019-11-23T20:38:30 ci: build our own valgrind The valgrind in the PPA is broken and ignores `--exit-errorcode`. Build and install our own.
Edward Thomson 7adc32d5 2019-11-23T13:02:29 valgrind: suppress kexinit leaks
Edward Thomson fd831275 2019-11-23T12:40:46 ci: build shared libssh2
Edward Thomson 84807884 2019-11-23T12:40:02 ci: break dockerfile into stages Use a multi-stage docker build so that we can cache early stages and not need to download the apt-provided dependencies during every build (when only later stages change).
Edward Thomson 7a3d04dc 2019-11-23T12:14:23 ci: don't delete the apt cache Deleting the apt cache can be helpful for reducing the size of a container, but since we don't push it anywhere, it only hinders our ability to debug problems while working on the container. Keep it.
Edward Thomson f592c737 2019-11-23T11:55:50 ci: don't install libssh2 since we build it
Edward Thomson 5dc1be8d 2019-11-23T11:25:56 valgrind: suppress uninitialized reads in libcrypto libcrypto will read uninitialized memory as entropy. Suppress warnings from this behavior.
Edward Thomson 767990e9 2019-11-23T11:25:38 ci: show distribution information The lsb-release command is missing on our images; just show the information from the file instead of relying on it.
Edward Thomson 91ba65af 2019-11-23T10:58:38 ci: provide a default for xcode generator Provide a sane default for `CMAKE_GENERATOR` in the build script so that it can be invoked without having to set that in the environment.
Edward Thomson f94c9276 2019-10-27T22:20:38 example: use `git_object_size_t` for object size
Edward Thomson 4dffa295 2019-06-23T18:09:00 blame: use a size_t for the buffer
Edward Thomson 6c13cf6d 2019-11-22T15:18:54 filestamp: use `uint64_t` for object size Instead of using a signed type (`off_t`) use an unsigned `uint64_t` for the size of the files.
Edward Thomson fefefd1d 2019-06-23T16:42:14 odb: use `git_object_size_t` for object size Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
Edward Thomson fb2198db 2019-06-23T16:23:59 futils_filesize: use `uint64_t` for object size Instead of using a signed type (`off_t`) use `uint64_t` for the maximum size of files.
Edward Thomson 4334b177 2019-06-23T15:43:38 blob: use `git_object_size_t` for object size Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
Edward Thomson bed9fc6b 2019-06-23T15:16:47 odb: use `git_object_size_t` for object size Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
Edward Thomson 9b04d0be 2019-11-22T15:04:09 types: introduce `git_object_size_t` Introduce `git_object_size_t`, an unsigned type that we can use for the maximum size of git objects.
Anders Borum 48c3f7e1 2019-11-20T11:21:14 ssh: include sha256 host key hash when supported
Edward Thomson 47dd665a 2019-11-16T15:21:56 Merge pull request #5303 from pks-t/pks/patch-path-in-body-only patch_parse: use paths from "---"/"+++" lines for binary patches
Edward Thomson cb6bc6f2 2019-11-16T15:17:54 Merge pull request #5285 from pcpthm/winhttp-308 Follow 308 redirect in WinHTTP transport
Edward Thomson 541b8fc5 2019-11-16T15:12:52 Merge pull request #5302 from tiennou/fix/p_lstat-errno fileops: correct error return on p_lstat failures when mkdir
Patrick Steinhardt de7659cc 2019-11-10T18:44:56 patch_parse: use paths from "---"/"+++" lines for binary patches For some patches, it is not possible to derive the old and new file paths from the patch header's first line, most importantly when they contain spaces. In such a case, we derive both paths from the "---" and "+++" lines, which allow for non-ambiguous parsing. We fail to use these paths when parsing binary patches without data, though, as we always expect the header paths to be filled in. Fix this by using the "---"/"+++" paths by default and only fall back to header paths if they aren't set. If neither of those paths are set, we just return an error. Add two tests to verify this behaviour, one of which would have previously caused a segfault.
Etienne Samson 0c2b0206 2019-11-09T09:41:13 fileops: correct error return on p_lstat failures when mkdir IIRC I got a strange return once from lstat, which translated in a weird error class/message being reported. As a safety measure, enforce a -1 return in that case.
Edward Thomson 01ea911b 2019-11-06T06:04:55 Merge pull request #5299 from pks-t/pks/config-mem-snapshots config_mem: implement support for snapshots
Edward Thomson a3d8a437 2019-11-06T06:04:37 Merge pull request #5298 from pks-t/pks/patch-whitespace-only-paths patch_parse: fix segfault when header path contains whitespace only
Etienne Samson fe42557a 2019-11-06T11:08:52 examples: buff up rev-list by adding OID support This allows the example to be used as a quick revwalk test harness.
Etienne Samson 313908f9 2019-11-06T11:08:49 examples: normalize decls and usage of options structs
Etienne Samson 4a4ad2bc 2019-11-06T11:08:45 examples: add comments to add.c
Etienne Samson d4a593ef 2019-11-06T11:17:52 examples: modernize add code
Etienne Samson c9a09b91 2019-11-06T11:16:47 examples: extract argument conversion helper
Etienne Samson 204a464f 2019-11-06T11:08:39 examples: fixup for-each-ref style
Etienne Samson c924f36a 2019-11-06T11:08:35 examples: keep track of whether we processed a "--" arg
Etienne Samson 025a9357 2019-11-06T11:08:30 examples: move "args" to its own header
Etienne Samson 745ccc8a 2019-11-06T11:08:26 examples: remove duplicate includes from common.c
Etienne Samson cd5e33fb 2019-11-06T11:08:23 global: DRY includes of assert.h
Etienne Samson 882220bf 2019-11-06T11:08:19 examples: add missing include barriers
Etienne Samson 4867523e 2019-11-06T11:08:15 examples: add *.h files to IDEs
Patrick Steinhardt 146e5bf7 2019-11-06T07:27:35 config_mem: implement support for snapshots Similar as in commit dadbb33b6 (Fix crash if snapshotting a config_snapshot, 2019-11-01), let's implement snapshots for in-memory configuration entries. As this deletes more code than it adds, it doesn't make any sense to not allow for this and allows users to treat config backends mostly the same.
Patrick Steinhardt de543e29 2019-11-05T22:44:27 patch_parse: fix segfault when header path contains whitespace only When parsing header paths from a patch, we reject any patches with empty paths as malformed patches. We perform the check whether a path is empty before sanitizing it, though, which may lead to a path becoming empty after the check, e.g. if we have trimmed whitespace. This may lead to a segfault later when any part of our patching logic actually references such a path, which may then be a `NULL` pointer. Fix the issue by performing the check after sanitizing. Add tests to catch the issue as they would have produced a segfault previosuly.
Patrick Steinhardt 5d773a18 2019-11-05T13:04:10 Merge pull request #5282 from pks-t/pks/config-file-iterator-race config_file: fix race when creating an iterator
Patrick Steinhardt 56b203a5 2019-10-24T12:20:27 config_file: keep reference to config entries when creating iterator When creating a configuration file iterator, then we first refresh the backend and then afterwards duplicate all refreshed configuration entries into the iterator in order to avoid seeing any concurrent modifications of the entries while iterating. The duplication of entries is not guarded, though, as we do not increase the refcount of the entries that we duplicate right now. This opens us up for a race, as another thread may concurrently refresh the repository configuration and thus swap out the current set of entries. As we didn't increase the refcount, this may lead to the entries being free'd while we iterate over them in the first thread. Fix the issue by properly handling the lifecycle of the backend's entries via `config_file_entries_take` and `git_config_entries_free`, respectively.
Patrick Steinhardt 0927156a 2019-10-24T12:32:11 config_file: refactor taking entries ref to return an error code The function to take a reference to the config file's config entries currently returns the reference via return value. Due to this, it's harder than necessary to integrate into our typical coding style, as one needs to make sure that a proper error code is set before erroring out from the caller. This bites us in `config_file_delete`, where we call `goto out` directly when `config_file_entries_take` returns `NULL`, but we actually forget to set up the error code and thus return success. Fix the issue by refactoring the function to return an error code and pass the reference via an out-pointer.
Patrick Steinhardt db301087 2019-10-24T12:17:02 config_file: remove unused includes
Patrick Steinhardt c2749849 2019-10-24T12:00:11 config_file: rename function names As with the predecessing commit, this commit renames backend functions of the configuration file backend. This helps to clearly separate functionality and also to be able to see from backtraces which backend is currently in use.
Patrick Steinhardt b30b04a9 2019-11-05T12:34:14 config_snapshot: rename function names The configuration snapshot backend has been extracted from the old files backend back in 2bff84ba4 (config_file: separate out read-only backend, 2019-07-26). To keep code churn manageable, the local functions weren't renamed yet and thus still have references to the old diskfile backend. Rename them accordingly to make them easier to understand.
Patrick Steinhardt 82d7a114 2019-11-05T11:18:14 Merge pull request #5293 from csware/config_snapshot-snapshot Fix crash if snapshotting a config_snapshot
Patrick Steinhardt 45c8d3f4 2019-11-05T11:13:34 Merge pull request #5295 from romkatv/fix-diff-res fix a bug introduced in 8a23597b
romkatv 1886478d 2019-11-05T07:45:11 fix a bug introduced in 8a23597b
Edward Thomson bf2911d7 2019-11-02T07:30:32 Merge pull request #5275 from pks-t/pks/reflogs-with-newlines reflogs: fix behaviour around reflogs with newlines
Sven Strickroth dadbb33b 2019-11-01T18:55:54 Fix crash if snapshotting a config_snapshot Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson d5017a14 2019-11-01T07:00:16 Merge pull request #5289 from libgit2/cmn/create-with-signature-verification commit: verify objects exist in git_commit_with_signature
Carlos Martín Nieto 718f24ad 2019-10-30T20:39:03 commit: verify objects exist in git_commit_with_signature There can be a significant difference between the system where we created the buffer (if at all) and when the caller provides us with the contents of a commit. Verify that the commit we are being asked to create references objects which do exist in the target repository.
Carlos Martín Nieto 0974e02f 2019-10-30T20:35:48 commit: add failing tests for object checking for git_commit_with_signature There can be a significant difference between the system where we created the buffer (if at all) and when the caller provides us with the contents of a commit. Provide some test cases (we have to adapt the existing ones because they refer to trees and commits which do not exist).
Patrick Steinhardt 2a7d6de3 2019-10-29T07:52:31 Merge pull request #5276 from pks-t/pks/patch-fuzzing-fixes patch_parse: fixes for fuzzing errors
pcpthm 3f998aee 2019-10-26T17:21:29 Follow 308 redirect in WinHTTP transport
Patrick Steinhardt a31f4c4b 2019-10-24T13:16:03 Merge pull request #5227 from ddevault/check apply: add GIT_APPLY_CHECK
Patrick Steinhardt c405f231 2019-10-24T10:26:43 Merge pull request #5264 from henkesn/refs-unlock-on-commit refs: unlock unmodified refs on transaction commit
Drew DeVault 02af1fcb 2019-09-14T14:03:36 apply: add GIT_APPLY_CHECK This adds an option which will check if a diff is applicable without actually applying it; equivalent to git apply --check.
Patrick Steinhardt 37141ff7 2019-10-21T18:56:59 patch_parse: detect overflow when calculating old/new line position When the patch contains lines close to INT_MAX, then it may happen that we end up with an integer overflow when calculating the line of the current diff hunk. Reject such patches as unreasonable to avoid the integer overflow. As the calculation is performed on integers, we introduce two new helpers `git__add_int_overflow` and `git__sub_int_overflow` that perform the integer overflow check in a generic way.
Patrick Steinhardt 468e3ddc 2019-10-19T16:48:11 patch_parse: fix out-of-bounds read with No-NL lines We've got two locations where we copy lines into the patch. The first one is when copying normal " ", "-" or "+" lines, while the second location gets executed when we copy "\ No newline at end of file" lines. While the first one correctly uses `git__strndup` to copy only until the newline, the other one doesn't. Thus, if the line occurs at the end of the patch and if there is no terminating NUL character, then it may result in an out-of-bounds read. Fix the issue by using `git__strndup`, as was already done in the other location. Furthermore, add allocation checks to both locations to detect out-of-memory situations.
Patrick Steinhardt 6c6c15e9 2019-10-19T15:52:35 patch_parse: reject empty path names When parsing patch headers, we currently accept empty path names just fine, e.g. a line "--- \n" would be parsed as the empty filename. This is not a valid patch format and may cause `NULL` pointer accesses at a later place as `git_buf_detach` will return `NULL` in that case. Reject such patches as malformed with a nice error message.
Patrick Steinhardt 223e7e43 2019-10-19T15:42:54 patch_parse: reject patches with multiple old/new paths It's currently possible to have patches with multiple old path name headers. As we didn't check for this case, this resulted in a memory leak when overwriting the old old path with the new old path because we simply discarded the old pointer. Instead of fixing this by free'ing the old pointer, we should reject such patches altogether. It doesn't make any sense for the "---" or "+++" markers to occur multiple times within a patch n the first place. This also implicitly fixes the memory leak.
Patrick Steinhardt b246bed5 2019-10-18T14:59:54 Merge pull request #5269 from durin42/fuzzpatch fuzzers: add a new fuzzer for patch parsing
Patrick Steinhardt 7968e90f 2019-10-18T12:33:07 refdb_fs: properly parse corrupted reflogs In previous versions, libgit2 could be coerced into writing reflog messages with embedded newlines into the reflog by using `git_stash_save` with a message containing newlines. While the root cause is fixed now, it was noticed that upstream git is in fact able to read such corrupted reflog messages just fine. Make the reflog parser more lenient in order to just skip over malformatted reflog lines to bring us in line with git. This requires us to change an existing test that verified that we do indeed _fail_ to parse such logs.
Patrick Steinhardt 8532ed11 2019-10-18T12:14:19 refdb_fs: convert reflog parsing to use parser The refdb_fs code to parse the reflog currently uses a hand-rolled parser. Convert it to use our `git_parse_ctx` structure instead.
Patrick Steinhardt d8233feb 2019-10-18T09:24:14 reflog: allow adding entries with newlines in their message Currently, the reflog disallows any entries that have a message with newlines, as that would effectively break the reflog format, which may contain a single line per entry, only. Upstream git behaves a bit differently, though, especially when considering stashes: instead of rejecting any reflog entry with newlines, git will simply replace newlines with spaces. E.g. executing 'git stash push -m "foo\nbar"' will create a reflog entry with "foo bar" as entry message. This commit adjusts our own logic to stop rejecting commit messages with newlines. Previously, this logic was part of `git_reflog_append`, only. There is a second place though where we add reflog entries, which is the serialization code in the filesystem refdb. As it didn't contain any sanity checks whatsoever, the refdb would have been perfectly happy to write malformatted reflog entries to the disk. This is being fixed with the same logic as for the reflog itself.
Patrick Steinhardt 28481609 2019-10-18T09:41:20 stash: refactor code that prepares commit messages
Patrick Steinhardt ca2d34a8 2019-10-18T09:06:48 stash: modernize code style of `git_stash_save` The code style of `git_stash_save` doesn't really match our current coding style. Update it to match our current policies more closely.
Augie Fackler 92e011a7 2019-10-15T16:22:35 fuzzers: add a new fuzzer for patch parsing I was looking at this code anyway because the sr.ht people nerdsniped me, and it gave me that "I should fuzz this" feeling. So have a fuzzer!
Patrick Steinhardt c9464bf7 2019-10-17T18:33:12 Merge pull request #5273 from dlax/parse-diff-without-extended-headers patch_parse: handle patches without extended headers
Patrick Steinhardt 4c0dea5a 2019-10-17T14:03:39 Merge pull request #4637 from tiennou/feature/submodule-easy-clone Provide a wrapper for simple submodule clone steps
Patrick Steinhardt 73e9535d 2019-10-17T13:43:26 tests: submodule: test cloning edge cases Add two more tests that verify our behaviour in some edge cases, notably when cloning into a non-empty directory and when cloning the same submodule twice.
Patrick Steinhardt de412fc2 2019-10-17T13:36:22 tests: submodule: make use of sandboxes to clean repos The test submodule::add::submodule_clone doesn't use a sandbox, and thus the created repo will not get deleted after the test has finished. Convert the test to use the empty standard repo sandbox instead to fix this.
Patrick Steinhardt 09b1ac11 2019-10-17T13:32:22 tests: submodule: fix tests for cloning submodules The test submodule::add::homemade_clone unfortunately doesn't test what's expected, but does instead clone the submodule to a directory that is outside of the parent repository. Fixing this by cloning to the correct location isn't possible, though, as `git_submodule_add_setup` will have pre-created a ".git" file already, which will cause `git_clone` to error out. As it's not possible to perform the clone without fiddling around with the repo's layout, let's just remove this test as that is in fact what the new `git_submodule_clone` function is for.
Sebastian Henke 47531f47 2019-10-11T12:44:09 refs: unlock unmodified refs on transaction commit Refs which are locked in a transaction without an altered target, still should to be unlocked on `git_transaction_commit`. `git_transaction_free` also unlocks refs but the moment of calling of `git_transaction_free` cannot be controlled in all situations. Some binding libs call `git_transaction_free` on garbage collection or not at all if the application exits before and don't provide public access to `git_transaction_free`. It is better to release locks as soon as possible.
Etienne Samson 3c5d78bd 2019-05-01T16:16:26 submodule: provide a wrapper for simple submodule clone steps
Patrick Steinhardt 0298e0a6 2019-10-17T12:24:25 Merge pull request #5238 from tiennou/feature/macos-gss macOS GSS Support