summaryrefslogtreecommitdiff
path: root/src/libgit2
Commit message (Collapse)AuthorAgeFilesLines
* core: allow users to configure home directoryEdward Thomson2023-02-091-0/+19
| | | | | | | | | | Some callers -- like our test suite and the test suites of our language bindings -- want to isolate the home directory to avoid accidentally including the executing user's actual home directory data. Previously, we combined the notion of a home directory and global configuration -- now that this is separated, we provide users the ability to configure both.
* config: use home directory for `~` includesEdward Thomson2023-02-092-3/+3
| | | | | | | | Users can specify a config file to be included in the home directory using `~/filename` syntax. Instead of looking in the global configuration location (which may be overridden), use the user's _actual_ home directory. This allows callers to change the global configuration location separately from the home directory.
* attr: use home directory for `~` includesEdward Thomson2023-02-091-1/+1
| | | | | | | | Users can specify an attribute file to be included in the home directory using `~/filename` syntax. Instead of looking in the global configuration location (which may be overridden), use the user's _actual_ home directory. This allows callers to change the global configuration location separately from the home directory.
* ssh: give a realistic error messageEdward Thomson2023-02-091-2/+2
| | | | | I spent an hour banging my head against this, when it was because the remote didn't trust my key.
* ssh: support windows `known_hosts` filesEdward Thomson2023-02-091-8/+8
| | | | | | | Use `git_sysdir_find_homedir_file` to identify the path to the home directory's `.ssh/known_hosts`; this takes Windows paths into account by preferring `HOME`, then falling back to `HOMEPATH` and `USERPROFILE` directories.
* sysdir: provide actual home directoryEdward Thomson2023-02-092-10/+58
| | | | | | | | | | Provide a mechanism to look up the user's home directory, using the same mechanism that we use for locating the global configuration path (a fancy name for saying "the home directory"). SSH known hosts lookups now use this, instead of simply looking at the HOME environment variable, to support Windows-style home directory lookups in `HOME`, `HOMEPATH`, or `USERPROFILE`.
* sysdir: move windows sysdir functions out of shared utilEdward Thomson2023-02-092-6/+275
| | | | | | The windows sysdir functions are libgit2-specific and for git compatibility only; remove them from the shared util directory and bring them into the libgit2 source tree.
* Merge pull request #6444 from abizjak/mainEdward Thomson2023-01-261-1/+1
|\
| * Use `git_clone__submodule` to avoid file checks in workdirAleš Bizjak2023-01-051-1/+1
| | | | | | | | | | | | | | `git_clone` checks for existence of (non-empty) directories that would clash with what is about to be cloned. This is problematic when cloning submodules since they make sense in the context of a parent module, so they should not use the current working dir. Since in `git_submodule_update` we clone the submodule only when it is not yet initialized we do not need to perform directory checks.
* | push: use resolved oid as the sourceEdward Thomson2023-01-201-1/+1
| | | | | | | | | | 211c97195e2ebcf68e27782715eb756823ad5a91 attempts to use the parsed OID but inverted the arguments to `git_oid_cpy`.
* | Merge pull request #6362 from sven-of-cord/mainEdward Thomson2023-01-201-3/+10
|\ \ | | | | | | push: revparse refspec source, so you can push things that are not refs
| * | push: revparse refspec source, so you can push things that are not refsSven Over2022-07-201-3/+10
| | | | | | | | | | | | I want to push a commit by OID to a remote branch. Currently, push parses the refspecs such that the source must be the name of a ref (it uses git_reference_name_to_id to resolve it). This commit changes it so push uses git_revparse_single to resolve the source of the refspec. This allows for OIDs or other revs (e.g. `HEAD~2`) to be pushed.
* | | Merge pull request #6435 from russell/capabilities-typoEdward Thomson2023-01-201-2/+2
|\ \ \ | | | | | | | | transport: fix capabilities calculation
| * | | transport: fix capabilities calculationRussell Sim2022-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This looks like a typo to me, from what i can see these lines were added at the same time and because of how capabilities are calculated, it's likely that this code will work in situations where these capabilities were the last ones.
* | | | Merge commit 'e33d7c068' into ssh_key_checkingEdward Thomson2023-01-201-91/+326
|\ \ \ \ | |_|_|/ |/| | |
| * | | ssh: look for a key in known_hosts to set the key type for the handshakeCarlos Martín Nieto2022-11-041-53/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The server and client negotiate a single hostkey, but the "best" cipher may not be the one for which we have an entry in `known_hosts`. This can lead to us not finding the key in known_hosts even though we should be connecting. Instead here we look up the hostname with a nonsense key to perform a lookup in the known hosts and set that. This is roughly what the OpenSSH client does as well.
| * | | ssh: verify the remote's host key against known_hosts if it existsCarlos Martín Nieto2022-11-021-87/+222
| | | | | | | | | | | | | | | | | | | | It turns out this has been available in libssh2 for a long time and we should have been verifying this the whole time.
* | | | submodule: Do not try to update a missing submoduletagesuhu2022-11-251-1/+5
| |/ / |/| | | | | | | | | | | If a submodule has been configured but not yet added, do not try to update it. Issue #6433: git_submodule_update fails to update configured but missing submodule
* | | Merge pull request #6429 from csware/safe.directory-wildcardEdward Thomson2022-11-231-1/+3
|\ \ \ | | | | | | | | Add support for "safe.directory *"
| * | | Add support for "safe.directory *"Sven Strickroth2022-11-191-1/+3
| | | | | | | | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | | Merge pull request #6416 from slackner/httpclient_update_optionsEdward Thomson2022-11-233-7/+27
|\ \ \ \ | |/ / / |/| | | http: Update httpclient options when reusing an existing connection.
| * | | http: Update httpclient options when reusing an existing connection.Sebastian Lackner2022-10-203-7/+27
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Httpclient internally stores a copy of the certificate_check callback and payload. When connecting via HTTPS, and if the server sends back "Connection: close" after the first request, the following request would attempt to re-use the httpclient and call the (now outdated) callback. In particular for pygit2 this is a problem, since callbacks / payloads are only valid for the duration of a libgit2 call, leading to a ffi.from_handle() error and crashing the Python interpreter.
* | | Merge pull request #6421 from ↵Edward Thomson2022-11-181-2/+7
|\ \ \ | | | | | | | | | | | | | | | | julianmesa-gitkraken/fix-leak-git_tag_create_from_buffer Fix leak in git_tag_create_from_buffer
| * | | Missing dispose in git_tag_create__internalJulian Mesa2022-11-031-1/+3
| | | |
| * | | Missing disposeJulian Mesa2022-11-031-1/+3
| | | |
| * | | Fix leak in git_tag_create_from_bufferJulian Mesa2022-11-031-0/+1
| |/ / | | | | | | | | | If the tag already exists and we are not forcing overwrite we need to free ref_name buffer before return the "tag already exists" error.
* | | Merge pull request #6408 from kcsaul/fix-safe-directory-not-foundEdward Thomson2022-11-181-0/+3
|\ \ \ | | | | | | | | Ignore missing 'safe.directory' config during ownership checks
| * | | repo: ignore missing 'safe.directory' config during ownership checksKevin Saul2022-10-011-0/+3
| |/ /
* | | commit_graph: use uint64_t for arithmeticDerrick Stolee2022-11-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This should resolve some issues with UBSan builds by using unsigned 64-bit integers for all arithmetic until we finally convert to an offset or size value. Signed-off-by: Derrick Stolee <derrickstolee@github.com>
* | | commit-graph: only verify csum on git_commit_graph_open().Colin Stolley2022-11-032-7/+24
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is expensive to compute the sha1 of the entire commit-graph file each time we open it. Git only does this if it is re-writing the file. This patch will only verify the checksum when calling the external API git_commit_graph_open(), which explicitly says it opens and verifies the commit graph in the documentation. For internal library calls, we call git_commit_graph_get_file(), which mmaps the commit-graph file in read-only mode. Therefore it is safe to skip the validation check there. Tests were added to check that the validation works in the happy path, and prevents us from opening the file when validation fails. (Note from Derrick Stolee: This patch was applied internally at GitHub after we recognized the performance impact it had during an upgrade of libgit2. The original author left the company before we remembered to send it upstream.) Signed-off-by: Derrick Stolee <derrickstolee@github.com>
* | Merge pull request #6405 from libgit2/ethomson/experimentalEdward Thomson2022-09-211-0/+7
|\ \ | | | | | | Support non-cmake builds with an in-tree `experimental.h`
| * | cmake: provide empty experimental.h for non-cmake usersEdward Thomson2022-09-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Not everybody builds libgit2 using cmake; provide an `experimental.h` with no experiments configured for those that do not. To support this, we also now create compile definitions for experimental functionality, to supplant that empty `experimental.h`. cmake will continue to generate the proper `experimental.h` file for use with `make install`.
* | | Merge pull request #6395 from arroz/fix/nonexistent-worktree-lookup-error-codeEdward Thomson2022-09-191-0/+5
|\ \ \ | | | | | | | | #6366: When a worktree is missing, return GIT_ENOTFOUND.
| * | | #6366: When a worktree is missing, return GIT_ENOTFOUND.Miguel Arroz2022-08-301-0/+5
| | |/ | |/|
* | | Merge pull request #6369 from torvalds/mainEdward Thomson2022-09-191-1/+5
|\ \ \ | |_|/ |/| | Don't fail the whole clone if you can't find a default branch
| * | clone: narrow success tests on HEAD-less remotesEdward Thomson2022-09-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only allow the remote default branch checking to fail when the remote default branch doesn't exist (`git_remote__default_branch` returns `GIT_ENOTFOUND`). If there was any other type of error - for example, an allocation failure - we should not swallow that and continue to fail. This allows us to support the case when a remote has not advertised a HEAD -- this is possible, for example, when the remote has constrained the caller to a particular namespace. But other remote failures remain as failures.
| * | Don't fail the whole clone if you can't find a default branchLinus Torvalds2022-07-291-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 6bb358786 ("clone: set refs/remotes/origin/HEAD to default branch when branch is specified, attempt 2") libgit2 was changed to set the default remote branch when one was copied. But it makes update_head_to_branch() return an error if the origin doesn't even *have* a HEAD in the first place, since git_remote_default_branch() will fail. That's entirely wrong, and means that you cannot do "git_clone()" of a particular branch on a remote repository when that remote doesn't have a default branch at all. So don't set the error code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | winhttp: handle long custom headersKevin Saul2022-07-221-4/+9
|/
* sha256: indirection for experimental functionsEdward Thomson2022-07-1329-58/+206
| | | | | The experimental function signature is only available when `GIT_EXPERIMENTAL_SHA256` is enabled.
* Merge pull request #6191 from libgit2/ethomson/sha256_pocEdward Thomson2022-07-1357-481/+851
|\ | | | | RFC: SHA256 proof of concept
| * sha256: make sha256 an experimental optional featureEdward Thomson2022-06-209-21/+115
| | | | | | | | | | | | | | | | | | | | libgit2 can be built with optional, experimental sha256 support. This allows consumers to begin testing and providing feedback for our sha256 support while we continue to develop it, and allows us to make API breaking changes while we iterate on a final sha256 implementation. The results will be `git2-experimental.dll` and installed as `git2-experimental.h` to avoid confusion with a production libgit2.
| * meta: generated `features.h` is now `git2_features.h`Edward Thomson2022-06-201-1/+1
| | | | | | | | | | Linux has a /usr/include/features.h, which gets confusing; update this to `git2_features.h` and move it into the `util` directory.
| * odb_loose: SHA256 support for loose object storageEdward Thomson2022-06-202-44/+59
| | | | | | | | Teach the loose object database how to cope with SHA256 objects.
| * oid: add git_oid_fmt_substrEdward Thomson2022-06-202-25/+36
| | | | | | | | Tidy up `nfmt` / `pathfmt`.
| * odb: add git_odb_loose_backend_optionsEdward Thomson2022-06-202-27/+38
| | | | | | | | Move the arguments to `git_odb_loose` into an options structure.
| * odb: accept an oid type in optionsEdward Thomson2022-06-202-16/+25
| | | | | | | | | | Allow the object database to take an oid type that it supports. This oid type will be used to validate the objects that the backends provide.
| * odb: add git_odb_optionsEdward Thomson2022-06-203-5/+23
| | | | | | | | | | Users will need to be able to specify the object id type for the given object database; add a new `git_odb_options` with that option.
| * odb_hash*: accept the oid type to hash intoEdward Thomson2022-06-209-44/+90
| | | | | | | | | | The git_odb_hash helper functions should not assume SHA1, and instead should be given the oid type that they're producing.
| * oid: provide an oid type to hash type mapEdward Thomson2022-06-201-0/+13
| | | | | | | | | | | | We intentionally separate oid types from hash types; a hash is a generic hunk of bytes, an object id has meaning and backs an object on disk. As a result of this separation, we need a 1:1 mapping.
| * oid: add sha256 typed oidsEdward Thomson2022-06-201-0/+4
| |