src


Log

Author Commit Date CI Message
Edward Thomson 4591e76a 2021-12-10T15:19:59 blob: identify binary content Introduce `git_blob_data_is_binary` to examine a blob's data, instead of the blob itself. A replacement for `git_buf_is_binary`.
Edward Thomson fc1a3f45 2021-11-29T13:36:36 object: return GIT_EINVALID on parse errors Return `GIT_EINVALID` on parse errors so that direct callers of parse functions can determine when there was a failure to parse the object. The object parser functions will swallow this error code to prevent it from propagating down the chain to end-users. (`git_merge` should not return `GIT_EINVALID` when a commit it tries to look up is not valid, this would be too vague to be useful.) The only public function that this affects is `git_signature_from_buffer`, which is now documented as returning `GIT_EINVALID` when appropriate.
Edward Thomson 9f03ebd1 2021-11-29T13:44:42 object: introduce a raw content validation function Users may want to validate raw object content; provide them a function to do so.
Edward Thomson 6fdb1b2f 2021-11-30T21:09:57 Merge pull request #6122 from libgit2/ethomson/cleanup Minor code cleanups
Edward Thomson f9c4dc10 2021-11-22T11:23:50 Merge pull request #6106 from ammgws/fixtemplateerr Fix repo init when template dir is non-existent
Edward Thomson 3461aaf7 2021-11-22T10:29:29 repo: minor formatting fix
Edward Thomson 84083dcc 2021-11-19T08:48:08 cmake: use CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR Instead of using the project-specific `libgit2_SOURCE_DIR` and `libgit2_BINARY_DIR` variables, use `CMAKE_SOURCE_DIR` and `CMAKE_BINARY_DIR`.
Edward Thomson adcf638c 2021-11-21T21:34:17 filebuf: use hashes not oids The filebuf functions should use hashes directly, not indirectly using the oid functions.
Edward Thomson fc42c28e 2021-11-19T09:36:03 util: don't include unnecessary system libraries Remove some unnecessary includes from utility code.
Edward Thomson add30a83 2021-11-18T12:36:25 date: rfc2822 formatting uses a `git_buf` instead of a static string
Edward Thomson b2c40314 2021-11-18T12:19:32 date: make it a proper `git_date` utility class Instead of `git__date`, just use `git_date`.
Edward Thomson 6b2ea909 2021-11-16T23:21:29 tag: set validity to 0 by default `git_tag_name_is_valid` needs to set validity to 0 when it short-circuits.
Peter Pettersson 7dcc29fc 2021-10-22T22:51:59 Make enum in src,tests and examples C90 compliant by removing trailing comma.
Edward Thomson 2c154145 2021-11-11T23:09:44 cmake: move sha1 source selection into CMakeLists.txt The select hashes module selects the hash; the CMakeLists.txt selects the files to implement it.
Edward Thomson 395b3dc4 2021-11-11T22:10:51 cmake: refactor global variables Update the global variables `LIBGIT2_OBJECTS` to `LIBGIT2_DEPENDENCY_OBJECTS` for clarity and consistency.
Edward Thomson b608af6c 2021-11-14T07:23:01 Merge pull request #6116 from lhchavez/drop-volatile-qualifier-in-atomic-exchange
lhchavez 5675312e 2021-11-14T02:27:10 Fix a gcc 11 warning in src/thread.h When building under gcc 11, there is a warning about an incompatible pointer type, since [`__atomic_exchange`](https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html) does not take `volatile` pointers: ``` In file included from ../src/common.h:81, from ../src/transports/winhttp.c:8: ../src/thread-utils.h: In function ‘git___swap’: ../src/thread-utils.h:168:9: warning: argument 3 of ‘__atomic_exchange’ discards ‘volatile’ qualifier [-Wincompatible-pointer-types] 168 | __atomic_exchange(ptr, &newval, &foundval, __ATOMIC_SEQ_CST); | ^~~~~~~~~~~~~~~~~ ``` This change drops the `volatile` qualifier so that the pointer type matches what `__atomic_exchange` expects.
lhchavez 0c4d24da 2021-11-14T02:24:39 Fix a gcc 11 warning in src/threadstate.c When building under gcc 11, there is a warning about a misaligned guard clause because there were mixed spaces and tabs: ``` [128/634] Building C object src/CMakeFiles/git2internal.dir/threadstate.c.o ../src/threadstate.c: In function ‘threadstate_dispose’: ../src/threadstate.c:39:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 39 | if (threadstate->error_t.message != git_str__initstr) | ^~ ../src/threadstate.c:41:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 41 | threadstate->error_t.message = NULL; | ^~~~~~~~~~~ ../src/threadstate.c: At top level: ``` This change indents the code with tabs for consistency with the rest of the code, which makes the warning go away.
Jason Nader 709b1b62 2021-11-05T02:28:37 repository: do not copy templates if dir nonexistent This mimics the behaviour of git which just prints a warning and continues with the repo initialisation.
Edward Thomson 4a6ef5a4 2021-11-11T17:04:24 cmake: move missing-declarations warning to top-level We should enforce declarations throughout the code-base, including examples, fuzzers and tests, not just in the `src` tree.
Edward Thomson 7687948a 2021-11-11T16:13:38 Merge pull request #6112 from libgit2/ethomson/cmake3 cmake refactorings
Edward Thomson 4e84ddd5 2021-11-10T21:59:46 cmake: refactor zlib selection Move zlib selection into its own cmake module.
Edward Thomson 83fa5480 2021-11-10T21:58:12 cmake: refactor WinHTTP selection Move WinHTTP selection into its own cmake module.
Edward Thomson e35a22a0 2021-11-10T21:55:23 cmake: refactor libssh2 selection Move SSH selection into its own cmake module.
Edward Thomson f0cb3788 2021-11-10T21:51:55 cmake: refactor regex selection Move regex selection into its own cmake module.
Edward Thomson de178d36 2021-11-10T21:49:20 cmake: refactor http_parser selection Move http_parser selection into its own cmake module.
Edward Thomson 16b6e3a9 2021-11-10T21:33:28 cmake: HTTP_Parser is now HTTPParser
Edward Thomson 19e99de0 2021-11-10T08:14:11 cmake: qsort detection in features.h
Edward Thomson 789ab915 2021-11-10T21:02:42 cmake: standardize USE_WINHTTP WinHTTP can now be disabled with `USE_WINHTTP=OFF` instead of `WINHTTP=OFF` to better support the other cmake semantics.
Edward Thomson 9324d16e 2021-11-06T16:14:47 cmake: standardize USE_THREADS and USE_NSEC Threading can now be disabled with `USE_THREADS=OFF` instead of `THREADSAFE=OFF` to better support the other cmake semantics. Nanosecond support is the default _if_ we can detect it. This should be our default always - like threads - and people can opt out explicitly.
Edward Thomson 7b527c12 2021-11-06T16:38:11 cmake: move deprecation definition to src/ There's no need to add the deprecation at the top-level. Our tests add deprecation explicitly.
Edward Thomson 08047ca0 2021-11-11T19:56:31 str: git_str_free is never a function
Edward Thomson ceddeed8 2021-11-11T15:20:50 Merge pull request #6104 from libgit2/ethomson/path path: refactor utility path functions
Edward Thomson 1a8b2922 2021-11-09T14:15:32 win32: include correct path header
Edward Thomson 1217c5b2 2021-11-01T21:12:23 fs_path: remove now-unused validation functions
Edward Thomson 62251409 2021-11-01T21:09:17 fs_path: add length with suffix validation
Edward Thomson 91246ee5 2021-11-01T20:14:34 path: use new length validation functions
Edward Thomson 1728e27c 2021-11-01T18:19:56 path: length validation respecting core.longpaths Teach `git_path_is_valid` to respect `core.longpaths`. Add helper methods to validate length and set the error message appropriately.
Edward Thomson 315a43b2 2021-11-01T17:37:06 path: introduce `git_path_str_is_valid` Add a `git_str` based validity check; the existing `git_path_is_valid` defers to it.
Edward Thomson ebacd24c 2021-11-01T13:58:18 fs_path: add long path validation on windows
Edward Thomson dd748dbe 2021-11-01T13:04:40 fs_path: make empty component validation optional
Edward Thomson bef02d3e 2021-11-01T10:57:28 fs_path: introduce `str_is_valid` Provide a mechanism for users to limit the number of characters that are examined; `git_fs_path_str_is_valid` and friends will only examine up to `str->size` bytes. `git_fs_path_is_valid` delegates to these new functions by passing `SIZE_MAX` (instead of doing a `strlen`), which is a sentinel value meaning "look for a NUL terminator".
Edward Thomson 63e36c53 2021-11-01T09:34:32 path: `validate` -> `is_valid` Since we're returning a boolean about validation, the name is more properly "is valid".
Edward Thomson 434a4610 2021-11-01T09:31:32 fs_path: `validate` -> `is_valid` Since we're returning a boolean about validation, the name is more properly "is valid".
Edward Thomson 95117d47 2021-10-31T09:45:46 path: separate git-specific path functions from util Introduce `git_fs_path`, which operates on generic filesystem paths. `git_path` will be kept for only git-specific path functionality (for example, checking for `.git` in a path).
Josh Triplett 81662d43 2021-11-08T14:48:45 Support checking for object existence without refresh Looking up a non-existent object currently always invokes `git_odb_refresh`. If looking up a large batch of objects, many of which may legitimately not exist, this will repeatedly refresh the ODB to no avail. Add a `git_odb_exists_ext` that accepts flags controlling the ODB lookup, and add a flag to suppress the refresh. This allows the user to control if and when they refresh (for instance, refreshing once before starting the batch).
Edward Thomson 52693ab4 2021-09-26T23:11:13 cmake: stylistic refactoring Ensure that we always use lowercase function names, and that we do not have spaces preceding open parentheses, for consistency.
Edward Thomson 8507bf81 2021-09-26T21:54:08 trace: always enabled There's no need to make tracing opt-in; it should always be included.
Edward Thomson f0e693b1 2021-09-07T17:53:49 str: introduce `git_str` for internal, `git_buf` is external libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
Edward Thomson 66ffac25 2021-10-17T09:25:47 Merge pull request #6082 from libgit2/ethomson/oid hash: separate hashes and git_oid
Edward Thomson d174381c 2021-10-13T11:34:56 diff: make the default rename_limit 1000 git's default rename limit is 1000, ours should match.
Edward Thomson 923364c5 2021-09-30T08:40:29 futils: use a particular hash not a git_oid In `git_futils_readbuffer_updated`, always take a particular hash instead of a `git_oid`. This lets us change the checksum algorithm independently of `git_oid` usage.
Edward Thomson 31ecaca2 2021-09-30T08:11:40 hash: hash functions operate on byte arrays not git_oids Separate the concerns of the hash functions from the git_oid functions. The git_oid structure will need to understand either SHA1 or SHA256; the hash functions should only deal with the appropriate one of these.
Edward Thomson 2a713da1 2021-09-29T21:31:17 hash: accept the algorithm in inputs
Edward Thomson 3fff5970 2021-09-29T21:02:38 hash: don't abbreviate algorithm
Edward Thomson 8c29885e 2021-09-27T08:57:03 Merge pull request #6076 from libgit2/ethomson/oidarray_dispose oidarray: introduce `git_oidarray_dispose`
Edward Thomson b6449de3 2021-09-27T08:39:55 Merge pull request #6075 from libgit2/ethomson/attr_longpaths
Edward Thomson 853ba203 2021-09-27T08:39:39 Merge pull request #6073 from libgit2/ethomson/attr_lookups
Edward Thomson 7e7cfe8a 2021-09-26T20:20:03 buf: common_prefix takes a string array `git_strarray` is a public-facing type. Change `git_buf_text_common_prefix` to not use it, and just take an array of strings instead.
Edward Thomson 0bd132ab 2021-09-26T17:58:08 oidarray: introduce `git_oidarray_dispose` Since users are disposing the _contents_ of the oidarray, not freeing the oidarray itself, the proper cleanup function is `git_oidarray_dispose`. Deprecate `git_oidarray_free`.
Edward Thomson 46508fe6 2021-09-26T11:28:47 attr_file: don't take the `repo` as an arg The `repo` argument is now unnecessary. Remove it.
Edward Thomson f5a9f0a2 2021-09-25T15:19:22 attr_file: don't validate workdir paths in attr lookups When looking up attributes for a file, we construct an absolute path to the queried file within the working directory so that we can accept both absolute paths and working directory relative paths. We then trim the leading working directory path to give us an in-repo path. Since we only want the in-repo path to look up attributes - and not to read it from disk - we don't need to validate its length.
Edward Thomson 091bd738 2021-09-24T17:00:43 attr: ensure lookups are on repo-relative paths Attribute lookups are done on paths relative to the repository. Fail if erroneously presented with an absolute path.
Edward Thomson 3d8749d3 2021-09-24T16:07:17 checkout: always provide a path for attribute lookup Always pass a working-directory relative path to attribute lookups during checkout.
Edward Thomson 848bd009 2021-09-24T16:05:23 blob: improve `create_from_disk` attribute lookups Resolve absolute paths to be working directory relative when looking up attributes. Importantly, now we will _never_ pass an absolute path down to attribute lookup functions.
Edward Thomson 0f4256b8 2021-09-24T15:23:34 repository: improve `hashfile` for absolute paths When `git_repository_hashfile` is handed an absolute path, it determines whether the path is within the repository's working directory or not. This is necessary when there is no `as_path` specified. If the path is within the working directory, then the given path should be used for attribute lookups (it is the effective `as_path`). If it is not within the working directory, then it is _not_ eligible. Importantly, now we will _never_ pass an absolute path down to attribute lookup functions.
Edward Thomson d6c7ca3e 2021-09-25T14:36:25 win32: posixify the output of p_getcwd Make p_getcwd match the rest of our win32 path handling semantics. (This is currently only used in tests, which is why this disparity went unnoticed.)
Edward Thomson efa0d64e 2021-09-21T13:19:10 Merge pull request #6067 from libgit2/ethomson/filter_commit_id filter: use a `git_oid` in filter options, not a pointer
Edward Thomson 90656858 2021-09-21T11:28:39 filter: use a `git_oid` in filter options, not a pointer Using a `git_oid *` in filter options was a mistake; it is a deviation from our typical pattern, and callers in some languages that GC may need very special treatment in order to pass both an options structure and a pointer outside of it.
Edward Thomson 62eb2f83 2021-09-21T10:59:49 email: don't clear buffer in append function `git_email__append_from_diff` is meant to - well, append from a diff. Clearing the buffer, by definition, is not appending. Stop doing that.
Edward Thomson ba01547d 2021-09-20T21:45:10 Merge pull request #6061 from libgit2/ethomson/email Introduce `git_email_create`; deprecate `git_diff_format_email`
Edward Thomson 18fc751e 2021-09-20T13:07:37 win32: allow empty environment variables A length of 0 indicates an error and GetLastError() will be set. If GetLastError() is unset then the environment variable has a length of 0.
Edward Thomson 482e3853 2021-09-20T14:06:50 Merge remote-tracking branch 'mathworks/longpath_filter_bug' into main
Edward Thomson 0644c2e8 2021-09-20T08:39:46 Merge pull request #6058 from mathworks/proxy_config_with_detached_remote Allow proxy options when connecting with a detached remote.
Laurence McGlashan 3bd462a1 2021-09-18T21:08:20 Update remote.c Initialise cfg variable.
Laurence McGlashan c8823fb0 2021-09-18T21:00:48 Apply suggestions from code review Co-authored-by: Edward Thomson <ethomson@github.com>
Edward Thomson ba3595af 2021-09-13T16:25:00 diff: deprecate diff_format_email `git_diff_format_email` is deprecated in favor of `git_email_create`.
Edward Thomson 67b1d019 2021-09-14T09:49:31 email: include renames by default `git format-patch` includes diffs with rename detection enabled by default when creating emails. Match this behavior.
Edward Thomson 323f222f 2021-09-14T09:44:52 email: include binary diffs by default `git format-patch` includes binary diffs by default when creating emails. Match this behavior.
Edward Thomson c443495b 2021-09-13T13:29:46 diff: use `git_email_create` in `diff_format_email`
Edward Thomson 971ed753 2021-09-13T13:26:55 email: introduce 'append_from_diff' Introduce `git_email__append_from_diff` so that we don't always overwrite the input buffer.
Edward Thomson f407d3fa 2021-09-13T10:51:42 diff_commit_as_email: use `email_create` Move the `git_diff_commit_as_email` function to use `email_create`.
Edward Thomson 6aa34966 2021-09-13T08:17:21 email: introduce `git_email_create_from_diff` Introduce a function to create an email from a diff and multiple inputs about the source of the diff. Creating an email from a diff requires many more inputs, and should be discouraged in favor of building directly from a commit, and is thus in the `sys` namespace.
Edward Thomson 75d4676a 2021-09-12T17:06:14 email: introduce `git_email_create_from_commit` Create `git_email_*` which will encapsulate email creation and application, and `git_email_create_from_commit` in particular, which creates an email for a single commit.
Laurence McGlashan eb41276f 2021-09-16T11:44:04 Allow proxy options when connecting with a detached remote.
Colin Stolley 479a38bf 2021-09-09T15:21:48 merge: Check file mode when resolving renames. When determining if ours or theirs changed, we check the oids but not their respective file modes. This can lead to merges introducing incorrect file mode changes (eg., in a revert). A simple linear example might be: commit A - introduces file `foo` with chmod 0755 commit B - updates some unrelated file commit C - renames `foo` to `bar` and chmod 0644 If B is reverted, `bar` will unexpectedly acquire mode 0755.
Edward Thomson 7d195b9c 2021-09-14T09:53:15 Merge pull request #6053 from stac47/ssh2_discovery Discover libssh2 without pkg-config
Edward Thomson aa993f76 2021-09-13T11:40:38 buf: introduce `git_buf_truncate_at`
Laurent Stacul 413bfb83 2021-09-14T13:53:29 Update src/CMakeLists.txt Co-authored-by: Edward Thomson <ethomson@github.com>
Edward Thomson 646bae34 2021-09-14T07:47:19 Merge pull request #6041 from Esri/duncan/typeof Use __typeof__ GNUC keyword for ISO C compatibility
Edward Thomson b6735461 2021-09-14T07:46:49 Merge pull request #6039 from lhchavez/avoid-mmap-in-git-indexer-append indexer: Avoid one `mmap(2)`/`munmap(2)` pair per `git_indexer_append` call
Edward Thomson 4f24a932 2021-09-14T07:45:50 Merge pull request #6031 from libgit2/ethomson/extensions Support custom git extensions
Edward Thomson 5bd49aee 2021-09-14T07:44:37 Merge pull request #6045 from punkymaniac/qa-fix-coding-style-pointer Fix coding style for pointer
Edward Thomson 1f6263b8 2021-09-14T07:43:35 Merge pull request #6043 from basile-henry/config-multiline-comment-chars Fix config parsing for multiline with multiple quoted comment chars
Laurence McGlashan 26bf94c0 2021-09-14T12:19:54 If longpaths is true and filters are enabled, pass git_repository through the filtering code to ensure the cached longpath setting is returned. Fixes: #6054
Laurent Stacul 0a3a220f 2021-09-14T09:53:24 Discover libssh2 without pkg-config
Edward Thomson cd0fd0f5 2021-09-10T07:19:06 notes: use a buffer internally Code cleanup to use `git_buf`s instead of simple c strings.
Basile Henry 574c590f 2021-09-09T21:53:45 Fix multiline strip_comments logic The strip_comments function uses the count of quotes to know if a comment char (';' or '#') is the start of a comment or part of the multiline as a string. Unfortunately converting the count of quotes from previous lines to a boolean meant that it would only work as expected in some cases (0 quotes or an odd number of quotes).
punkymaniac 379c4646 2021-09-09T19:49:04 Fix coding style for pointer Make some syntax change to follow coding style.
Duncan Thomson 6c53d6ab 2021-09-08T18:42:42 Use __typeof__ GNUC keyword for ISO C compatibility