summaryrefslogtreecommitdiff
path: root/src/libgit2
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | 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.
* | | repo: validate gitdir and gitlink ownershipEdward Thomson2022-07-121-30/+77
| | | | | | | | | | | | | | | | | | To match git's behavior with CVE 2022-29187, validate not only the working directory, but also the gitdir and gitlink (if it exists). This a follow up to CVE-2022-24765 that was fixed earlier.
* | | repo: allow admin owned configs by admin usersEdward Thomson2022-07-071-1/+4
| | | | | | | | | | | | | | | Allow users in the administrator group to use git configs that are owned by administrators.
* | | fs: refactor file ownership checksEdward Thomson2022-07-071-1/+4
| | | | | | | | | | | | | | | Refactor the file ownership checks so that callers can provide discrete information about the ownership expectations to a single function.
* | | Revert "repo: allow administrator to own the configuration"Edward Thomson2022-07-071-1/+1
|/ / | | | | | | | | | | | | | | This reverts commit cdff2f0237f663e0f68155655a8b66d05c1ec716. This change erroneously allowed system users to own a worktree; this should only be allowed when the current user is in the Administrator group on Windows as well.
* | Merge pull request #6334 from i-tengfei/fix-rebase-interactiveEdward Thomson2022-07-071-1/+11
|\ \ | | | | | | fix interactive rebase detect.
| * | rebase: formatting fixesEdward Thomson2022-07-061-3/+4
| | |
| * | fix interactive rebase detect.Tengfei2022-06-281-1/+10
| | |
* | | config: use correct git_sysdir_find* function within git_config_find* functionsKevin Saul2022-06-281-2/+2
|/ /
* | Merge pull request #6303 from zawata/legacy_buffer_stream_segfaultEdward Thomson2022-06-221-0/+30
|\ \ | |/ |/| filter: Fix Segfault
| * copy back git_buf after callbackJohn Alden2022-06-221-6/+16
| |
| * fix indentation, copy asizeJohn Alden2022-06-161-7/+9
| |
| * Address feedbackJohn Alden2022-06-141-3/+11
| | | | | | Co-authored-by: Edward Thomson <ethomson@github.com>
| * Call legacy_write_fn if givenJohn Alden2022-05-131-0/+10
| |