Commit Graph

15147 Commits

Author SHA1 Message Date
Edward Thomson
a418d9d4ab v1.7.2: update version numbers v1.7.2 2024-01-12 10:46:16 +00:00
Edward Thomson
e073ceafdb v1.7.2: add changelog 2024-01-12 10:46:15 +00:00
Edward Thomson
487af0cf66 index: correct index has_dir_name check
`has_dir_name` is used to check for directory/file collisions,
and attempts to determine whether the index contains a file with
a directory name that is a proper subset of the new index entry
that we're trying to add.

To determine directory name, the function would walk the path string
backwards to identify a `/`, stopping at the end of the string. However,
the function assumed that the strings did not start with a `/`. If the
paths contain only a single `/` at the beginning of the string, then the
function would continue the loop, erroneously, when they should have
stopped at the first character.

Correct the order of the tests to terminate properly.

Credit to Michael Rodler (@f0rki) and Amazon AWS Security.
2024-01-12 10:26:05 +00:00
Edward Thomson
19f3dcd5c2 index: test adding two identical slash-prefix paths
Ensure that we can `git_index_add` a slash-prefixed path, followed by
re-adding the same path. The original entry should be replaced by the
new entry.
2024-01-12 10:25:58 +00:00
Edward Thomson
7f6f3dff9c revparse: fix parsing bug for trailing @
When parsing a revspec that ends with a trailing `@`, explicitly stop
parsing. Introduce a sentinel variable to explicitly stop parsing.

Prior to this, we would set `spec` to `HEAD`, but were looping on the
value of `spec[pos]`, so we would continue walking the (new) `spec`
at offset `pos`, looking for a NUL. This is obviously an out-of-bounds
read.

Credit to Michael Rodler (@f0rki) and Amazon AWS Security.
2024-01-12 10:25:26 +00:00
Edward Thomson
d298b0298a transport: safely handle messages with no caps
If there are no caps, don't try to advance past the first NULL to look
for object-format. This prevents a possible out-of-bounds read.
2024-01-12 10:25:06 +00:00
Edward Thomson
a2bde63741 Merge pull request #6622 from libgit2/ethomson/v1.7.1
libgit2 v1.7.1
v1.7.1
2023-08-14 21:49:40 +01:00
Edward Thomson
81a9edd307 v1.7.1: update version numbers 2023-08-14 21:25:26 +01:00
Edward Thomson
8b59fc54aa v1.7.1: add changelog 2023-08-14 21:24:25 +01:00
Edward Thomson
e577da9d59 Revert "CMake: Search for ssh2 instead of libssh2." 2023-08-10 11:00:51 +01:00
Edward Thomson
edf559f9ee Merge pull request #6614 from libgit2/ethomson/v1.7
Backports for v1.7
2023-08-08 11:24:46 +01:00
Edward Thomson
393dd49eed Merge branch 'v1.7_proxy' into maint/v1.7 2023-08-02 21:36:47 +01:00
Edward Thomson
38a3a3711d winhttp: use new http-style url parser for proxies 2023-08-02 21:36:30 +01:00
Edward Thomson
00c62ab0ad http: test proxies in url and host:port format
Test proxies specified by both host:port format in configuration
options, environment variables, and `http.proxy` configuration.
2023-08-02 21:36:30 +01:00
Edward Thomson
7a901fb42f http: allow proxies to be specified in common format
The common format for specifying proxy URLs is just 'host:port'. Handle
the common case.
2023-08-02 21:36:30 +01:00
Edward Thomson
1d7d6ff95a net: introduce http-biased url parsing
Introduce a url parser that defaults to treating poorly specified URLs
as http URLs. For example: `localhost:8080` is treated as
`http://localhost:8080/` by the http-biased url parsing, instead of a
URL with a scheme `localhost` and a path of `8080`..
2023-08-02 21:36:30 +01:00
Edward Thomson
95d4cb6eac net: refactor url parsing
Refactor url parsing to simplify the state-passing (introducing a
struct) and add a path parser for future reusability.
2023-08-02 21:36:30 +01:00
Edward Thomson
a3d2922f48 httpclient: safety 2023-08-02 21:36:30 +01:00
lmcglash
5a13d4ca56 Validate proxy URL on Windows. 2023-08-02 21:36:30 +01:00
lmcglash
402f63a46b Return an error for invalid proxy URLs instead of crashing. 2023-08-02 21:36:30 +01:00
Edward Thomson
0ddc07763d Merge branch 'v1.7_backports' into maint/v1.7 2023-08-02 21:35:53 +01:00
steven9724
ec2439bf39 ssh: fix known_hosts leak in _git_ssh_setup_conn 2023-08-02 21:19:16 +01:00
Carlos Martín Nieto
86a4a2655f repository: make cleanup safe for re-use with grafts
We are allowed to call `git_repository__cleanup` multiple times, and this
happens e.g. in rugged if we want to free up resources before GC gets around to
them.

This means that we cannot leave dangling pointers in it, which we were doing
with the grafts. Fix this by setting the pointers to NULL after freeing the resources.
2023-08-02 21:18:54 +01:00
David Runge
085a169c1d fix: Add missing include for oidarray.
Add a missing include for `git2/oidarray.h` so build doesn't fail on
using `git_oidarray` when using custom transports.

