Log

Author Commit Date CI Message
Sven Strickroth 18a6d9f3 2019-06-29T16:19:08 attr: Don't fail in attr_setup if there exists a system attributes file Regression introduced in commit 5452e49fce21f726bec19519da7f012e3f19e736 on PR #4967. Signed-off-by: Sven Strickroth <email@cs-ware.de>
Patrick Steinhardt c4c1500a 2019-06-27T14:18:19 Merge pull request #5145 from pks-t/pks/hash-algo-uninit-return hash: fix missing error return on production builds
Patrick Steinhardt 7fd3f32b 2019-06-27T13:54:55 hash: fix missing error return on production builds When no hash algorithm has been initialized in a given hash context, then we will simply `assert` and not return a value at all. This works just fine in debug builds, but on non-debug builds the assert will be converted to a no-op and thus we do not have a proper return value. Fix this by returning an error code in addition to the asserts.
Patrick Steinhardt 73427b94 2019-06-27T13:23:17 Merge pull request #5142 from scottfurry/StaticChkFixExamples Resolve static check warnings in example code
Scott Furry 2ba7dbbe 2019-06-24T14:55:15 Resolve static check warnings in example code Using cppcheck on libgit2 sources indicated two warnings in example code. merge.c was reported as having a memory leak. Fix applied was to `free()` memory pointed to by `parents`. init.c was reported as having a null pointer dereference on variable arg. Function 'usage' was being called with a null variable. Changed supplied parameter to empty string.
Patrick Steinhardt e9102def 2019-06-27T11:38:04 Merge pull request #4438 from pks-t/pks/hash-algorithm Multiple hash algorithms
Patrick Steinhardt b6625a3b 2019-06-27T10:12:16 Merge pull request #5128 from tiennou/fix/docs More documentation
Patrick Steinhardt 3d22394a 2019-06-27T10:11:23 Merge pull request #4967 from tiennou/fix/4671 Incomplete commondir support
Etienne Samson 33448b45 2019-06-19T19:46:12 docs: More of it
Etienne Samson 501c51b2 2019-06-26T14:49:50 repo: commondir resolution can sometimes fallback to the repodir For example, https://git-scm.com/docs/gitrepository-layout says: info Additional information about the repository is recorded in this directory. This directory is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/info" will be used instead. So when looking for `info/attributes`, we need to check the commondir first, or fallback to "our" `info/attributes`.
Etienne Samson 9f723c97 2019-06-26T14:49:37 docs: fixups
Etienne Samson b883d370 2019-06-26T14:49:30 ignore: fix a missing commondir causing failures As with the preceding commit, the ignore code tries to load code from info/exclude, and we fail to ignore a non-existent file here.
Patrick Steinhardt 82c7a9bc 2019-06-26T14:49:24 attr: fix attribute lookup if repo has no common directory If creating a repository without a common directory (e.g. by using `git_repository_new`), then `git_repository_item_path` will return `GIT_ENOTFOUND` for every file that's usually located in this directory. While we do not care for this case when looking up the "info/attributes" file, we fail to properly ignore these errors when setting up or collecting attributes files. Thus, the gitattributes lookup is broken and will only ever return `GIT_ENOTFOUND`. Fix this issue by properly ignoring `GIT_ENOTFOUND` returned by `git_repository_item_path`.
Patrick Steinhardt 5452e49f 2019-06-26T14:49:17 attr: refactor setup to match current coding style The code in the `attr_setup` function is not really matching our current coding style. Besides alignment issues, it's also hard to see what functions calls depend on one another because they're split up over multiple conditional statements. Fix these issues by grouping together dependent function calls and adjusting the alignment.
Edward Thomson c5448501 2019-06-25T12:55:10 Merge pull request #5078 from libgit2/ethomson/warnings Remove warnings
Edward Thomson a064920e 2019-06-24T23:27:47 Merge pull request #5140 from libgit2/ethomson/flaky_ci Re-run flaky tests
Edward Thomson c7b4ce55 2019-06-23T20:22:29 ci: add flaky test re-execution on Windows Our online tests are occasionally flaky since they hit real network endpoints. Re-run them up to 5 times if they fail, to allow us to avoid having to fail the whole build.
Edward Thomson 6d8a34ad 2019-06-23T19:57:05 ci: add flaky test re-execution on Unix Our online tests are occasionally flaky since they hit real network endpoints. Re-run them up to 5 times if they fail, to allow us to avoid having to fail the whole build.
Patrick Steinhardt b7187ed7 2019-02-22T14:38:31 hash: add ability to distinguish algorithms Create an enum that allows us to distinguish between different hashing algorithms. This enum is embedded into each `git_hash_ctx` and will instruct the code to which hashing function the particular request shall be dispatched. As we do not yet have multiple hashing algorithms, we simply initialize the hash algorithm to always be SHA1. At a later point, we will have to extend the `git_hash_init_ctx` function to get as parameter which algorithm shall be used.
Patrick Steinhardt 8832172e 2019-02-22T14:32:40 hash: move SHA1 implementations to its own hashing context Create a separate `git_hash_sha1_ctx` structure that is specific to the SHA1 implementation and move all SHA1 functions over to use that one instead of the generic `git_hash_ctx`. The `git_hash_ctx` for now simply has a union containing this single SHA1 implementation, only, without any mechanism to distinguish between different algortihms.
Patrick Steinhardt d46d3b53 2019-04-05T10:59:46 hash: split into generic and SHA1-specific interface As a preparatory step to allow multiple hashing APIs to exist at the same time, split the hashing functions into one layer for generic hashing and one layer for SHA1-specific hashing. Right now, this is simply an additional indirection layer that doesn't yet serve any purpose. In the future, the generic API will be extended to allow for choosing which hash to use, though, by simply passing an enum to the hash context initialization function. This is necessary as a first step to be ready for Git's move to SHA256.
Patrick Steinhardt fda20622 2019-06-14T14:22:19 hash: move SHA1 implementations into 'sha1/' folder As we will include additional hash algorithms in the future due to upstream git discussing a move away from SHA1, we should accomodate for that and prepare for the move. As a first step, move all SHA1 implementations into a common subdirectory. Also, create a SHA1-specific header file that lives inside the hash folder. This header will contain the SHA1-specific header includes, function declarations and the SHA1 context structure.
Edward Thomson e61b92e0 2019-06-24T15:22:39 clang: disable documentation-deprecated-sync Add the `-Wno-documentation-deprecated-sync` switch when compiling with clang, since our documentation adds `deprecated` markers, but we do not add the deprecation attribute in the code itself. (ie, the code is out of sync with the docs). In fact, we do not _want_ to mark these items as deprecated in the code, at least not yet, as we are not quite ready to bother our end-users with this since they're not going away.
Edward Thomson 9f3441cc 2019-06-15T22:37:11 zlib: remove unused functions
Edward Thomson c512d58f 2019-06-15T22:26:23 win32: cast WinAPI to void * before casting GetProcAddress is prototyped to return a `FARPROC`, which is meant to be a generic function pointer. It's literally `int (FAR WINAPI * FARPROC)()` which gcc complains if you attempt to cast to a `void (*)(GIT_SRWLOCK *)`. Cast to a `void *` before casting to avoid warnings about the arguments.
Edward Thomson 38e6b287 2019-06-15T22:25:10 mingw: use `struct stat`
Edward Thomson 759ec7d4 2019-06-15T22:01:00 win32: cast GetProcAddress to void * before casting GetProcAddress is prototyped to return a `FARPROC`, which is meant to be a generic function pointer. It's literally `int (FAR WINAPI * FARPROC)()` which gcc complains if you attempt to cast to a `void (*)(GIT_SRWLOCK *)`. Cast to a `void *` before casting to avoid warnings about the arguments.
Edward Thomson 3cd123e9 2019-06-15T21:56:53 win32: define DWORD_MAX if it's not defined MinGW does not define DWORD_MAX. Specify it when it's not defined.
Edward Thomson d93b0aa0 2019-06-15T21:47:40 win32: decorate unused parameters
Edward Thomson 54a60ced 2019-06-15T21:45:26 mingw: disable format specification warnings MinGW uses gcc, which expects POSIX formatting for printf, but uses the Windows C library, which uses its own format specifiers. Therefore, it gets confused about format specifiers. Disable warnings for format specifiers.
Edward Thomson e2aba8ba 2019-06-15T20:45:22 wildmatch: explicitly cast to int
Edward Thomson 3dd1942b 2019-06-15T20:43:13 win32: don't re-define RtlCaptureStackBackTrace RtlCaptureStackBackTrace is well-defined in Windows, no need to redefine it.
Edward Thomson cc9e47c9 2019-06-15T18:51:40 win32: support upgrading warnings to errors (/WX) For MSVC, support warnings as errors by providing the /WX compiler flags. (/WX is the moral equivalent of -Werror.) Disable warnings as errors ass part of xdiff, since it contains warnings. But as a component of git itself, we want to avoid skew and keep our implementation as similar as possible to theirs. We'll work with upstream to fix these issues, but in the meantime, simply let those continue to warn.
Edward Thomson f6530438 2019-05-25T16:44:59 win32: stop inlining file_attribute_to_stat Move `git_win32__file_attribute_to_stat` to a regular function instead of an inlined function. This helps avoid header ordering issues and declarations.
Patrick Steinhardt bd48bf3f 2019-06-14T14:21:32 hash: introduce source files to break include circles The hash source files have circular include dependencies right now, which shows by our broken generic hash implementation. The "hash.h" header declares two functions and the `git_hash_ctx` typedef before actually including the hash backend header and can only declare the remaining hash functions after the include due to possibly static function declarations inside of the implementation includes. Let's break this cycle and help maintainability by creating a real implementation file for each of the hash implementations. Instead of relying on the exact include order, we now especially avoid the use of `GIT_INLINE` for function declarations.
Patrick Steinhardt bbf034ab 2019-02-22T13:43:16 hash: move `git_hash_prov` into Win32 backend The structure `git_hash_prov` is only ever used by the Win32 SHA1 backend. As such, it doesn't make much sense to expose it via the generic "hash.h" header, as it is an implementation detail of the Win32 backend only. Move the typedef of `git_hash_prov` into "hash/sha1/win32.h" to fix this.
Edward Thomson b11eb08f 2019-05-21T14:39:55 config parse: safely cast to int
Edward Thomson 6b349ecc 2019-05-21T14:36:57 odb loose: only read at most INT_MAX
Edward Thomson 8c925ef8 2019-05-21T14:30:28 smart protocol: validate progress message length Ensure that the server has not sent us overly-large sideband messages (ensure that they are no more than `INT_MAX` bytes), then cast to `int`.
Edward Thomson 7afe788c 2019-05-21T14:27:46 smart transport: use size_t for sizes
Edward Thomson db7f1d9b 2019-05-21T14:21:58 local transport: cast message size to int explicitly Our progress information messages are short (and bounded by their format string), cast the length to int for callers.
Edward Thomson 8048ba70 2019-05-21T14:18:40 winhttp: safely cast length to DWORD
Edward Thomson db6b8f7d 2019-05-21T14:15:58 strtol: cast error message length to int
Edward Thomson d103f008 2019-05-21T13:44:47 pool: use `size_t` for sizes
Edward Thomson c4a64b1b 2019-05-21T13:27:39 tree-cache: safely cast to uint32_t
Edward Thomson 2375be48 2019-05-21T12:57:28 tree: return `size_t` for treebuilder entrycount We keep the treebuilder entrycount as a `size_t` - return that instead of downcasting to an `unsigned int`. Callers who were storing this value in an `unsigned int` will continue to downcast themselves, so there should be no behavior change for callers.
Edward Thomson ad6f2153 2019-05-21T12:50:46 utf8: use size_t for length of buffer The `git__utf8_charlen` now takes `size_t` as the buffer length, since it contains the full length of the buffer at the current position. It now returns `-1` in all cases where utf8 codepoints are invalid, since callers only care about a valid length of a sequence of codepoints, or if the current position is not valid utf8.
Edward Thomson 5d5b76df 2019-05-21T12:35:19 worktree: use size_t for sizes
Edward Thomson f7597410 2019-05-21T10:57:30 netops: safely cast to int Only read at most INT_MAX from the underlying stream, so that we can accurately return the number of bytes read. Since callers are not guaranteed to get as many bytes as requested (due to availability of input), this is safe and callers should call in a loop until EOF.
Edward Thomson cfd44d6a 2019-05-20T07:57:46 trailer: use size_t for sizes
Edward Thomson fc3a94ba 2019-05-20T07:13:42 repository: use size_t for length
Edward Thomson b4a173b5 2019-05-20T07:12:36 rebase: use size_t for path length
Edward Thomson 991c9454 2019-05-20T07:11:00 pool: cast arithmetic
Edward Thomson aca3f701 2019-05-20T07:09:46 path: safely cast path calculation
Edward Thomson f1d73189 2019-05-20T07:02:50 patch: use size_t for size when parsing
Edward Thomson 9a6992c4 2019-05-20T06:46:10 merge: safely cast size of merged file for index Explicitly truncate the file size to a `uint32_t`.
Edward Thomson b205f538 2019-05-20T06:38:51 iterator: sanity-check path length and safely cast
Edward Thomson 7e49deba 2019-05-20T06:35:11 index: safely cast file size
Edward Thomson d488c02c 2019-05-20T06:31:42 win32: safely cast path sizes for win api
Edward Thomson cadddaed 2019-05-20T06:20:18 w32: safely cast to int during charset conversion
Edward Thomson b292c35f 2019-05-20T06:14:57 http_parser: cast pointer arithmetic safely
Edward Thomson e48dbdf9 2019-05-20T05:51:44 fetchhead: use size_t in tests
Edward Thomson 3edbc441 2019-05-20T05:48:39 object: use literal constant in bigfile test Don't calculate 4 GiB as that will produce a compiler warning on MSVC. Just hardcode it.
Edward Thomson b26e51e0 2019-05-20T05:37:44 worktree: use size_t in tests
Edward Thomson 3a5a07fc 2019-05-20T05:37:16 idxmap: safely cast down to khiter_t
Patrick Steinhardt a080037c 2019-06-24T15:49:31 Merge pull request #5137 from libgit2/ethomson/error_messages errors: use lowercase
Edward Thomson 6ffc49e1 2019-06-23T19:29:55 Merge pull request #5136 from libgit2/ethomson/largefiles_32bit largefile tests: only write 2GB on 32-bit platforms
Edward Thomson 2a4bcf63 2019-06-23T18:24:23 errors: use lowercase Use lowercase for our error messages, per our custom.
Edward Thomson 8eb910b0 2019-06-23T11:26:10 largefile tests: only write 2GB on 32-bit platforms Don't try to feed 4 GB of data to APIs that only take a `size_t` on 32-bit platforms.
Patrick Steinhardt 4df9f3c6 2019-06-21T08:24:47 Merge pull request #5129 from ehuss/patch-1 Fix broken link in README
Eric Huss 84262643 2019-06-20T10:32:09 Fix broken link in README
Patrick Steinhardt 55a1535d 2019-06-20T12:32:31 Merge pull request #5122 from libgit2/ethomson/deprecate_headlist net: remove unused `git_headlist_cb`
Edward Thomson 89f36f1b 2019-06-17T13:07:56 Merge pull request #5124 from pks-t/pks/cmake-ntlm-without-https cmake: default NTLM client to off if no HTTPS support
Patrick Steinhardt 393fb8a1 2019-06-17T12:15:19 cmake: default NTLM client to off if no HTTPS support If building libgit2 with `-DUSE_HTTPS=NO`, then CMake will generate an error complaining that there's no usable HTTPS backend for NTLM. In fact, it doesn't make sense to support NTLM when we don't support HTTPS. So let's should just have NTLM default to OFF when HTTPS is disabled to make life easier and to fix our OSSFuzz builds failing.
Edward Thomson 2c642918 2019-06-16T17:55:40 net: remove unused `git_headlist_cb`
Edward Thomson 37e4c1ba 2019-06-16T14:35:53 Merge pull request #5119 from libgit2/ethomson/attr attr: rename constants and macros for consistency
Edward Thomson 91a300b7 2019-06-16T00:46:30 attr: rename constants and macros for consistency Our enumeration values are not generally suffixed with `T`. Further, our enumeration names are generally more descriptive.
Patrick Steinhardt c3bbbcf5 2019-06-16T12:30:56 Merge pull request #5117 from libgit2/ethomson/to_from Change API instances of `fromnoun` to `from_noun` (with an underscore)
Patrick Steinhardt 2bdb617a 2019-06-16T11:10:58 Merge pull request #5118 from libgit2/ethomson/object_size object: rename git_object__size to git_object_size
Edward Thomson e45350fe 2019-06-16T00:10:02 tag: add underscore to `from` function The majority of functions are named `from_something` (with an underscore) instead of `fromsomething`. Update the tag function for consistency with the rest of the library.
Edward Thomson 6574cd00 2019-06-08T19:25:36 index: rename `frombuffer` to `from_buffer` The majority of functions are named `from_something` (with an underscore) instead of `fromsomething`. Update the index functions for consistency with the rest of the library.
Edward Thomson b7791d04 2019-06-16T00:23:01 object: rename git_object__size to git_object_size We don't use double-underscores in the public API.
Edward Thomson 08f39208 2019-06-08T17:46:04 blob: add underscore to `from` functions The majority of functions are named `from_something` (with an underscore) instead of `fromsomething`. Update the blob functions for consistency with the rest of the library.
Edward Thomson 5d92e547 2019-06-08T17:28:35 oid: `is_zero` instead of `iszero` The only function that is named `issomething` (without underscore) was `git_oid_iszero`. Rename it to `git_oid_is_zero` for consistency with the rest of the library.
Edward Thomson fef847ae 2019-06-15T15:47:41 Merge pull request #5110 from pks-t/pks/wildmatch Replace fnmatch with wildmatch
Edward Thomson 2b6594de 2019-06-15T15:43:49 Merge pull request #5111 from tiennou/fix/docs Documentation fixes
Etienne Samson 764196ff 2019-06-13T20:17:01 doc: add missing documentation comments
Etienne Samson 2376fa6c 2019-06-13T19:42:55 indexer: correct missing includes Docurium seems to choke on this header because it can't see both git_indexer_progress & git_indexer_progress_cb, let's add the include.
Patrick Steinhardt 13ded47c 2019-06-13T19:57:17 fnmatch: remove unused code The `fnmatch` code has now been completely replaced by `wildmatch`, same as upstream git.git has been doing in 2014. Remove it.
Patrick Steinhardt 05f9986a 2019-06-14T08:06:05 attr_file: convert to use `wildmatch` Upstream git has converted to use `wildmatch` instead of `fnmatch`. Convert our gitattributes logic to use `wildmatch` as the last user of `fnmatch`. Please, don't expect I know what I'm doing here: the fnmatch parser is one of the most fun things to play around with as it has a sh*tload of weird cases. In all honesty, I'm simply relying on our tests that are by now rather comprehensive in that area. The conversion actually fixes compatibility with how git.git parser "**" patterns when the given path does not contain any directory separators. Previously, a pattern "**.foo" erroneously wouldn't match a file "x.foo", while git.git would match. Remove the new-unused LEADINGDIR/NOLEADINGDIR flags for `git_attr_fnmatch`.
Patrick Steinhardt 5811e3ba 2019-06-13T19:16:32 config_file: use `wildmatch` to evaluate conditionals We currently use `p_fnmatch` to compute whether a given "gitdir:" or "gitdir/i:" conditional matches the current configuration file path. As git.git has moved to use `wildmatch` instead of `p_fnmatch` throughout its complete codebase, we evaluate conditionals inconsistently with git.git in some special cases. Convert `p_fnmatch` to use `wildmatch`. The `FNM_LEADINGDIR` flag cannot be translated to `wildmatch`, but in fact git.git doesn't use it here either. And in fact, dropping it while we go increases compatibility with git.git.
Patrick Steinhardt cf1a114b 2019-06-13T19:10:22 config_file: do not include trailing '/' for "gitdir" conditionals When evaluating "gitdir:" and "gitdir/i:" conditionals, we currently compare the given pattern with the value of `git_repository_path`. Thing is though that `git_repository_path` returns the gitdir path with trailing '/', while we actually need to match against the gitdir without it. Fix this issue by stripping the trailing '/' previous to matching. Add various tests to ensure we get this right.
Patrick Steinhardt 5d987f7d 2019-06-13T19:00:06 config_file: refactor `do_match_gitdir` to improve readability The function `do_match_gitdir` has some horribly named parameters and variables. Rename them to improve readability. Furthermore, fix a potentially undetected out-of-memory condition when appending "**" to the pattern.
Patrick Steinhardt de70bb46 2019-06-13T15:27:22 global: convert trivial `fnmatch` users to use `wildcard` Upstream git.git has converted its codebase to use wildcard in favor of fnmatch in commit 70a8fc999d (stop using fnmatch (either native or compat), 2014-02-15). To keep our own regex-matching in line with what git does, convert all trivial instances of `fnmatch` usage to use `wildcard`, instead. Trivial usage is defined to be use of `fnmatch` with either no flags or flags that have a 1:1 equivalent in wildmatch (PATHNAME, IGNORECASE).
Patrick Steinhardt 451df793 2019-06-13T15:20:23 posix: remove implicit include of "fnmatch.h" We're about to phase out our bundled fnmatch implementation as git.git has moved to wildmatch long ago in 2014. To make it easier to spot which files are stilll using fnmatch, remove the implicit "fnmatch.h" include in "posix.h" and instead include it explicitly.
Patrick Steinhardt a9f57629 2019-06-13T15:03:00 wildmatch: import wildmatch from git.git In commit 70a8fc999d (stop using fnmatch (either native or compat), 2014-02-15), upstream git has switched over all code from their internal fnmatch copy to its new wildmatch code. We haven't followed suit, and thus have developed some incompatibilities in how we match regular expressions. Import git's wildmatch from v2.22.0 and add a test suite based on their t3070-wildmatch.sh tests.
Edward Thomson f0a720d5 2019-06-14T18:22:39 Merge pull request #5114 from pks-t/pks/bigfile-refactoring Removal of `p_fallocate`
Patrick Steinhardt 2d85c7e8 2019-06-14T14:12:19 posix: remove `p_fallocate` abstraction By now, we have repeatedly failed to provide a nice cross-platform implementation of `p_fallocate`. Recent tries to do that escalated quite fast to a set of different CMake checks, implementations, fallbacks, etc., which started to look real awkward to maintain. In fact, `p_fallocate` had only been introduced in commit 4e3949b73 (tests: test that largefiles can be read through the tree API, 2019-01-30) to support a test with large files, but given the maintenance costs it just seems not to be worht it. As we have removed the sole user of `p_fallocate` in the previous commit, let's drop it altogether.
Patrick Steinhardt 0c2d0d4b 2019-06-14T14:07:26 tests: object: refactor largefile test to not use `p_fallocate` The `p_fallocate` platform is currently in use in our tests, only, but it proved to be quite burdensome to get it implemented in a cross-platform way. The only "real" user is the test object::tree::read::largefile, where it's used to allocate a large file in the filesystem only to commit it to the repo and read its object back again. We can simplify this quite a bit by just using an in-memory buffer of 4GB. Sure, this cannot be used on platforms with low resources. But creating 4GB files is not any better, and we already skip the test if the environment variable "GITTEST_INVASIVE_FS_SIZE" is not set. So we're arguably not worse off than before.
Patrick Steinhardt c3179eff 2019-06-14T13:34:13 Merge pull request #5055 from tiennou/cmake/backend-detect Modularize our TLS & hash detection