Edward Thomson [Tue, 18 May 2021 10:33:26 +0000 (18 11:33 +0100)]
test: completely ignored diff is empty
Edward Thomson [Wed, 19 May 2021 08:31:30 +0000 (19 09:31 +0100)]
Merge branch 'pr/5853'
Edward Thomson [Tue, 18 May 2021 19:49:40 +0000 (18 20:49 +0100)]
Merge pull request #5892 from libgit2/ethomson/memleak
tests: clean up memory leak, fail on leak for win32
Edward Thomson [Tue, 18 May 2021 11:21:15 +0000 (18 12:21 +0100)]
diff: test ignore-blank-lines
Edward Thomson [Tue, 18 May 2021 10:52:51 +0000 (18 11:52 +0100)]
tests: clean up refs::races zero oid test
Edward Thomson [Tue, 18 May 2021 10:51:25 +0000 (18 11:51 +0100)]
tests: exit with error on win32 leakcheck
Edward Thomson [Sun, 16 May 2021 11:53:58 +0000 (16 12:53 +0100)]
Merge pull request #5852 from implausible/httpclient/skip-entire-body
Fix issues with Proxy Authentication after httpclient refactor
Edward Thomson [Sun, 16 May 2021 10:29:47 +0000 (16 11:29 +0100)]
Merge pull request #5850 from punkymaniac/comment-format
Fix documentation formatting
Edward Thomson [Sun, 16 May 2021 10:14:44 +0000 (16 11:14 +0100)]
Merge pull request #5831 from todaysoftware/bindings/libgit2-delphi
Update README.md for additional Delphi bindings
Edward Thomson [Sun, 16 May 2021 10:11:56 +0000 (16 11:11 +0100)]
Merge branch 'zero_oid_in_old'
Manually merging #5842
Edward Thomson [Sun, 16 May 2021 10:09:44 +0000 (16 11:09 +0100)]
refs: test git_reference_create_matching failure for zero oid
Edward Thomson [Thu, 13 May 2021 18:03:00 +0000 (13 19:03 +0100)]
Merge pull request #5839 from staktrace/find_similar
Kartikaya Gupta [Thu, 15 Apr 2021 11:48:43 +0000 (15 07:48 -0400)]
Add testcase
Kartikaya Gupta [Tue, 13 Apr 2021 17:20:34 +0000 (13 13:20 -0400)]
diff: Fix bug in git_diff_find_similar.
When a split src gets turned into a rename, it should
also lose the IS_RENAME_TARGET flag, so that it doesn't
get processed in a subsequent iteration as a rename target.
Doing so can cause an assertion failure because it no
longer has the SPLIT flag.
Fixes #5811.
Tyler Ang-Wanek [Wed, 12 May 2021 18:48:23 +0000 (12 11:48 -0700)]
httpclient: no proxy creds in requests if proxy is CONNECT type
Tyler Ang-Wanek [Fri, 30 Apr 2021 22:11:54 +0000 (30 15:11 -0700)]
httpclient: git_http_client_skip_body should drain socket of body
Edward Thomson [Tue, 11 May 2021 10:09:31 +0000 (11 11:09 +0100)]
Merge pull request #5860 from libgit2/ethomson/buf_text
buf: remove unnecessary buf_text namespace
Edward Thomson [Tue, 11 May 2021 10:09:23 +0000 (11 11:09 +0100)]
Merge pull request #5859 from libgit2/ethomson/filter_buf
filter: stop taking git_buf as user input
Edward Thomson [Mon, 10 May 2021 22:14:17 +0000 (10 23:14 +0100)]
buf: bom enum is in the buf namespace
Instead of a `git_bom_t` that a `git_buf` function returns, let's keep
it `git_buf_bom_t`.
Edward Thomson [Mon, 10 May 2021 22:04:59 +0000 (10 23:04 +0100)]
buf: remove internal `git_buf_text` namespace
The `git_buf_text` namespace is unnecessary and strange. Remove it,
just keep the functions prefixed with `git_buf`.
Edward Thomson [Thu, 6 May 2021 15:32:14 +0000 (6 16:32 +0100)]
filter: internal git_buf filter handling function
Introduce `git_filter_list__convert_buf` which behaves like the old
implementation of `git_filter_list__apply_data`, where it might move the
input data buffer over into the output data buffer space for efficiency.
This new implementation will do so in a more predictible way, always
freeing the given input buffer (either moving it to the output buffer or
filtering it into the output buffer first).
Convert internal users to it.
Edward Thomson [Thu, 6 May 2021 14:37:31 +0000 (6 15:37 +0100)]
filter: deprecate git_filter_list_apply_to_data
Deprecate `git_filter_list_apply_to_data` as it takes user input as a
`git_buf`. Users should use `git_filter_list_apply_to_buffer` instead.
Edward Thomson [Thu, 6 May 2021 14:24:30 +0000 (6 15:24 +0100)]
filter: introduce git_filter_list_apply_to_buffer
Provide a filter application mechanism that takes a user-provided string
and length, instead of a `git_buf`.
Edward Thomson [Thu, 6 May 2021 14:19:58 +0000 (6 15:19 +0100)]
filter: remove git_buf sharing in `git_filter_list_apply_to_data`
The API `git_filter_list_apply_to_data` shares data between its out and
in parameters to avoid unnecessarily copying it when there are no
filters to apply. However, it does so in a manner that is potentially
confusing, leaving both `git_buf`s populated with data. This is risky
for end-users who have to know how to deal with this. Instead, we
remove this optimization - users who want to avoid unnecessary copies
can use the longstanding streaming API or check the filter status before
invoking the filters.
Edward Thomson [Thu, 6 May 2021 01:19:49 +0000 (6 02:19 +0100)]
filter: deprecate git_filter_list_stream_data
`git_filter_list_stream_data` takes user input in a `git_buf`.
`git_buf` should only be used when libgit2 itself needs to allocate data
and returned to a user that they can free when they wish. Replace it
with `git_filter_list_stream_buffer` that takes a data buffer and
length.
Edward Thomson [Thu, 6 May 2021 01:28:14 +0000 (6 02:28 +0100)]
Merge pull request #5858 from libgit2/ethomson/memleaks
test: clean up memory leaks
Edward Thomson [Thu, 6 May 2021 00:46:19 +0000 (6 01:46 +0100)]
test: clean up memory leaks
Edward Thomson [Thu, 6 May 2021 00:42:04 +0000 (6 01:42 +0100)]
Merge pull request #5857 from libgit2/ethomson/longpaths
Support `core.longpaths` on Windows
Edward Thomson [Wed, 5 May 2021 22:59:05 +0000 (5 23:59 +0100)]
win32: add file and get status on a long path
Edward Thomson [Wed, 5 May 2021 22:26:24 +0000 (5 23:26 +0100)]
win32: ensure core.longpaths is honored for workdir paths
Ian Hattendorf [Tue, 31 Dec 2019 19:38:03 +0000 (31 12:38 -0700)]
path: bump most Win32 unicode buffer sizes from MAX_PATH to GIT_PATH_MAX
Edward Thomson [Wed, 5 May 2021 22:01:57 +0000 (5 23:01 +0100)]
clar: support long paths on Windows
Edward Thomson [Tue, 4 May 2021 11:42:27 +0000 (4 12:42 +0100)]
Merge pull request #5855 from libgit2/ethomson/ci
ci: use GitHub for storing mingw-w64 build dependency
Edward Thomson [Tue, 4 May 2021 11:23:17 +0000 (4 12:23 +0100)]
ci: use GitHub for storing mingw-w64 build dependency
Edward Thomson [Sun, 2 May 2021 09:27:56 +0000 (2 10:27 +0100)]
Merge pull request #5823 from libgit2/ethomson/path_validation
Working directory path validation
yuuri [Sat, 1 May 2021 12:26:49 +0000 (1 20:26 +0800)]
diff:add option to ignore blank line changes
Edward Thomson [Mon, 26 Apr 2021 11:23:25 +0000 (26 12:23 +0100)]
repo: validate repository paths
Ensure that a repository's path (at initialization or open time) is
valid. On Windows systems, this means that the longest known path
beneath the repository will fit within MAX_PATH: this is a lock file for
a loose object within the repository itself.
Other paths, like a very long loose reference, may fail to be opened
after the repository is opened. These variable length paths will be
checked when they are accessed themselves. This new functionality is
done at open to prevent needlessly checking every file in the gitdir
(eg, `MERGE_HEAD`) for its length when we could instead check once at
repository open time.
Edward Thomson [Sat, 24 Apr 2021 12:11:25 +0000 (24 13:11 +0100)]
repo: factor the commondir detection
Edward Thomson [Sat, 24 Apr 2021 08:44:45 +0000 (24 09:44 +0100)]
refs: ensure loose refs adhere to path validation
On Windows, we need to enforce MAX_PATH for loose references and their
reflogs. Ensure that any path - including the lock file - would fit
within the 260 character maximum.
We do not honor core.longpaths for loose reference files or reflogs.
core.longpaths only applies to paths in the working directory.
Edward Thomson [Thu, 15 Apr 2021 00:31:12 +0000 (15 01:31 +0100)]
path: don't join paths in git_path_find_dir
Let `git_path_find_dir` simply take a `git_buf` that contains a
directory or a file, instead of trying to both join a path AND then deal
with prettifying it or its basename. This allows consumers to join
paths themselves (and apply any necessary rules - like fitting within
MAX_PATH).
Edward Thomson [Thu, 15 Apr 2021 00:23:07 +0000 (15 01:23 +0100)]
worktree: validate worktree paths
Worktree paths need to fix within MAX_PATH always, regardless of
`core.longpaths` setting.
Edward Thomson [Mon, 5 Apr 2021 09:57:49 +0000 (5 10:57 +0100)]
submodule: validate path lengths
Validate that working directory paths honor `core.longpaths` where
appropriate. Paths to the submodule gitdirs must always honor the
operating system length restrictions; `core.longpaths` does not affect
gitdir paths.
Edward Thomson [Sun, 4 Apr 2021 21:18:55 +0000 (4 22:18 +0100)]
iterator: validate workdir paths
Supply the repository for the filesystem and workdir iterators - for
workdir iterators, this is non-null and we can lookup the core.longpaths
configuration option. (For regular filesystem iterators, this is NULL,
so core.longpaths does not apply.)
Edward Thomson [Sun, 4 Apr 2021 19:46:40 +0000 (4 20:46 +0100)]
ignore: validate workdir paths for ignore files
Edward Thomson [Sun, 4 Apr 2021 18:59:57 +0000 (4 19:59 +0100)]
attr: validate workdir paths for attribute files
We should allow attribute files - inside working directories - to have
names longer than MAX_PATH when core.longpaths is set.
`git_attr_path__init` takes a repository to validate the path with.
Edward Thomson [Sun, 4 Apr 2021 18:46:08 +0000 (4 19:46 +0100)]
repository: validate workdir path lengths
Edward Thomson [Sun, 4 Apr 2021 13:24:35 +0000 (4 14:24 +0100)]
workdir: validate working directory entry path length
Edward Thomson [Sun, 4 Apr 2021 09:44:29 +0000 (4 10:44 +0100)]
diff: use git_repository_workdir_path
The new git_repository_workdir_path function does error checking on
working directory inputs on Windows; use it to construct paths within
working directories.
Edward Thomson [Sat, 20 Mar 2021 17:00:33 +0000 (20 17:00 +0000)]
use git_repository_workdir_path to generate paths
Use `git_repository_workdir_path` to generate workdir paths since it
will validate the length.
Edward Thomson [Sat, 20 Mar 2021 16:54:09 +0000 (20 16:54 +0000)]
checkout: validate path length
Ensure that we are validating working directory paths before we try to
write to them.
Edward Thomson [Sat, 20 Mar 2021 16:44:08 +0000 (20 16:44 +0000)]
checkout: use target path; don't assume workdir
We're not necessarily checking out into the working directory. We could
be checking out into an arbitrary location. Ensure that when we are
writing conflict data that we do it in the checkout target.
Edward Thomson [Sat, 20 Mar 2021 16:39:29 +0000 (20 16:39 +0000)]
repo: introduce git_repository_workdir_path
Add a simple accessor for workdir paths to get an absolute on-disk path
given a repository and a relative path within it. This is useful to
avoid copy-pasta `git_buf_joinpath` and to ensure that we validate
working directory paths while honoring `core.longpaths` settings.
Edward Thomson [Sat, 20 Mar 2021 14:28:25 +0000 (20 14:28 +0000)]
apply: ensure we validate paths
There was no test ensuring that we validate `.git` paths. We do, but
let's add a test to make sure that we never regress this.
Edward Thomson [Sat, 20 Mar 2021 13:01:00 +0000 (20 13:01 +0000)]
path: introduce ondisk and workdir path validation
Introduce `git_path_validate_filesystem` which validates (absolute) on-disk
paths and `git_path_validate_workdir` to perform validations on (absolute)
working directory paths. These functions are useful as there may be system
limitations on on-disk paths, particularly on Windows (for example,
enforcing MAX_PATH).
For working directory paths, these limitations may be per-repository, based
on the `core.longpaths` configuration setting.
punkymaniac [Wed, 21 Apr 2021 13:46:28 +0000 (21 15:46 +0200)]
Fix typo
punkymaniac [Wed, 21 Apr 2021 13:44:39 +0000 (21 15:44 +0200)]
Uniformise documentation return code separator
punkymaniac [Wed, 21 Apr 2021 13:34:50 +0000 (21 15:34 +0200)]
Fix documentation formatting
The return code description use '-' char as list of return value.
But with the generation of the documentation the char '-' create an
ambiguous return code value who seem an negative value.
David Turner [Thu, 15 Apr 2021 01:52:36 +0000 (14 21:52 -0400)]
git_reference_create_matching: Treat all-zero OID as "must be absent"
This is pretty useful in avoiding races: I want to create a ref only if
it doesn't already exist. I can't check first because of TOCTOU -- by
the time I finish the check, someone else might have already created
the ref. And I can't take a lock because then I can't do the create,
since the create expects to take the lock.
The semantics are inspired by git update-ref, which allows an all-zero old
value to mean that the ref must not exist.
Edward Thomson [Tue, 20 Apr 2021 08:12:58 +0000 (20 09:12 +0100)]
Merge pull request #5843 from tniessen/src-fix-typos-in-headers
src: fix typos in header files
Tobias Nießen [Sun, 18 Apr 2021 18:30:13 +0000 (18 20:30 +0200)]
src: fix typos in header files
Edward Thomson [Sat, 20 Mar 2021 09:52:17 +0000 (20 09:52 +0000)]
path: git_path_isvalid -> git_path_validate
If we want to validate more and different types of paths, the name
`git_path_validate` makes that easier and more expressive. We can add,
for example, `git_path_validate_foo` while the current name makes that
less ergonomic.
Edward Thomson [Mon, 5 Apr 2021 09:59:02 +0000 (5 10:59 +0100)]
docs: document core.longpaths support
Edward Thomson [Wed, 14 Apr 2021 21:22:11 +0000 (14 22:22 +0100)]
utf8: introduce git_utf8_char_length
Introduce a function to determine the number of Unicode characters in a
given UTF-8 string.
Edward Thomson [Wed, 14 Apr 2021 14:47:27 +0000 (14 15:47 +0100)]
utf8: refactor utf8 functions
Move the utf8 functions into a proper namespace `git_utf8` instead of
being in the namespaceless `git__` function group. Update them to
have out-params first and use `char *` instead of `uint8_t *` to match
our API treating strings as `char *` (even if they truly contain `uchar`s
inside).
Edward Thomson [Tue, 13 Apr 2021 16:00:37 +0000 (13 17:00 +0100)]
Merge pull request #5834 from libgit2/cmn/repo-no-passthrough
repo: remove an inappropriate use of PASSTHROUGH
Edward Thomson [Tue, 13 Apr 2021 10:48:27 +0000 (13 11:48 +0100)]
Merge pull request #5835 from libgit2/cmn/branch-or-ref
repo: specify init.defaultbranch is meant to be a branch name
Edward Thomson [Tue, 13 Apr 2021 10:47:52 +0000 (13 11:47 +0100)]
Merge pull request #5836 from tniessen/tests-var-name-list-c
tests: fix variable name in list.c
Edward Thomson [Tue, 13 Apr 2021 10:47:01 +0000 (13 11:47 +0100)]
Merge pull request #5838 from mjsir911/msirabella/entrycount_typo_fix
Fix diff_entrycount -> diff_num_deltas doc typo
Marco Sirabella [Tue, 13 Apr 2021 06:52:03 +0000 (12 23:52 -0700)]
Fix diff_entrycount -> diff_num_deltas doc typo
This just fixes a typo in the documentation, actual rename change was
done in
5f69a31f
Tobias Nießen [Sun, 11 Apr 2021 21:16:37 +0000 (11 23:16 +0200)]
tests: fix variable name in list.c
Carlos Martín Nieto [Sun, 11 Apr 2021 19:22:33 +0000 (11 21:22 +0200)]
repo: specify init.defaultbranch is meant to be a branch name
We don't want the default branch's refname here but its name as branch.
Returning an error saying it's not a valid reference here suggests we want the
value of `init.defaultbranch` to be something like `refs/heads/default` which is
not the case.
Carlos Martín Nieto [Sun, 11 Apr 2021 12:27:14 +0000 (11 14:27 +0200)]
repo: remove an inappropriate use of PASSTHROUGH
This error code is for callbacks where we should act as though the callback was
not set. This is not something that makes sense for a `_foreach` and checking
for that error message to bubble up mostly is happenstance precisely because
this is not an error code we expect in the callback.
As part of removing this, let's also remove a use of foreach as we can open-code
this check.
Edward Thomson [Fri, 2 Apr 2021 09:31:55 +0000 (2 10:31 +0100)]
Merge pull request #5832 from ianhattendorf/fix/repo-is-empty-empty-config-defaultbranch
Default to GIT_BRANCH_DEFAULT if init.defaultBranch is empty string
Ian Hattendorf [Thu, 1 Apr 2021 18:34:38 +0000 (1 11:34 -0700)]
Default to GIT_BRANCH_DEFAULT if init.defaultBranch is empty string
We already do this in repo_init_head
todaysoftware [Thu, 25 Mar 2021 21:22:08 +0000 (26 10:22 +1300)]
Update README.md for additional Delphi bindings
Delphi/Free pascal bindings targeting the latest version of libgit2
Edward Thomson [Sat, 20 Mar 2021 10:10:05 +0000 (20 10:10 +0000)]
Merge pull request #5821 from punkymaniac/example-duplicate-line
Remove duplicate line, in example code
punkymaniac [Wed, 17 Mar 2021 09:48:17 +0000 (17 10:48 +0100)]
Remove duplicate line, in example code
Edward Thomson [Wed, 10 Mar 2021 11:21:39 +0000 (10 11:21 +0000)]
Merge pull request #5815 from libgit2/ethomson/treebuilder_write
tree: deprecate `git_treebuilder_write_with_buffer`
Edward Thomson [Wed, 10 Mar 2021 11:19:14 +0000 (10 11:19 +0000)]
Merge pull request #5814 from ianhattendorf/fix/winhttp-proxy-https
winhttp: skip certificate check if unable to send request
Edward Thomson [Thu, 4 Mar 2021 09:45:12 +0000 (4 09:45 +0000)]
README: it's actually our main branch
[skip ci]
Edward Thomson [Thu, 4 Mar 2021 09:44:26 +0000 (4 09:44 +0000)]
Merge pull request #5764 from lhchavez/cgraph-needs-refresh
commit-graph: Introduce `git_commit_graph_needs_refresh()`
Edward Thomson [Thu, 4 Mar 2021 09:38:10 +0000 (4 09:38 +0000)]
Merge pull request #5763 from lhchavez/cgraph-lookup
commit-graph: Support lookups of entries in a commit-graph
Edward Thomson [Thu, 4 Mar 2021 09:15:37 +0000 (4 09:15 +0000)]
ci: enable UBSan stacktraces
Edward Thomson [Sun, 28 Feb 2021 00:20:28 +0000 (28 00:20 +0000)]
tree: deprecate `git_treebuilder_write_with_buffer`
The function `git_treebuilder_write_with_buffer` is unnecessary; it
is used internally as part of treebuilder writing, but it has little
use to external callers. For callers that repeatedly write a
treebuilder, we can supply them with a buffer in the treebuilder struct
instead of recreating it. For ourselves, when we want a single buffer
in our write loop, we can use an internal function.
Edward Thomson [Thu, 4 Mar 2021 09:20:34 +0000 (4 09:20 +0000)]
Merge pull request #5818 from mamapanda/patch-3
merge: Check insert_head_ids error in create_virtual_base
Edward Thomson [Thu, 4 Mar 2021 09:18:30 +0000 (4 09:18 +0000)]
Merge pull request #5817 from mamapanda/patch-2
Check git_signature_dup failure
panda [Wed, 3 Mar 2021 22:42:12 +0000 (3 14:42 -0800)]
merge: Check insert_head_ids error in create_virtual_base
insert_head_ids can fail due to allocation error
panda [Wed, 3 Mar 2021 22:03:06 +0000 (3 14:03 -0800)]
Check git_signature_dup failure
git_signature_dup can have an allocation failure
Ian Hattendorf [Mon, 1 Mar 2021 23:26:58 +0000 (1 16:26 -0700)]
winhttp: skip certificate check if unable to send request
In some circumstances (e.g. when proxies are involved), winhttp will fail to reach the WINHTTP_CALLBACK_STATUS_SENDING_REQUEST phase. If this occurs, we'll error with ERROR_WINHTTP_INCORRECT_HANDLE_STATE when attempting to query the server certificate context (see https://docs.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpsendrequest#remarks).
To avoid this, verify that WinHttpSendRequest has reached the WINHTTP_CALLBACK_STATUS_SENDING_REQUEST phase before checking the certificate. Since we're using WinHTTP in synchronous mode, we know for sure that once WinHttpSendRequest returns we've either sent it successfully or not.
NOTE: WINHTTP_CALLBACK_STATUS_SENDING_REQUEST appears to be deprecated with no direct replacement. WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE is only available in async mode, and there doesn't appear to be a method of querying this flag outside of the status callback.
Ian Hattendorf [Mon, 1 Mar 2021 18:00:37 +0000 (1 11:00 -0700)]
winhttp: test proxy https clone
Edward Thomson [Sun, 28 Feb 2021 11:02:23 +0000 (28 11:02 +0000)]
Merge pull request #5797 from aaronfranke/typos
Fix some typos
Edward Thomson [Sun, 28 Feb 2021 10:59:10 +0000 (28 10:59 +0000)]
Merge pull request #5805 from tniessen/include-typos
include: fix typos in comments
Edward Thomson [Sun, 28 Feb 2021 10:58:34 +0000 (28 10:58 +0000)]
Merge pull request #5806 from punkymaniac/comment-format
Fix documentation formating on repository.h
Tobias Nießen [Mon, 22 Feb 2021 21:57:16 +0000 (22 22:57 +0100)]
include: fix typos in comments
punkymaniac [Mon, 22 Feb 2021 13:58:46 +0000 (22 14:58 +0100)]
Fix documentation formating on repository.h
The enum 'git_repository_init_flag_t', 'git_repository_init_mode_t' and
the structure 'git_repository_init_options' does not follow the format
used by docurium.
Edward Thomson [Sun, 21 Feb 2021 20:43:51 +0000 (21 20:43 +0000)]
Merge pull request #5801 from mamapanda/patch-1
index: Check git_vector_dup error in write_entries
panda [Fri, 19 Feb 2021 00:36:42 +0000 (18 16:36 -0800)]
index: Initialize case_sorted to GIT_VECTOR_INIT
This is for extra safety within write_entries
Edward Thomson [Thu, 18 Feb 2021 04:57:25 +0000 (18 04:57 +0000)]
Merge pull request #5800 from mamapanda/check-sortedcache-lock
panda [Tue, 16 Feb 2021 21:43:09 +0000 (16 13:43 -0800)]
index: Check git_vector_dup error in write_entries
If allocating case_sorted.contents fails, git_vector_sort will segfault.
panda [Tue, 16 Feb 2021 21:08:02 +0000 (16 13:08 -0800)]
refdb_fs: Check git_sortedcache wlock/rlock errors
To prevent a race condition, these wlock/rlock calls should probably be checked
for errors.