Fixes #6607
2023-08-02 21:18:41 +01:00
Christopher Nielsen
03b0642a4b stransport: macos: replace errSSLNetworkTimeout, with hard-coded value
- Constant only available in 10.13+, causing build failures for older macOS releases
Fixes: https://github.com/libgit2/libgit2/issues/6606
2023-08-02 21:18:10 +01:00
Edward Thomson
3e2baa6d0b Merge pull request #6594 from libgit2/ethomson/v1.7
v1.7: release Kleine Raupe Nimmersatt
v1.7.0
2023-07-17 11:01:05 +01:00
Edward Thomson
c375d0b7c8 v1.7: update changelog 2023-07-17 10:33:28 +01:00
Edward Thomson
bdd031576b v1.7: update version numbers 2023-07-17 10:33:15 +01:00
Edward Thomson
bf68ce217d Merge pull request #6593 from libgit2/ethomson/pcre-8.45
deps: update pcre to 8.45
2023-07-15 21:29:19 +01:00
Edward Thomson
c02fe8d279 deps: update pcre to 8.45 2023-07-15 16:16:48 +01:00
Edward Thomson
2b55e59f60 meta: update GitHub release labels 2023-07-15 15:46:06 +01:00
Edward Thomson
9b3d9c65a5 meta: update GitHub release labels 2023-07-15 15:43:51 +01:00
Edward Thomson
e3e0564a5f Merge pull request #6577 from cavaquinho/fix/workdir_to_index_untracked_reverse
#6576 git_diff_index_to_workdir reverse now loads untracked content
2023-07-15 14:57:09 +01:00
Edward Thomson
58be98b71b Merge pull request #6563 from libgit2/pks/test-allocator
tests: add allocator with limited number of bytes
2023-07-15 14:00:35 +01:00
Edward Thomson
47dcc4bc49 Merge pull request #6345 from arroz/fix/branch-move-reflog
Fixes #6344: git_branch_move now renames the reflog instead of deleting.
2023-07-15 09:55:59 +01:00
Edward Thomson
633cde015d Merge pull request #6539 from cavaquinho/fix/revwalk-insert-by-date
Partial fix for #6532: insert-by-date order.
2023-07-15 09:53:03 +01:00
Edward Thomson
15e42fb55b Merge pull request #6585 from libgit2/cmn/midx-no-oid-verify
midx: do not try to look at every object in the index
2023-07-15 09:49:10 +01:00
Edward Thomson
40ed228bf9 Merge pull request #6584 from libgit2/cmn/pack-index-size
pack: cast the number of objects to size_t
2023-07-14 17:18:55 +01:00
Edward Thomson
72b5c53124 Merge pull request #6586 from Faless/fix/cmake_msvc
CMake: Search for ssh2 instead of libssh2.
2023-07-14 17:15:45 +01:00
Edward Thomson
59e9df3ca9 Merge pull request #6583 from libgit2/cmn/midx-unknown-chunk
midx: allow unknown chunk ids in multi-pack index files
2023-07-14 15:02:23 +01:00
Edward Thomson
a237aba6de Merge pull request #6590 from vincenzopalazzo/macros/fix-docs
docs: fix IRC server from freenode to libera
2023-07-14 13:14:13 +01:00
Vincenzo Palazzo
27b40287a0 docs: fix IRC server from freenode to libera
This commit update the contributing documents with the
new IRC server and remove the old freenode.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-07-09 16:49:46 +02:00
Fabio Alessandrelli
933c09dbec CMake: Search for ssh2 instead of libssh2.
Fixes "CMake Error: could not resolve ssh2" on Windows-MSVC.
2023-06-25 07:15:02 +02:00
Carlos Martín Nieto
c1aa0213e1 midx: do not try to look at every object in the index
Similar to previous issues around doing way too much verification at loading
time, checking whether the object index chunk is monotonic is better left for
git-fsck instead of every single time we want to look at something in the
repository.

As midx files grow, this starts taking more and more times. As an example, I
went looking for this because it's taking about 1.5s to do a single object
lookup in a repository that's ended up with a 7G multi-pack-index file.
2023-06-22 12:08:31 +02:00
Carlos Martín Nieto
1bbe0dd89d pack: cast the number of objects to size_t
Similar to a previous change where we had to change the casting when loading the
index file, we also need to make sure we don't restrict the numbers to 32-bit
when looking up objects in packfiles.

This was done about three years ago in git itself, but we never got he update in
this library.
2023-06-22 11:03:36 +02:00
Carlos Martín Nieto
f576b7dd02 midx: allow unknown chunk ids in multi-pack index files
These chunks work like extensions where it's fine not to know what one means. We
can skip over it and keep processing the file instead of erroring out.
2023-06-22 09:54:11 +02:00
Miguel Arroz
4a2c4cc93f #6576 git_diff_index_to_workdir reverse now loads untracked content 2023-06-09 18:21:13 -07:00
Edward Thomson
f041a94e2c Merge branch 'worktree_prunable' (PR #5712) 2023-05-16 12:41:41 +01:00
Edward Thomson
12b54ae009 worktree: document that is_prunable sets error messages
When a worktree is not prunable, an error message will be set with
information about why. Document that.
2023-05-16 12:40:16 +01:00
Edward Thomson
372143244d worktree: update prunable to reflect refactorings
PR #5712 predates several refactorings to move the utility code into a
more general purpose codebase. Update to reflect the refactorings.
2023-05-16 12:38:43 +01:00