summaryrefslogtreecommitdiff
path: root/src/libgit2
Commit message (Collapse)AuthorAgeFilesLines
* refs: make `git_reference_cmp` consider the nameethomson/reference_cmpEdward Thomson2022-07-071-0/+4
| | | | | | | | `git_reference_cmp` only considers the target of a reference, and ignores the name. Meaning that a reference `foo` and reference `bar` pointing to the same commit will compare equal. Correct this, comparing the name _and_ target of a reference.
* 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
| |
* | repo: allow administrator to own the configurationEdward Thomson2022-06-131-1/+1
| | | | | | | | | | | | | | Update our ownership checks that were introduced in libgit2 v1.4.3 (to combat CVE 2022-24765). These were not compatible with git's; git itself allows administrators to own the path. Our checks now match this behavior.
* | Merge pull request #6278 from ↵Edward Thomson2022-06-122-1/+13
|\ \ | | | | | | | | | | | | lhchavez/git_transport_smart_remote_connect_options transport: introduce `git_transport_smart_remote_connect_options`
| * \ Merge remote-tracking branch 'origin/main' into mainlhchavez2022-06-1117-123/+138
| |\ \
| * | | Apply suggestions from code reviewlhchavez2022-06-111-1/+1
| | | | | | | | | | | | Co-authored-by: Edward Thomson <ethomson@github.com>
| * | | transport: introduce `git_transport_smart_remote_connect_options`lhchavez2022-04-162-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6fc6eeb66c40310086c8f059cae41de69ad4c6da removed `git_transport_smart_proxy_option`, and there was nothing added to replace it. That made it hard for custom transports / smart subtransports to know what remote connect options to use (e.g. proxy options). This change introduces `git_transport_smart_remote_connect_options` to replace it.
* | | | Merge pull request #6288 from libgit2/cmn/mwindow-simplificationsEdward Thomson2022-06-122-10/+10
|\ \ \ \ | |_|/ / |/| | | A couple of simplications around mwindow
| * | | mwindow: use multiplication instesad of conditionalsCarlos Martín Nieto2022-04-291-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is a very verbose way of performing a comparison where we already have the identity value with both signs. Instead of chainging several conditions, we can rely on the maths working out.
| * | | mwindow: include both the offset and the extra in the same callCarlos Martín Nieto2022-04-292-7/+9
| | |/ | |/| | | | | | | | | | This makes it a bit easier to read while letting the caller specify how big the hash size is for this particular call.
* | | Merge pull request #6305 from zawata/fix_refdb_error_msgEdward Thomson2022-06-111-1/+1
|\ \ \ | | | | | | | | refs: fix missing error message
| * | | fix missing error messageJohn Alden2022-05-171-1/+1
| |/ /
* | | Merge pull request #6291 from libgit2/cmn/midx-no-hashEdward Thomson2022-06-111-6/+0
|\ \ \ | | | | | | | | midx: do not verify the checksum on load
| * | | midx: do not verify the checksum on loadCarlos Martín Nieto2022-05-031-6/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | This is something we only want to do during explicit verification rather than on every load. Verifying does not seem like a big deal when we're running with test workloads but once your `multi-pack-index` reaches gigabytes, we spend more time hashing this than doing any work.
* | | Replace bitwise AND 0x7fffffff with XOR 0x80000000.Colin Stolley2022-05-201-1/+1
| | | | | | | | | | | | | | | Though both are correct, this makes it clear that we're dealing with the same value.
* | | midx: fix large object offset table check.Colin Stolley2022-05-201-1/+1
|/ / | | | | | | | | | | | | | | It's insufficient to only check if the offset high order bit is set, we must also check to see if object_large_offsets are in use. This bug is causing objects to appear missing because they can't be found in the index.
* | Merge pull request #6265 from libgit2/ethomson/sha256_twoEdward Thomson2022-04-1816-114/+135
|\ \ | |/ |/| sha256: refactoring in preparation for sha256
| * midx: use raw oid dataEdward Thomson2022-04-102-16/+20
| | | | | | | | | | A multi-pack index uses raw oid data, use a byte array to index into them.
| * index: use raw oid dataEdward Thomson2022-04-101-6/+6
| | | | | | | | | | The index contains entries with raw oid data, use a byte array for the raw entry data.
| * pack: use raw oid dataEdward Thomson2022-04-102-18/+25
| | | | | | | | | | A packfile contains arrays of raw oid data, use a byte array to index into them.
| * commit_graph: use raw oid dataEdward Thomson2022-04-102-17/+20
| | | | | | | | | | The commit graph contains arrays of raw oid data, use a byte array to index into them.
| * oid: introduce `git_oid_raw_cpy`Edward Thomson2022-04-102-2/+9
| | | | | | | | | | | | | | | | Now that oids are type-aware, they use their type to understand how many bytes to copy. Some callers may need to copy the raw bytes of the object id. This is equivalent to a memcpy that is a little more semantic.
| * oid: introduce `git_oid_raw_ncmp`Edward Thomson2022-04-102-19/+24
| |
| * oid: `hashcmp` is now `raw_cmp`Edward Thomson2022-04-103-5/+7
| | | | | | | | | | We will talk about "raw" oids as untyped blobs of data; use a name for the comparison function that is in keeping with that.
| * indexer: write raw id dataEdward Thomson2022-04-101-1/+1
| | | | | | | | Don't write the object id structure, write its raw oid data.
| * treecache: write the raw id not the objectEdward Thomson2022-04-101-1/+1
| | | | | | | | | | We explicitly want to write on the id data, not the beginning of the object data, which may contain other information in the future.
| * oidmap: hash on the id, not the objectEdward Thomson2022-04-101-1/+1
| | | | | | | | | | We explicitly want to hash on the id data, not the beginning of the object data, which may contain other information in the future.
| * oid: don't assume the size of an oidEdward Thomson2022-04-101-1/+1
| | | | | | | | | | Don't assume that a `git_oid` is a particular size; allocate `sizeof(git_oid)` instead.
| * tree: move git_oid into tree entryEdward Thomson2022-04-104-28/+21
| | | | | | | | | | | | | | | | | | | | | | | | A tree entry previously pointed directly into the object id within the tree object itself; this is useful to avoid any unnecessary memory copy (and an unnecessary use of 40 bytes per tree entry) but difficult if we change the underlying `git_oid` object to not simply be a raw object id but have additional structure. This commit moves the `git_oid` directly into the tree entry; this simplifies the tree entry creation from user data. We now copy the `git_oid` into place when parsing.
* | repo: make ownership checks optionalEdward Thomson2022-04-113-1/+12
| | | | | | | | | | Introduce the `GIT_OPT_SET_OWNER_VALIDATION` option, so that users can disable repository ownership validation.
* | repo: honor safe.directory during ownership checksEdward Thomson2022-04-111-5/+46
| | | | | | | | | | | | | | Obey the `safe.directory` configuration variable if it is set in the global or system configuration. (Do not try to load this from the repository configuration - to avoid malicious repositories that then mark themselves as safe.)
* | repo: refactor global config loader functionEdward Thomson2022-04-111-19/+32
| | | | | | | | | | Pull the global configuration loader out of the symlink check so that it can be re-used.
* | repo: ensure that repo dir is owned by current userEdward Thomson2022-04-111-3/+28
| | | | | | | | | | | | Ensure that the repository directory is owned by the current user; this prevents us from opening configuration files that may have been created by an attacker.
* | fs_path: refactor ownership checks into current user and systemEdward Thomson2022-04-111-5/+9
|/ | | | | | Provide individual file ownership checks for both the current user and the system user, as well as a combined current user and system user check.
* Merge pull request #6260 from lhchavez/midx-fix-ubEdward Thomson2022-04-101-3/+8
|\ | | | | midx: Fix an undefined behavior (left-shift signed overflow)
| * [midx] Fix an undefined behavior (left-shift signed overflow)lhchavez2022-04-051-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | There was a missing check to ensure that the `off64_t` (which is a signed value) didn't overflow when parsing it from the midx file. This shouldn't have huge repercusions since the parsed value is immediately validated afterwards, but then again, there is no such thing as "benign" undefined behavior. This change makes all the bitwise arithmetic happen with unsigned types and is only casted to `off64_t` until the very end. Thanks to Taotao Gu for finding and reporting this!
* | Merge pull request #6244 from jorio/fix-diff_delta_format_path-crashEdward Thomson2022-04-101-0/+5
|\ \ | |/ |/| Fix crash when regenerating a patch with unquoted spaces in filename
| * Update src/libgit2/diff_print.cEdward Thomson2022-04-101-3/+2
| |
| * diff_delta_format_path: handle null filenameIliyas Jorio2022-03-131-0/+6
| | | | | | | | | | | | This fixes a crash in test cases test_diff_parse__new_file_with_space_and_regenerate_patch and test_diff_parse__delete_file_with_space_and_regenerate_patch
* | fetch: support OID refspec without dstEdward Thomson2022-03-232-4/+10
| | | | | | | | | | Support the ability to create a refspec that is a single object ID without a destination.
* | Fix a string parsing bug when validating extensions from the configurationWilhelm Bierbaum2022-03-161-0/+1
|/ | | | | | As builtin extensions are evaluated in the latter half of `check_valid_extension`, a string `cfg` is concatenated with the static string 'extension.' and the value from `builtin_extension`, before being compared with the configured value. This string is not being cleared while iterating through the names of the extensions. Because there is currently only one extension ('noop'), the bug was never noticible. This patch corrects the behavior by clearing the string on each iteration, as is done in the first block.
* object: validate that `odb_obj` was setEdward Thomson2022-02-271-0/+1
|