summaryrefslogtreecommitdiff
path: root/src/libgit2
Commit message (Collapse)AuthorAgeFilesLines
* repo: don't overwrite repo format version on reinitEdward Thomson2022-12-031-8/+16
| | | | | Ensure that we maintain the `core.repositoryFormatVersion` value instead of always overwriting it with the default.
* repo: internal setter for `objectformat`Edward Thomson2022-12-032-0/+38
| | | | | Provide an internal function to set the repository's `objectformat`, both in the internal object and in the configuration.
* repo: understand the `objectformat` extensionEdward Thomson2022-12-032-5/+42
| | | | | | Teach the repository about the `objectformat` extension, supporting `sha1` always and `sha256` when the experimental sha256 support is active.
* oid: provide type lookups by enum value or nameEdward Thomson2022-12-031-0/+41
|
* 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
| |
| * oid: give oids a typeEdward Thomson2022-06-2036-108/+216
| | | | | | | | | | `git_oid`s now have a type, and we require the oid type when creating the object id from creation functions.
| * object: move oid header printing to objectEdward Thomson2022-06-145-14/+26
| |
| * object: move oid header parsing to objectEdward Thomson2022-06-145-31/+40
| |
| * oid: add functions to inspect oid informationEdward Thomson2022-06-141-0/+20
| | | | | | | | | | Provide helper functions to provide information about the object id size given its type.
| * oid: define GIT_OID_SHA1_ZEROEdward Thomson2022-06-147-12/+12
| | | | | | | | | | Callers should not assume the layout of the oid structure; provide them a macro that defines the null / zero sha1 object id.
| * oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE`Edward Thomson2022-06-1443-238/+238
| | | | | | | | | | In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ` need to indicate that they're the size of _SHA1_ OIDs.
* | Merge pull request #6348 from lya001/fix-invalid-branch-nameEdward Thomson2022-07-132-14/+29
|\ \ | | | | | | Fix creation of branches and tags with invalid names
| * | Update src/libgit2/tag.cEdward Thomson2022-07-121-0/+2
| | |
| * | Apply suggestions from code reviewEdward Thomson2022-07-122-6/+6
| | |
| * | Merge branch 'main' into fix-invalid-branch-nameyuangli2022-07-122-16/+29
| | |
* | | Merge pull request #6347 from libgit2/ethomson/no_pack_v3Edward Thomson2022-07-121-1/+1
|\ \ \ | | | | | | | | pack: don't pretend we support pack files v3
| * | | pack: don't pretend we support pack files v3Edward Thomson2022-07-081-1/+1
| |/ / | | | | | | | | | | | | | | | | | | Pack files v3 are introduced in the SHA256 hash transition document https://github.com/git/git/blob/master/Documentation/technical/hash-function-transition.txt Obviously we do not support these yet. Stop pretending that we do.
* | | repo: allow users running with sudo to access their repositoriesEdward Thomson2022-07-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | In the ownership checks implemented for CVE-2022-24765, we disallowed users to access their own repositories when running with `sudo`. Examine the `SUDO_UID` environment variable and allow users running with `sudo`. This matches git's behavior.