Commit Graph

3192 Commits

Author SHA1 Message Date
Edward Thomson
f898d2d587 repo: workdir path validation belongs in repo
The repository-specific repository path validation belongs in the
repository class, not the generic path class.
2021-10-07 07:26:23 -04:00
Edward Thomson
8c29885e02 Merge pull request #6076 from libgit2/ethomson/oidarray_dispose
oidarray: introduce `git_oidarray_dispose`
2021-09-27 08:57:03 -04:00
Edward Thomson
b6449de323 Merge pull request #6075 from libgit2/ethomson/attr_longpaths 2021-09-27 08:39:55 -04:00
Edward Thomson
853ba20320 Merge pull request #6073 from libgit2/ethomson/attr_lookups 2021-09-27 08:39:39 -04:00
Edward Thomson
7e7cfe8acd 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.
2021-09-26 20:20:57 -04:00
Edward Thomson
0bd132ab82 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`.
2021-09-26 18:02:07 -04:00
Edward Thomson
46508fe647 attr_file: don't take the repo as an arg
The `repo` argument is now unnecessary.  Remove it.
2021-09-26 17:46:07 -04:00
Edward Thomson
0f4256b8d7 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.
2021-09-25 14:39:01 +01:00
Edward Thomson
efa0d64e03 Merge pull request #6067 from libgit2/ethomson/filter_commit_id
filter: use a `git_oid` in filter options, not a pointer
2021-09-21 13:19:10 -04:00
Edward Thomson
90656858ce 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.
2021-09-21 11:28:39 -04:00
Edward Thomson
470acc7188 rebase: fix (deprecated) signing test 2021-09-21 11:01:27 -04:00
Edward Thomson
ba01547d4a Merge pull request #6061 from libgit2/ethomson/email
Introduce `git_email_create`; deprecate `git_diff_format_email`
2021-09-20 21:45:10 -04:00
Edward Thomson
bfdba8ee93 Merge branch 'sathieu/patch-1' into main 2021-09-20 12:19:48 -04:00
Edward Thomson
8e7621241d httpproxy: move empty string test above config
The configuration change will override the environment variable, so the
environment variable check needs to come first.
2021-09-20 12:19:05 -04:00
Edward Thomson
005c740b15 win32: ensure content filtering occurs in longpath test 2021-09-20 14:09:00 +01:00
Edward Thomson
482e385353 Merge remote-tracking branch 'mathworks/longpath_filter_bug' into main 2021-09-20 14:06:50 +01:00
Edward Thomson
0644c2e8c5 Merge pull request #6058 from mathworks/proxy_config_with_detached_remote
Allow proxy options when connecting with a detached remote.
2021-09-20 08:39:46 -04:00
Edward Thomson
ba3595af0f diff: deprecate diff_format_email
`git_diff_format_email` is deprecated in favor of `git_email_create`.
2021-09-18 08:32:42 -04:00
Edward Thomson
67b1d019a8 email: include renames by default
`git format-patch` includes diffs with rename detection enabled by
default when creating emails.  Match this behavior.
2021-09-18 08:32:41 -04:00
Edward Thomson
323f222f7e email: include binary diffs by default
`git format-patch` includes binary diffs by default when creating
emails.  Match this behavior.
2021-09-18 08:32:41 -04:00
Edward Thomson
3f13d2e8a3 email: allow git_diff_commit_as_email to take 0 as patch index
Allow a `0` patch index and `0` patch count; in this case, simply don't
display these in the email.
2021-09-18 08:32:41 -04:00
Edward Thomson
6aa3496679 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.
2021-09-18 08:32:41 -04:00
Edward Thomson
75d4676a64 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.
2021-09-18 08:32:41 -04:00
Laurence McGlashan
e994299f8b Update formatting. 2021-09-16 11:53:32 +01:00
Laurence McGlashan
eb41276fe0 Allow proxy options when connecting with a detached remote. 2021-09-16 11:44:04 +01:00
Colin Stolley
516f7519f0 Add test for revert+rename bug. 2021-09-15 17:09:17 -05:00
Laurence McGlashan
0d30e7bb3d Apply suggestions from code review
Co-authored-by: Edward Thomson <ethomson@github.com>
2021-09-14 13:07:33 +01:00
Edward Thomson
4f24a932f0 Merge pull request #6031 from libgit2/ethomson/extensions
Support custom git extensions
2021-09-14 07:45:50 -04:00
Laurence McGlashan
6cf9a0b3ee Refactor shared code in longpath test. 2021-09-14 12:34:45 +01:00
Laurence McGlashan
26bf94c07b 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
2021-09-14 12:19:54 +01:00
Mathieu Parent
31e32ddf35 Add test to ensure empty proxy env behaves like unset env
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2021-09-14 09:34:25 +02:00
Basile Henry
5eab4dafbe Add test config parsing
This tests parsing a multiline string containing multiple quoted comment
chars. See #6019
2021-09-09 21:51:52 +02:00
Edward Thomson
a24e656a4e common: support custom repository extensions
Allow users to specify additional repository extensions that they want
to support.  For example, callers can specify that they support
`preciousObjects` and then may open repositories that support
`extensions.preciousObjects`.

Similarly, callers may opt out of supporting extensions that the library
itself supports.
2021-09-04 13:00:18 -04:00
Edward Thomson
2f3074da51 repo: refactor extensions tests into their own file 2021-09-03 17:03:00 -04:00
Edward Thomson
3c0f14cc95 remote: refactor proxy detection
Update the proxy detection for a remote.

1. Honor `http.<url>.proxy` syntax for a remote's direct URL and
   parent URLs.
2. Honor an empty configuration URL to override a proxy configuration.

Add tests to ensure that configuration specificity is honored.
2021-09-01 21:20:25 -04:00
Edward Thomson
9e98e443ca url: introduce git_net_url_matches_pattern_list
Provide a utility method on a url to determine if it matches any pattern
in a comma-separated list, similar to what one would find in `NO_PROXY`
environment variables.
2021-09-01 20:40:19 -04:00
Edward Thomson
e5ba0a3c37 url: introduce git_net_url_matches_pattern
Provide a method to determine if a given URL matches a host:port pattern
like the ones found in `NO_PROXY` environment variables.
2021-09-01 20:40:05 -04:00
Edward Thomson
3680f0bf52 tests: create the network::url test hierarcy 2021-09-01 20:39:56 -04:00
Edward Thomson
1196de4f26 util: introduce git__strlcmp
Introduce a utility function that compares a NUL terminated string to a
possibly not-NUL terminated string with length.  This is similar to
`strncmp` but with an added check to ensure that the lengths match (not
just the `size` portion of the two strings).
2021-09-01 20:39:51 -04:00
Mathieu Parent
e5a3277452 Add NO_PROXY env support
Item 2 of 3 from #4164

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2021-09-01 20:39:25 -04:00
Edward Thomson
98be5a1142 Merge branch 'cgraph-write' into main 2021-08-30 17:55:47 -04:00
Edward Thomson
b16a36e111 Merge pull request #6011 from libgit2/ethomson/filter_apply
filter: filter drivers stop taking git_buf as user input
2021-08-29 22:53:49 -04:00
Edward Thomson
258115db3e Merge pull request #6016 from libgit2/ethomson/commit_create_cb
Introduce `create_commit_cb`, deprecate `signing_cb`
2021-08-29 22:53:38 -04:00
Edward Thomson
16a2e6676f Merge pull request #6012 from libgit2/ethomson/custom_url
remote: introduce remote_ready_cb, deprecate resolve_url callback
2021-08-29 22:53:28 -04:00
Edward Thomson
9f84003c22 Merge pull request #6009 from libgit2/ethomson/custom_cert_locations
opts: test GIT_OPT_SET_SSL_CERT_LOCATIONS
2021-08-29 22:34:19 -04:00
Edward Thomson
0e04726866 opts: test GIT_OPT_SET_SSL_CERT_LOCATIONS
Include a self-signed certificate for test.libgit2.org:1443 that we can
use to verify that GIT_OPT_SET_SSL_CERT_LOCATIONS works.
2021-08-29 21:52:30 -04:00
lhchavez
7d9ebdc840 Merge remote-tracking branch 'origin/main' into cgraph-write 2021-08-29 18:50:49 -07:00
Edward Thomson
2998a84ab6 Merge pull request #5841 from J0Nes90/features/checkout-dry-run
Checkout dry-run
2021-08-29 21:49:33 -04:00
Edward Thomson
c3512fe6d2 Merge branch 'main' into multi-pack-index-odb-write 2021-08-29 21:35:40 -04:00
Edward Thomson
78cd76249c Merge pull request #5404 from lhchavez/multi-pack-index-write
midx: Add a way to write multi-pack-index files
2021-08-29 21:30:51 -04:00