Log

Author Commit Date CI Message
Patrick Steinhardt 365d2720 2018-10-03T15:39:40 tests: verify parsing logic for smart packets The commits following this commit are about to introduce quite a lot of refactoring and tightening of the smart packet parser. Unfortunately, we do not yet have any tests despite our online tests that verify that our parser does not regress upon changes. This is doubly unfortunate as our online tests aren't executed by default. Add new tests that exercise the smart parsing logic directly by executing `git_pkt_parse_line`.
Edward Thomson 1621a37d 2018-09-29T13:22:59 Merge pull request #4812 from libgit2/ethomson/ci-refactor CI: refactoring
Edward Thomson 429c7f11 2018-09-17T20:12:59 ci: don't stop on failure Don't stop on test failures; run all the tests, even when a test fails.
Edward Thomson 7c9769d9 2018-09-17T19:57:26 ci: append -r flag to clar on windows Similar to the way we parse the ctest output on POSIX systems, do the same on Windows. This allows us to append the `-r` flag to clar after we've identified the command to run.
Carlos Martín Nieto 0530d7d9 2018-09-28T18:04:23 Merge pull request #4767 from pks-t/pks/config-mem In-memory configuration
Patrick Steinhardt d49b1365 2018-08-10T19:01:37 config_entries: internalize structure declarations Access to the config entries is now completely done via the modules function interface and no caller messes with the struct's internals. We can thus completely move the structure declarations into the implementation file so that nobody even has a chance to mess with the members.
Patrick Steinhardt 1aeff5d7 2018-08-10T12:52:18 config: move function normalizing section names into "config.c" The function `git_config_file_normalize_section` is never being used in any file different than "config.c", but it is implemented in "config_file.c". Move it over and make the symbol static.
Patrick Steinhardt a5562692 2018-08-10T12:49:50 config: make names backend-agnostic As a last step to make variables and structures more backend agnostic for our `git_config` structure, rename local variables to not be called `file` anymore.
Patrick Steinhardt 123e5963 2018-08-10T18:59:59 config_entries: abstract away reference counting Instead of directly calling `git_atomic_inc` in users of the config entries store, provide a `git_config_entries_incref` function to further decouple the interfaces. Convert the refcount to a `git_refcount` structure while at it.
Patrick Steinhardt 5a7e0b3c 2018-08-10T18:49:38 config_entries: abstract away iteration over entries The nice thing about our `git_config_iterator` interfaces is that nobody needs to know anything about the implementation details. All that is required is to obtain the iterator via any backend and then use it by executing generic functions. We can thus completely internalize all the implementation details of how to iterate over entries into the config entries store and simply create such an iterator in our config file backend when we want to iterate its entries. This further decouples the config file backend from the config entries store.
Patrick Steinhardt 60ebc137 2018-08-10T14:53:09 config_entries: abstract away retrieval of config entries The code accessing config entries in the `git_config_entries` structure is still much too intimate with implementation details, directly accessing the maps and handling indices. Provide two new functions to get config entries from the internal map structure to decouple the interfaces and use them in the config file code. The function `git_config_entries_get` will simply look up the entry by name and, in the case of a multi-value, return the last occurrence of that entry. The second function, `git_config_entries_get_unique`, will only return an entry if it is unique and not included via another configuration file. This one is required to properly implement write operations for single entries, as we refuse to write to or delete a single entry if it is not clear which one was meant.
Patrick Steinhardt 2be39cef 2018-08-10T19:38:57 config: introduce new read-only in-memory backend Now that we have abstracted away how to store and retrieve config entries, it became trivial to implement a new in-memory backend by making use of this. And thus we do so. This commit implements a new read-only in-memory backend that can parse a chunk of memory into a `git_config_backend` structure.
Patrick Steinhardt fb8a87da 2018-08-10T14:50:15 config_entries: rename functions and structure The previous commit simply moved all code that is required to handle config entries to a new module without yet adjusting any of the function and structure names to help readability. We now rename things accordingly to have a common "git_config_entries" entries instead of the old "diskfile_entries" one.
Patrick Steinhardt 04f57d51 2018-08-10T13:33:02 config_entries: pull out implementation of entry store The configuration entry store that is used for configuration files needs to keep track of all entries in two different structures: - a singly linked list is being used to be able to iterate through configuration files in the order they have been found - a string map is being used to efficiently look up configuration entries by their key This store is thus something that may be used by other, future backends as well to abstract away implementation details and iteration over the entries. Pull out the necessary functions from "config_file.c" and moves them into their own "config_entries.c" module. For now, this is simply moving over code without any renames and/or refactorings to help reviewing.
Patrick Steinhardt b78f4ab0 2018-08-16T12:22:03 config_entries: refactor entries iterator memory ownership Right now, the config file code requires us to pass in its backend to the config entry iterator. This is required with the current code, as the config file backend will first create a read-only snapshot which is then passed to the iterator just for that purpose. So after the iterator is getting free'd, the code needs to make sure that the snapshot gets free'd, as well. By now, though, we can easily refactor the code to be more efficient and remove the reverse dependency from iterator to backend. Instead of creating a read-only snapshot (which also requires us to re-parse the complete configuration file), we can simply duplicate the config entries and pass those to the iterator. Like that, the iterator only needs to make sure to free the duplicated config entries, which is trivial to do and clears up memory ownership by a lot.
Patrick Steinhardt d75bbea1 2018-08-10T14:35:23 config_file: remove unnecessary snapshot indirection The implementation for config file snapshots has an unnecessary redirection from `config_snapshot` to `git_config_file__snapshot`. Inline the call to `git_config_file__snapshot` and remove it.
Patrick Steinhardt b944e137 2018-08-10T13:03:33 config: rename "config_file.h" to "config_backend.h" The header "config_file.h" has a list of inline-functions to access the contents of a config backend without directly messing with the struct's function pointers. While all these functions are called "git_config_file_*", they are in fact completely backend-agnostic and don't care whether it is a file or not. Rename all the function to instead be backend-agnostic versions called "git_config_backend_*" and rename the header to match.
Patrick Steinhardt ba1cd495 2018-09-28T11:10:49 Merge pull request #4784 from tiennou/fix/warnings Some warnings
Patrick Steinhardt 367f6243 2018-09-28T11:04:06 Merge pull request #4803 from tiennou/fix/4802 index: release the snapshot instead of freeing the index
Etienne Samson e0afd1c2 2018-09-26T21:17:39 vector: do not realloc 0-size vectors
Etienne Samson fa48d2ea 2018-09-26T19:15:35 vector: do not malloc 0-length vectors on dup
Etienne Samson be4717d2 2018-09-18T12:12:06 path: fix "comparison always true" warning
Etienne Samson 21496c30 2018-03-30T00:20:23 stransport: fix a warning on iOS "warning: values of type 'OSStatus' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]"
Edward Thomson b3e6ef92 2018-09-24T23:59:12 Merge pull request #4816 from libgit2/ethomson/test_leak online::clone: free url and username before resetting
Edward Thomson e84914fd 2018-09-20T20:11:36 online::clone: free url and username before resetting Before resetting the url and username, ensure that we free them in case they were set by environment variables.
Patrick Steinhardt a54043b7 2018-09-21T15:32:18 Merge pull request #4794 from marcin-krystianc/mkrystianc/prune_perf git_remote_prune to be O(n * logn)
Patrick Steinhardt 83733aeb 2018-08-10T12:43:21 config: rename `file_internal` and its `file` member Same as with the previous commit, the `file_internal` struct is used to keep track of all the backends that are added to a `git_config` struct. Rename it to `backend_internal` and rename its `file` member to `backend` to make the implementation more backend-agnostic.
Patrick Steinhardt 633cf40c 2018-08-10T12:39:17 config: rename `files` vector to `backends` Originally, the `git_config` struct is a collection of all the parsed configuration files from different scopes (system-wide config, user-specific config as well as the repo-specific config files). Historically, we didn't and don't yet have any other configuration backends than the one for files, which is why the field holding the config backends is called `files`. But in fact, nothing dictates that the vector of backends actually holds file backends only, as they are generic and custom backends can be implemented by users. Rename the member to be called `backends` to clarify that there is nothing specific to files here.
Patrick Steinhardt b9affa32 2018-08-10T19:23:00 config_parse: avoid unused static declared values The variables `git_config_escaped` and `git_config_escapes` are both defined as static const character pointers in "config_parse.h". In case where "config_parse.h" is included but those two variables are not being used, the compiler will thus complain about defined but unused variables. Fix this by declaring them as external and moving the actual initialization to the C file. Note that it is not possible to simply make this a #define, as we are indexing into those arrays.
Patrick Steinhardt 0b9c68b1 2018-08-16T14:10:58 submodule: fix submodule names depending on config-owned memory When populating the list of submodule names, we use the submodule configuration entry's name as the key in the map of submodule names. This creates a hidden dependency on the liveliness of the configuration that was used to parse the submodule, which is fragile and unexpected. Fix the issue by duplicating the string before writing it into the submodule name map.
Edward Thomson df33b43d 2018-09-20T08:50:55 Merge pull request #4813 from libgit2/ethomson/ci-rename Rename "VSTS" to "Azure DevOps" and "Azure Pipelines"
Edward Thomson f8274204 2018-09-19T12:31:17 Merge pull request #4810 from libgit2/cmn/format-security cmake: enable -Wformat and -Wformat-security
Edward Thomson e2613039 2018-09-18T13:52:08 README: rename "VSTS" to "Azure DevOps" Visual Studio Team Services is now a family of applications named "Azure DevOps". Update the README to refer to it thusly.
Edward Thomson 464305b7 2018-09-18T13:51:25 README: update the build badge to Azure Pipelines VSTS is now a family of components; "Azure Pipelines" is the build and release pipeline application.
Edward Thomson d7d0139e 2018-09-18T13:35:25 ci: rename vsts to azure-pipelines
Edward Thomson a8301b0c 2018-09-11T15:15:26 ci: add SKIP_*_TESTS for windows builds Introduce SKIP_*_TEST variables for Windows builds to match POSIX builds.
Edward Thomson e181a649 2018-09-18T03:03:03 Merge pull request #4809 from libgit2/cmn/revwalk-sign-regression Fix revwalk limiting regression
Edward Thomson 744d8388 2018-09-18T02:59:45 Merge pull request #4805 from libgit2/signed_char path validation: `char` is not signed by default.
Edward Thomson 2dd88a5f 2018-09-18T02:55:31 Merge pull request #4811 from libgit2/cmn/sorting-modes revwalk: refer the sorting modes more to git's options
Carlos Martín Nieto 330b10ca 2018-09-17T21:53:58 revwalk: refer the sorting modes more to git's options Show more directly what the sorting modes correspond to in git's `rev-list` as that's the reference implementation for what the possible sorting orders are.
Carlos Martín Nieto f2c1153d 2018-09-17T20:38:05 cmake: enable -Wformat and -Wformat-security We do not currently have any warnings in this regard, but it's good practice to have them on in case we introduce something.
Carlos Martín Nieto 12a1790d 2018-09-17T14:49:46 revwalk: only check the first commit in the list for an earlier timestamp This is not a big deal, but it does make us match git more closely by checking only the first. The lists are sorted already, so there should be no functional difference other than removing a possible check from every iteration in the loop.
Carlos Martín Nieto 46f35127 2018-09-17T14:39:58 revwalk: use the max value for a signed integer When porting, we overlooked that the difference between git's and our's time representation and copied their way of getting the max value. Unfortunately git was using unsigned integers, so `~0ll` does correspond to their max value, whereas for us it corresponds to `-1`. This means that we always consider the last date to be smaller than the current commit's and always think commits are interesting. Change the initial value to the macro that gives us the maximum value on each platform so we can accurately consider commits interesting or not.
Edward Thomson 44291868 2018-09-12T10:53:03 path validation: `char` is not signed by default. ARM treats its `char` type as `unsigned type` by default; as a result, testing a `char` value as being `< 0` is always false. This is a warning on ARM, which is promoted to an error given our use of `-Werror`. Per ISO 9899:199, section "6.2.5 Types": > The three types char, signed char, and unsigned char are collectively > called the character types. The implementation shall define char to > have the same range, representation, and behavior as either signed > char or unsigned char. > ... > Irrespective of the choice made, char is a separate type from the other > two and is not compatible with either.
Edward Thomson fff33a1b 2018-09-10T14:59:20 ci: write test result XML Add the clar flags to produce JUnit-style XML output before invocation.
Etienne Samson c70713d6 2018-09-11T15:53:35 index: release the snapshot instead of freeing the index Previously we would assert in index_free because the reader incrementation would not be balanced. Release the snapshot normally, so the variable gets decremented before the index is freed.
Edward Thomson 943181c2 2018-09-10T12:36:51 Revert "clar: introduce CLAR_XML option" This reverts commit a2d73f5643814cddf90d5bf489332e14ada89ab8. Using clar to propagate the XML settings was a mistake.
Edward Thomson 7e353b7a 2018-09-10T12:27:24 ci: only run the exact named test Our CI test system invokes ctest with the name of the given tests it wishes to invoke. ctest (with the `-R` flag) treats this name as a regular expression. Provide anchors in the regular expression to avoid matching additional tests in this search.
Edward Thomson bc34cb63 2018-09-09T16:44:21 Merge pull request #4778 from libgit2/ethomson/clar-xml Clar XML output redux
Edward Thomson d17e67d0 2018-09-08T18:54:21 clar: iterate errors in report_all / report_errors Instead of trying to have a clever iterator pattern that increments the error number, just iterate over errors in the report errors or report all functions as it's easier to reason about in this fashion.
Patrick Steinhardt 55d354d8 2018-09-07T13:20:33 Merge pull request #4785 from tiennou/fix/cleanup-remote remote: store the connection data in a private struct
Etienne Samson 1c176883 2018-09-07T10:36:15 remote: store the connection data in a private struct This makes it easier to pass connection-related options around (proxy & custom headers for now). This fixes a bug in git_push_finish, which didn't reuse the provided proxy if the connection closed between the call to `git_remote_push` and the finish step.
Edward Thomson db17b31b 2018-09-06T19:22:30 Merge pull request #4789 from pks-t/pks/licensing docs: clarify and include licenses of dependencies
Edward Thomson 0bcb1d5f 2018-09-06T19:19:58 Merge pull request #4799 from pks-t/pks/config-multivar-quadratic config_file: fix quadratic behaviour when adding config multivars
Patrick Steinhardt f2694635 2018-09-06T14:17:54 config_file: fix quadratic behaviour when adding config multivars In case where we add multiple configuration entries with the same key to a diskfile backend, we always need to iterate the list of this key to find the last entry due to the list being a singly-linked list. This is obviously quadratic behaviour, and this has sure enough been found by oss-fuzz by generating a configuration file with 50k lines, where most of them have the same key. While the issue will not arise with "sane" configuration files, an adversary may trigger it by providing a crafted ".gitmodules" file, which is delivered as part of the repo and also parsed by the configuration parser. The fix is trivial: store a pointer to the last entry of the list in its head. As there are only two locations now where we append to this data structure, mainting this pointer is trivial, too. We can also optimize retrieval of a single value via `config_get`, where we previously had to chase the `next` pointer to find the last entry that was added. Using our configuration file fozzur with a corpus that has a single file with 50000 "-=" lines previously took around 21s. With this optimization the same file scans in about 0.053s, which is a nearly 400-fold improvement. But in most cases with a "normal" amount of same-named keys it's not going to matter anyway.
Edward Thomson e595eeb5 2018-08-27T01:06:37 ci: use more compatible strftime formats Windows lacks %F and %T formats for strftime. Expand them to the year/month/day and hour/minute/second formats, respectively.
Edward Thomson 6b2d8f09 2018-08-26T18:05:31 ci: use templates for VSTS builds Our build YAML is becoming unweildly and full of copy-pasta. Simplify with templates.
Edward Thomson 306875bc 2018-08-26T17:27:54 ci: explicitly run in the build directory Explicitly run from the build directory, not the source. (I was mistaken about the default working directory for VSTS agents.)
Edward Thomson f3f2c45e 2018-08-26T17:12:17 ci: escape xml output path on Windows CMake treats backslashes as escape characters; use forward slashes for the XML output path.
Edward Thomson bfcbde50 2018-08-26T16:10:34 ci: upload test results
Edward Thomson a84863fc 2018-08-26T16:07:32 ci: write xml during test runs
Edward Thomson b67a93ff 2018-09-04T14:00:49 clar: remove globals; error-check fprintf/fclose Remove the global summary filename and file pointer; pass them in to the summary functions as needed. Error check the results of buffered I/O calls.
Edward Thomson a2d73f56 2018-08-24T11:23:19 clar: introduce CLAR_XML option Introduce a CLAR_XML option, to run the `ctest` commands with the new `-r` flag to clar. Permitted values are `OFF`, `ON` and a directory to write the XML test results to.
Edward Thomson baa5c20d 2018-08-26T15:31:14 clar: accept a value for the summary filename Accept an (optional) value for the summary filename. Continues to default to summary.xml.
Edward Thomson dbebcb04 2018-08-26T15:25:15 clar: don't use a variable named `time`
Etienne Samson 59f1e477 2018-07-27T23:00:09 Barebones JUnit XML output
Etienne Samson 3a9b9631 2018-07-26T23:02:34 Documentation
Etienne Samson bf9fc126 2018-07-26T23:02:20 Isolate test reports This makes it possible to keep track of every test status (even successful ones), and their errors, if any.
Edward Thomson 90753a96 2018-08-26T15:11:21 clar: refactor explicitly run test behavior Previously, supplying `-s` to explicitly enable some test(s) would run the tests immediately from the argument parser. This forces us to set up the entire clar environment (for example: sandboxing) before argument parsing takes place. Refactor the behavior of `-s` to add the explicitly chosen tests to a list that is executed later. This untangles the argument parsing from the setup lifecycle, allowing us to use the arguments to perform the setup.
Patrick Steinhardt 695067f7 2018-09-06T11:54:01 Merge pull request #4792 from nelhage/multiline-leak config: Fix a leak parsing multi-line config entries
Patrick Steinhardt 6f525a19 2018-09-06T11:52:18 Merge pull request #4797 from bisho/patch-2 Prevent heap-buffer-overflow
bisho d22cd1f4 2018-09-05T11:49:13 Prevent heap-buffer-overflow When running repack while doing repo writes, `packfile_load__cb()` can see some temporary files in the directory that are bigger than the usual, and makes `memcmp` overflow on the `p->pack_name` string. ASAN detected this. This just uses `strncmp`, that should not have any performance impact and is safe for comparing strings of different sizes. ``` ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200001a3f3 at pc 0x7f4a9e1976ec bp 0x7ffc1f80e100 sp 0x7ffc1f80d8b0 READ of size 89 at 0x61200001a3f3 thread T0 SCARINESS: 26 (multi-byte-read-heap-buffer-overflow) #0 0x7f4a9e1976eb in __interceptor_memcmp.part.78 (/build/cfgr-admin#link-tree/libtools_build_sanitizers_asan-ubsan-py.so+0xcf6eb) #1 0x7f4a518c5431 in packfile_load__cb /build/libgit2/0.27.0/src/libgit2-0.27.0/src/odb_pack.c:213 #2 0x7f4a518d9582 in git_path_direach /build/libgit2/0.27.0/src/libgit2-0.27.0/src/path.c:1134 #3 0x7f4a518c58ad in pack_backend__refresh /build/libgit2/0.27.0/src/libgit2-0.27.0/src/odb_pack.c:347 #4 0x7f4a518c1b12 in git_odb_refresh /build/libgit2/0.27.0/src/libgit2-0.27.0/src/odb.c:1511 #5 0x7f4a518bff5f in git_odb__freshen /build/libgit2/0.27.0/src/libgit2-0.27.0/src/odb.c:752 #6 0x7f4a518c17d4 in git_odb_stream_finalize_write /build/libgit2/0.27.0/src/libgit2-0.27.0/src/odb.c:1415 #7 0x7f4a51b9d015 in Repository_write /build/pygit2/0.27.0/src/pygit2-0.27.0/src/repository.c:509 ```
Edward Thomson 045cc321 2018-09-03T19:51:33 Merge pull request #4790 from libgit2/ethomson/travis ci: remove travis
Edward Thomson 76cfeb20 2018-09-03T19:27:30 README: remove travis
Patrick Steinhardt bc63e1ef 2018-09-03T10:49:46 config_parse: refactor error handling when parsing multiline variables The current error handling for the multiline variable parser is a bit fragile, as each error condition has its own code to clear memory. Instead, unify error handling as far as possible to avoid this repetitive code. While at it, make use of `GITERR_CHECK_ALLOC` to correctly handle OOM situations and verify that the buffer we print into does not run out of memory either.
Edward Thomson 6d9b1f08 2018-09-02T18:00:05 Merge pull request #4791 from DavidStaheli/users/davidstaheli/vsts-yaml Update VSTS YAML files with the latest syntax
Marcin Krystianc bfec6526 2018-09-02T11:38:43 git_remote_prune to be O(n * logn)
Nelson Elhage 38b85255 2018-09-01T03:50:26 config: Fix a leak parsing multi-line config entries
David Staheli 7238a1e8 2018-08-31T14:11:28 Update .vsts-ci.yml
David Staheli 40c3a974 2018-08-31T14:07:59 Update .vsts-nightly.yml
Edward Thomson 6fc946e8 2018-08-30T21:53:58 ci: remove travis
Patrick Steinhardt 7edc1c87 2018-08-30T12:51:05 Merge pull request #4788 from tiennou/doc-fixes Documentation fixes
Patrick Steinhardt 2054fe50 2018-08-30T12:41:15 Merge pull request #4781 from nelhage/multiline-loop config: convert unbounded recursion into a loop
Patrick Steinhardt db0c6648 2018-08-30T12:22:26 Merge pull request #4773 from RandomSort/giterr Document giterr_last() use only after error. #4772
Patrick Steinhardt 2e0f926e 2018-08-30T12:16:40 docs: clarify and include licenses of dependencies While our contribution guide tries to make clear the licenses that apply to libgit2, it does not make clear that different licenses apply to our bundled dependencies. Make this clear by listing each dependency together with the licenses that they are governed by. Furthermore, bundle the complete license texts next to the code they apply to.
Etienne Samson a4a028be 2018-08-29T22:49:35 diff: documentation mashup
Etienne Samson 9890f059 2018-08-29T22:04:42 push: make the parallelism default follow the docs
Etienne Samson 7765c0a9 2018-08-29T21:56:26 doc: fix comment on GIT_EUSER
Johan Abildskov c0b2e525 2018-08-27T09:23:02 Add two words to clarify
Edward Thomson df2f276e 2018-08-26T13:22:55 Merge pull request #4765 from tiennou/fix/macos-qsort_r util: make the qsort_r check work on macOS
Edward Thomson 2494b117 2018-08-26T12:09:18 Merge pull request #4782 from libgit2/ethomson/fuzzer fuzzer: update for indexer changes
Edward Thomson 6d6bec0c 2018-08-26T11:52:21 fuzzer: update for indexer changes
Edward Thomson 85eb2cb6 2018-08-26T11:33:42 Merge pull request #4727 from libgit2/cmn/null-oid-existing-tree tree: accept null ids in existing trees when updating
Edward Thomson 50186ce8 2018-08-26T11:26:45 Merge pull request #4374 from pks-t/pks/pack-file-verify Pack file verification
Nelson Elhage a03113e8 2018-08-25T17:04:39 config: convert unbounded recursion into a loop
Etienne Samson 1a9cc182 2018-08-17T15:56:30 util: make the qsort_r check work on macOS This performs a compile-check by using CMake support, to differentiate the GNU version from the BSD version of qsort_r. Module taken from 4f252abea5f1d17c60f6ff115c9c44cc0b6f1df6, which I've checked against CMake 2.8.11.
Edward Thomson 8856337b 2018-08-24T10:58:54 Merge pull request #4777 from pks-t/pks/cmake-iconv-via-libc cmake: detect and use libc-provided iconv
Patrick Steinhardt 9a193102 2018-08-24T11:01:39 Merge pull request #4774 from tiennou/fix/clang-analyzer Coverity flavored clang analyzer fixes
Edward Thomson fd7ab1d7 2018-08-24T09:47:09 Merge pull request #4776 from pks-t/pks/test-index-invalid-filemode tests: verify adding index conflicts with invalid filemodes fails
Patrick Steinhardt 503af775 2018-08-24T10:08:09 Merge pull request #4769 from tiennou/fix/worktree-unlock worktree: unlock should return 1 when the worktree isn't locked