summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* tree: standard error messages are lowercaseethomson/tree_error_messagesEdward Thomson2017-12-311-10/+10
| | | | | | | | Our standard error messages begin with a lower case letter so that they can be prefixed or embedded nicely. These error messages were missed during the standardization pass since they use the `tree_error` helper function.
* Merge pull request #4159 from richardipsum/notes-commitEdward Thomson2017-12-301-48/+164
|\ | | | | Support using notes via a commit rather than a ref
| * notes: Rewrite funcs in terms of note_commit funcsRichard Ipsum2017-12-021-81/+86
| |
| * notes: Add git_note_commit_iterator_newRichard Ipsum2017-10-071-0/+19
| | | | | | | | This also adds tests for this function.
| * notes: Add git_note_commit_removeRichard Ipsum2017-10-071-2/+35
| | | | | | | | This also adds tests for this function.
| * notes: Add git_note_commit_readRichard Ipsum2017-10-071-0/+22
| | | | | | | | This also adds tests for this function.
| * notes: Add git_note_commit_createRichard Ipsum2017-10-071-0/+31
| | | | | | | | | | | | | | | | | | | | This adds a new function that will allow creation of notes without necessarily updating a particular ref, the notes tree is obtained from the git_commit object parameter, a new commit object pointing to the current tip of the notes tree is optionally returned via the 'note_commit_out' parameter, optionally the blob id for the note is returned through the 'note_blob_out' object.
| * notes: Make note_write return commit oidRichard Ipsum2017-09-231-4/+10
| | | | | | | | | | For the new 'commit' API it will be necessary to know the OID of the notes commit that was written as well as the OID of the notes blob.
* | Merge pull request #4028 from chescock/improve-local-fetchEdward Thomson2017-12-303-175/+25
|\ \ | | | | | | Transfer fewer objects on push and local fetch
| * | Use git_packbuilder_insert_walk in queue_objects.Chris Hescock2016-12-201-169/+2
| | |
| * | Don't fetch objects we don't need in local transport.Chris Hescock2016-12-202-6/+23
| | | | | | | | | | | | | | | Hide all local refs in the revwalk. Packbuilder should not add hidden trees or blobs.
* | | Merge pull request #4455 from libgit2/ethomson/branch_symlinksEdward Thomson2017-12-303-1/+39
|\ \ \ | | | | | | | | refs: traverse symlinked directories
| * | | iterator: cleanups with symlink dir handlingEdward Thomson2017-12-303-17/+32
| | | | | | | | | | | | | | | | Perform some error checking when examining symlink directories.
| * | | branches: Check symlinked subdirectoriesAndy Doan2017-12-293-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Native Git allows symlinked directories under .git/refs. This change allows libgit2 to also look for references that live under symlinked directories. Signed-off-by: Andy Doan <andy@opensourcefoundries.com>
* | | | Merge pull request #4443 from libgit2/ethomson/large_loose_blobsEdward Thomson2017-12-308-136/+196
|\ \ \ \ | |/ / / |/| | | Inflate large loose blobs
| * | | hash: commoncrypto hash should support large filesEdward Thomson2017-12-201-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach the CommonCrypto hash mechanisms to support large files. The hash primitives take a `CC_LONG` (aka `uint32_t`) at a time. So loop to give the hash function at most an unsigned 32 bit's worth of bytes until we have hashed the entire file.
| * | | hash: win32 hash mechanism should support large filesEdward Thomson2017-12-201-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach the win32 hash mechanisms to support large files. The hash primitives take at most `ULONG_MAX` bytes at a time. Loop, giving the hash function the maximum supported number of bytes, until we have hashed the entire file.
| * | | odb_loose: reject objects that cannot fit in memoryEdward Thomson2017-12-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check the size of objects being read from the loose odb backend and reject those that would not fit in memory with an error message that reflects the actual problem, instead of error'ing later with an unintuitive error message regarding truncation or invalid hashes.
| * | | zstream: use UINT_MAX sized chunksEdward Thomson2017-12-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Instead of paging to zlib in INT_MAX sized chunks, we can give it as many as UINT_MAX bytes at a time. zlib doesn't care how big a buffer we give it, this simply results in fewer calls into zlib.
| * | | odb: support large loose objectsEdward Thomson2017-12-201-98/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zlib will only inflate/deflate an `int`s worth of data at a time. We need to loop through large files in order to ensure that we inflate the entire file, not just an `int`s worth of data. Thankfully, we already have this loop in our `git_zstream` layer. Handle large objects using the `git_zstream`.
| * | | object: introduce git_object_stringn2typeEdward Thomson2017-12-202-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an internal API to get the object type based on a length-specified (not null terminated) string representation. This can be used to compare the (space terminated) object type name in a loose object. Reimplement `git_object_string2type` based on this API.
| * | | util: introduce `git__prefixncmp` and consolidate implementationsEdward Thomson2017-12-202-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce `git_prefixncmp` that will search up to the first `n` characters of a string to see if it is prefixed by another string. This is useful for examining if a non-null terminated character array is prefixed by a particular substring. Consolidate the various implementations of `git__prefixcmp` around a single core implementation and add some test cases to validate its behavior.
| * | | zstream: treat `Z_BUF_ERROR` as non-fatalEdward Thomson2017-12-201-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | zlib will return `Z_BUF_ERROR` whenever there is more input to inflate or deflate than there is output to store the result. This is normal for us as we iterate through the input, particularly with very large input buffers.
* | | | Merge pull request #4021 from carlosmn/cmn/refspecs-fetchheadEdward Thomson2017-12-284-1/+33
|\ \ \ \ | | | | | | | | | | FETCH_HEAD and multiple refspecs
| * | | | remote: append to FETCH_HEAD rather than overwrite for each refspecCarlos Martín Nieto2017-12-262-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We treat each refspec on its own, but the code currently overwrites the contents of FETCH_HEAD so we end up with the entries for the last refspec we processed. Instead, truncate it before performing the updates and append to it when updating the references.
| * | | | futils: add a function to truncate a fileCarlos Martín Nieto2017-12-262-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | We want to do this in order to get FETCH_HEAD to be empty when we start updating it due to fetching from the remote.
* | | | | Merge pull request #4285 from pks-t/pks/patches-with-whitespaceEdward Thomson2017-12-231-8/+42
|\ \ \ \ \ | | | | | | | | | | | | patch_parse: fix parsing unquoted filenames with spaces
| * | | | | patch_parse: allow parsing ambiguous patch headersPatrick Steinhardt2017-11-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The git patch format allows for having unquoted paths with whitespaces inside. This format becomes ambiguous to parse, e.g. in the following example: diff --git a/file b/with spaces.txt b/file b/with spaces.txt While we cannot parse this in a correct way, we can instead use the "---" and "+++" lines to retrieve the file names, as the path is not followed by anything here but spans the complete remaining line. Because of this, we can simply bail outwhen parsing the "diff --git" header here without an actual error and then proceed to just take the paths from the other headers.
| * | | | | patch_parse: treat complete line after "---"/"+++" as pathPatrick Steinhardt2017-11-111-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing the "---" and "+++" line, we stop after the first whitespace inside of the filename. But as files containing whitespaces do not need to be quoted, we should instead use the complete line here. This fixes parsing patches with unquoted paths with whitespaces.
* | | | | | Fix unpack double freelhchavez2017-12-232-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an element has been cached, but then the call to packfile_unpack_compressed() fails, the very next thing that happens is that its data is freed and then the element is not removed from the cache, which frees the data again. This change sets obj->data to NULL to avoid the double-free. It also stops trying to resolve deltas after two continuous failed rounds of resolution, and adds a test for this.
* | | | | | Merge pull request #4430 from tiennou/fix/openssl-x509-leakEdward Thomson2017-12-231-12/+17
|\ \ \ \ \ \ | | | | | | | | | | | | | | Free OpenSSL peer certificate
| * | | | | | openssl: free the peer certificateEtienne Samson2017-12-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per SSL_get_peer_certificate docs: ``` The reference count of the X509 object is incremented by one, so that it will not be destroyed when the session containing the peer certificate is freed. The X509 object must be explicitly freed using X509_free(). ```
| * | | | | | openssl: merge all the exit paths of verify_server_certEtienne Samson2017-12-161-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it easier to cleanup allocated resources on exit.
* | | | | | | Merge pull request #4435 from lhchavez/ubsan-shift-overflowEdward Thomson2017-12-231-6/+6
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | libFuzzer: Prevent a potential shift overflow
| * | | | | | | Simplified overflow conditionlhchavez2017-12-151-3/+1
| | | | | | | |
| * | | | | | | Using unsigned insteadlhchavez2017-12-091-6/+8
| | | | | | | |
| * | | | | | | libFuzzer: Prevent a potential shift overflowlhchavez2017-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type of |base_offset| in get_delta_base() is `git_off_t`, which is a signed `long`. That means that we need to make sure that the 8 most significant bits are zero (instead of 7) to avoid an overflow when it is shifted by 7 bits. Found using libFuzzer.
* | | | | | | | Merge pull request #4402 from libgit2/ethomson/iconvEdward Thomson2017-12-231-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | cmake: let USE_ICONV be optional on macOS
| * | | | | | | | cmake: let USE_ICONV be optional on macOSethomson/iconvEdward Thomson2017-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of forcing iconv support on macOS (by forcing `USE_ICONV` on), honor the `USE_ICONV` option only on macOS. Although macOS includes iconv by default, some macOS users may have a deficient installation for some reason and they should be provided a workaround to use libgit2 even in this situation. iconv support is now disabled entirely on non-macOS platforms. No other platform supports core.precomposeunicode, and iconv should never be linked.
* | | | | | | | | Merge pull request #4429 from novalis/delete-modify-submodule-mergeEdward Thomson2017-12-231-2/+5
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|/ / / |/| | | | | | | | Do not attempt to check out submodule as blob when merging a submodule modify/deltete conflict
| * | | | | | | | Do not attempt to check out submodule as blob when merging a submodule ↵David Turner2017-12-041-2/+5
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | modify/deltete conflict
* | | | | | | | Merge pull request #4447 from pks-t/pks/diff-file-contents-refcount-blobEdward Thomson2017-12-161-1/+3
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | diff_file: properly refcount blobs when initializing file contents
| * | | | | | | diff_file: properly refcount blobs when initializing file contentsPatrick Steinhardt2017-12-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When initializing a `git_diff_file_content` from a source whose data is derived from a blob, we simply assign the blob's pointer to the resulting struct without incrementing its refcount. Thus, the structure can only be used as long as the blob is kept alive by the caller. Fix the issue by using `git_blob_dup` instead of a direct assignment. This function will increment the refcount of the blob without allocating new memory, so it does exactly what we want. As `git_diff_file_content__unload` already frees the blob when `GIT_DIFF_FLAG__FREE_BLOB` is set, we don't need to add new code handling the free but only have to set that flag correctly.
* | | | | | | | Merge pull request #4432 from lhchavez/fix-missing-trailerPatrick Steinhardt2017-12-151-0/+4
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | libFuzzer: Fix missing trailer crash
| * | | | | | | libFuzzer: Fix missing trailer crashlhchavez2017-12-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes an invalid memory access when the trailer is missing / corrupt. Found using libFuzzer.
* | | | | | | | stransport: provide error message on trust failuresEtienne Samson2017-12-141-1/+3
|/ / / / / / / | | | | | | | | | | | | | | Fixes #4440
* | | | | | | libFuzzer: Fix a git_packfile_stream leaklhchavez2017-12-061-0/+3
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change ensures that the git_packfile_stream object in git_indexer_append() does not leak when the stream has errors. Found using libFuzzer.
* | | | | | Merge pull request #4318 from Uncommon/amend_statusEdward Thomson2017-12-011-7/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add git_status_file_at
| * | | | | | status: Add a baseline field to git_status_options for comparing to trees ↵David Catmull2017-11-301-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | other than HEAD
* | | | | | | Merge pull request #4427 from pks-t/pks/openssl-threadidEdward Thomson2017-12-011-0/+9
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | openssl: fix thread-safety on non-glibc POSIX systems