summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* winhttp: properly support ntlm and negotiateethomson/spnegoEdward Thomson2017-12-291-4/+13
| | | | | | | When parsing unauthorized responses, properly parse headers looking for both NTLM and Negotiate challenges. Set the HTTP credentials to default credentials (using a `NULL` username and password) with the schemes supported by ourselves and the server.
* Merge pull request #4021 from carlosmn/cmn/refspecs-fetchheadEdward Thomson2017-12-285-9/+113
|\ | | | | FETCH_HEAD and multiple refspecs
| * fetch: go over FETCH_HEAD just once when counting the prefixes in testCarlos Martín Nieto2017-12-261-21/+26
| |
| * 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.
| * fetch: add a failing test for FETCH_HEAD with multiple fetch refspecsCarlos Martín Nieto2017-12-261-0/+59
| |
| * fetch: expand fetchhead test to cover providing multiple refspecsCarlos Martín Nieto2017-11-191-8/+16
| |
* | Merge pull request #4285 from pks-t/pks/patches-with-whitespaceEdward Thomson2017-12-233-8/+58
|\ \ | | | | | | patch_parse: fix parsing unquoted filenames with spaces
| * | patch_parse: allow parsing ambiguous patch headersPatrick Steinhardt2017-11-113-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #4045 from lhchavez/fix-unpack-double-freeEdward Thomson2017-12-233-8/+68
|\ \ \ | | | | | | | | Fix unpack double free
| * | | Fix unpack double freelhchavez2017-12-233-8/+68
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-232-3/+7
|\ \ \ \ \ | | | | | | | | | | | | cmake: let USE_ICONV be optional on macOS
| * | | | | cmake: let USE_ICONV be optional on macOSethomson/iconvEdward Thomson2017-11-112-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-235-2/+44
|\ \ \ \ \ \ | | | | | | | | | | | | | | 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-045-2/+44
| | |/ / / / | |/| | | | | | | | | | | | | | | | modify/deltete conflict
* | | | | | Merge pull request #4449 from libgit2/charliesome/git-authors-jonathan-tanEdward Thomson2017-12-191-0/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add Jonathan Tan to git.git-authors
| * | | | | | Add Jonathan Tan to git.git-authorsCharlie Somerville2017-12-191-0/+1
|/ / / / / / | | | | | | | | | | | | Jonathan has consented via email to have his contributions to git reused in libgit2
* | | | | | Merge pull request #4447 from pks-t/pks/diff-file-contents-refcount-blobEdward Thomson2017-12-162-1/+42
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | diff_file: properly refcount blobs when initializing file contents
| * | | | | diff_file: properly refcount blobs when initializing file contentsPatrick Steinhardt2017-12-152-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-152-0/+21
|\ \ \ \ \ \ | |/ / / / / |/| | | | | libFuzzer: Fix missing trailer crash
| * | | | | libFuzzer: Fix missing trailer crashlhchavez2017-12-082-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes an invalid memory access when the trailer is missing / corrupt. Found using libFuzzer.
* | | | | | Merge pull request #4444 from tiennou/fix/4440Patrick Steinhardt2017-12-151-1/+3
|\ \ \ \ \ \ | |/ / / / / |/| | | | | stransport: provide error message on trust failures
| * | | | | stransport: provide error message on trust failuresEtienne Samson2017-12-141-1/+3
|/ / / / / | | | | | | | | | | Fixes #4440
* | | | | Merge pull request #4431 from lhchavez/fix-stream-leakPatrick Steinhardt2017-12-082-0/+30
|\ \ \ \ \ | |/ / / / |/| | | | libFuzzer: Fix a git_packfile_stream leak
| * | | | libFuzzer: Fix a git_packfile_stream leaklhchavez2017-12-062-0/+30
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | 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-013-7/+47
|\ \ \ \ | | | | | | | | | | Add git_status_file_at
| * | | | status: Add a baseline field to git_status_options for comparing to trees ↵David Catmull2017-11-303-7/+47
| | | | | | | | | | | | | | | | | | | | 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
| * | | | | openssl: fix thread-safety on non-glibc POSIX systemsPatrick Steinhardt2017-11-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the OpenSSL library provides all means to work safely in a multi-threaded application, we fail to do so correctly. Quoting from crypto_lock(3): OpenSSL can safely be used in multi-threaded applications provided that at least two callback functions are set, locking_function and threadid_func. We do in fact provide the means to set up the locking function via `git_openssl_set_locking()`, where we initialize a set of locks by using the POSIX threads API and set the correct callback function to lock and unlock them. But what we do not do is setting the `threadid_func` callback. This function is being used to correctly locate thread-local data of the OpenSSL library and should thus return per-thread identifiers. Digging deeper into OpenSSL's documentation, the library does provide a fallback in case that locking function is not provided by the user. On Windows and BeOS we should be safe, as it simply "uses the system's default thread identifying API". On other platforms though OpenSSL will fall back to using the address of `errno`, assuming it is thread-local. While this assumption holds true for glibc-based systems, POSIX in fact does not specify whether it is thread-local or not. Quoting from errno(3p): It is unspecified whether errno is a macro or an identifier declared with external linkage. And in fact, with musl there is at least one libc implementation which simply declares `errno` as a simple `int` without being thread-local. On those systems, the fallback threadid function of OpenSSL will not be thread-safe. Fix this by setting up our own callback for this setting. As users of libgit2 may want to set it themselves, we obviously cannot always set that function on initialization. But as we already set up primitives for threading in `git_openssl_set_locking()`, this function becomes the obvious choice where to implement the additional setup.
* | | | | | Merge pull request #4426 from pks-t/pks/diff-flag-set-fixEdward Thomson2017-11-302-8/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | diff_generate: fix unsetting diff flags
| * | | | | | diff_generate: fix unsetting diff flagsPatrick Steinhardt2017-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro `DIFF_FLAG_SET` can be used to set or unset a flag by modifying the diff's bitmask. While the case of setting the flag is handled correctly, the case of unsetting the flag was not. Instead of inverting the flags, we are inverting the value which is used to decide whether we want to set or unset the bits. The value being used here is a simple `bool` which is `false`. As that is being uplifted to `int` when getting the bitwise-complement, we will end up retaining all bits inside of the bitmask. As that's only ever used to set `GIT_DIFF_IGNORE_CASE`, we were actually always ignoring case for generated diffs. Fix that by instead getting the bitwise-complement of `FLAG`, not `VAL`.
| * | | | | | diff: remove unused macros `DIFF_FLAG_*`Patrick Steinhardt2017-11-301-7/+0
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 9be638ecf (git_diff_generated: abstract generated diffs, 2016-04-19), the code for generated diffs was moved out of the generic "diff.c" and instead into its own module. During that conversion, it was forgotten to remove the macros `DIFF_FLAG_IS_SET`, `DIFF_FLAG_ISNT_SET` and `DIFF_FLAG_SET`, which are now only used in "diff_generated.c". Remove those macros now.
* | | | | | Merge pull request #4424 from tiennou/fix/incorrect-winhttp-cert-payloadEdward Thomson2017-11-301-1/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Use the same cert checking payload in WinHTTP
| * | | | | winhttp: pass the same payload as ssh & http transports when checking ↵Etienne Samson2017-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | certificates
* | | | | | Merge pull request #4422 from pks-t/pks/commit-msg-styleEdward Thomson2017-11-301-0/+16
|\ \ \ \ \ \ | |/ / / / / |/| | | | | CONTRIBUTING: add documentation of our commit message style
| * | | | | CONTRIBUTING: add documentation of our commit message stylePatrick Steinhardt2017-11-241-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While we try to conform to a certain commit message style, this style has never been documented anywhere. Document it such that new contributors do not have to go through another needless iteration of their pull requests just to fix up commit messages.
* | | | | | Merge pull request #4423 from apnadkarni/patch-1Patrick Steinhardt2017-11-251-0/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Include git2/worktree.h in git2.h
| * | | | | | Include git2/worktree.h in git2.hapnadkarni2017-11-251-0/+1
|/ / / / / / | | | | | | | | | | | | I'm not sure if worktree.h was intentionally left out of git2.h. Looks like an oversight since it is in fact documented.
* | | | | | Merge pull request #4410 from libgit2/ethomson/readmeEdward Thomson2017-11-242-13/+85
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Getting started README improvements
| * | | | | README: add up some marketingEdward Thomson2017-11-241-2/+14
| | | | | |
| * | | | | README: document test outputEdward Thomson2017-11-241-0/+10
| | | | | |
| * | | | | TROUBLESHOOTING: introduce guide for common errorsEdward Thomson2017-11-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a simple FAQ for common errors for people getting started with the project.