summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | proxy: fix crash on remote connection with GIT_PROXY_AUTO but no proxy is ↵Jason Haslam2019-01-141-0/+3
| | | | | | | | | | | | detected
* | | Merge pull request #4926 from csware/warning-c4133Edward Thomson2019-01-091-1/+1
|\ \ \ | | | | | | | | Fix warning 'function': incompatible types - from 'git_cvar_value *' to 'int *' (C4133) on VS
| * | | Fix warning 'function': incompatible types - from 'git_cvar_value *' to 'int ↵Sven Strickroth2019-01-071-1/+1
| |/ / | | | | | | | | | | | | | | | *' (C4133) on VS Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | Fix Linux warningslhchavez2019-01-081-1/+1
| |/ |/| | | | | | | This change fixes -Wmaybe-uninitialized and -Wdeprecated-declarations warnings on Linux builds
* | refs: assert that we're passed valid refs when renamingEtienne Samson2019-01-041-0/+2
| | | | | | CID 1382962
* | diff: assert that we're passed a valid git_diff objectEtienne Samson2019-01-041-0/+2
| | | | | | CID 1386176, 1386177, 1388219
* | submodule: grab the error while loading from configEtienne Samson2019-01-041-1/+1
| | | | | | | | | | | | | | | | Previously, an error in `git_config_next` would be mistaken as a successful load, because the previous call would have succeeded. Coverity saw the subsequent check for a completed iteration as dead, so let's make it useful again. CID 1391374
* | config: assert that our parameters are validEtienne Samson2019-01-041-0/+2
|/ | | CID 1395011
* Merge pull request #4919 from pks-t/pks/shutdown-cb-countEdward Thomson2019-01-037-20/+49
|\ | | | | Shutdown callback count
| * global: move init callbacks into an arrayPatrick Steinhardt2019-01-021-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have an explicit callchain of all the initialization callbacks in our `init_common` function. This is perfectly fine, but requires us to manually keep track of how many shutdown callbacks there may be installed: to avoid allocations before libgit2 is fully initialized, we assume that every initializer may register at most one shutdown function. These shutdown functions are stored in a static array of size `MAX_SHUTDOWN_CB`, which then needs to be updated manually whenever a new initializer function is being added. The situation can be easily fixed: convert the callchain of init functions into an array and iterate over it to initialize all subsystems. This allows us to define the `git__shutdown_callbacks` array with the same size as the initializer array and rids us of the need to always update `MAX_SHUTDOWN_CB`.
| * hash: convert `global_init` macros to real functionPatrick Steinhardt2019-01-026-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `git_hash_global_init` function is simply defined as a macro to zero for most of the different hash implementations. This makes it impossible to treat it like a function pointer, which is required for a later commit where we want to improve the way global initialization works. Fix the issue by converting all no-op macros to an inline function returning zero. There's a small gotcha here, though: as most hash implementations only have a header file, but not a corresponding implementation file, we cannot declare the function as non-static. But declaring it as `static inline` fails, too, as there is a previous declaration as non-static. So we have to move the function declaration after the include that brings in the function definition, as it is allowed to have a non-static declaration after a static definition, but not the other way round.
* | Merge pull request #4904 from libgit2/ethomson/crlfEdward Thomson2019-01-033-201/+215
|\ \ | | | | | | Update CRLF filtering to match modern git
| * | crlf: update to match git's logicEdward Thomson2018-12-033-201/+215
| | | | | | | | | | | | | | | | | | | | | | | | Examine the recent CRLF changes to git by Torsten Bögershausen and include similar changes to update our CRLF logic to match. Note: Torsten Bögershausen has previously agreed to allow his changes to be included in libgit2.
* | | refdb_fs: refactor error handling in `refdb_reflog_fs__delete`Patrick Steinhardt2018-12-191-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function `refdb_reflog_fs__delete` uses the `if (!error && foobar())` pattern of checking, where error conditions are being checked by following calls to different code. This does not match our current style, where the call-site of a function is usually directly responsible for checking the return value. Convert the function to use `if ((error = foobar()) < 0) goto out;` style. Note that this changes the code flow a bit: previously, we were always trying to delete empty reference hierarchies even if deleting the reflog entry has failed. This wasn't much of a problem -- if deletion failed, the hierarchy will still contain at least one file and thus the function call was an expensive no-op. Now, we will only perform this deletion if we have successfully removed the reflog.
* | | Merge pull request #4833 from csware/drop-empty-dirsPatrick Steinhardt2018-12-191-2/+42
|\ \ \ | | | | | | | | Remove empty (sub-)directories when deleting refs
| * | | Remove empty directories when deleting refsSven Strickroth2018-10-131-2/+42
| | | | | | | | | | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | | annotated_commit: peel to commit instead of assuming we have onecmn/annotated-from-tagCarlos Martín Nieto2018-12-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | We want to allow the creation of annotated commits out of annotated tags and for that we have to peel the reference all the way to the commit instead of stopping at the first id it provides.
* | | | refs: constify git_reference_peelCarlos Martín Nieto2018-12-141-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have no need to take a non-const reference. This does involve some other work to make sure we don't mix const and non-const variables, but by splitting what we want each variable to do we can also simplify the logic for when we do want to free a new reference we might have allocated.
* | | | Merge pull request #4906 from QBobWatson/bugfixEdward Thomson2018-12-061-5/+9
|\ \ \ \ | | | | | | | | | | Fix segfault in loose_backend__readstream
| * | | | Typesetting conventionsJoe Rabinoff2018-12-061-9/+9
| | | | |
| * | | | Removed one null checkJoe Rabinoff2018-12-041-3/+2
| | | | |
| * | | | Fix segfault in loose_backend__readstreamJoe Rabinoff2018-12-041-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | If the routine exits with error before stream or hash_ctx is initialized, the program will segfault when trying to free them.
* | | | | make proxy_stream_close close target stream even on errorsAnders Borum2018-12-041-0/+6
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | When git_filter_apply_fn callback returns a error while smudging proxy_stream_close ends up returning without closing the stream. This is turn makes blob_content_to_file crash as it asserts the stream being closed whether there are errors or not. Closing the target stream on error fixes this problem.
* | | | object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-0147-311/+311
| | | | | | | | | | | | | | | | Use the new object_type enumeration names within the codebase.
* | | | index: use new enum and structure namesEdward Thomson2018-12-015-55/+56
| |_|/ |/| | | | | | | | Use the new-style index names throughout our own codebase.
* | | Merge pull request #4770 from tiennou/feature/merge-analysis-any-branchPatrick Steinhardt2018-11-304-10/+63
|\ \ \ | |/ / |/| | Allow merge analysis against any reference
| * | merge: assert that we're passed sane parametersEtienne Samson2018-10-191-2/+2
| | |
| * | merge: make analysis possible against a non-HEAD referenceEtienne Samson2018-10-193-8/+59
| | | | | | | | | | | | | | | | | | | | | This moves the current merge analysis code into a more generic version that can work against any reference. Also change the tests to check returned analysis values exactly.
| * | repository: assert that we're passed a valid head pointerEtienne Samson2018-10-161-0/+2
| | |
* | | Merge pull request #4888 from TheBB/add-cbPatrick Steinhardt2018-11-291-7/+3
|\ \ \ | | | | | | | | revwalk: Allow changing hide_cb
| * | | revwalk: Allow changing hide_cbEivind Fonn2018-11-281-7/+3
| | | | | | | | | | | | | | | | | | | | Since git_revwalk objects are encouraged to be reused, a public interface for changing hide_cb is desirable.
* | | | Merge pull request #4895 from pks-t/pks/unused-warningsPatrick Steinhardt2018-11-2926-146/+191
|\ \ \ \ | | | | | | | | | | Unused function warnings
| * | | | khash: move khash include into implementation filesPatrick Steinhardt2018-11-288-43/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current map implementations directly include the "khash.h" headers into their own headers to make available a set of static functions, defines et cetera. Besides leaking the complete khash namespace into files wherever khashes are used, this also triggers Clang's -Wunused-function warnings when some of the static functions are not being used at all. Fix the issue by moving the includes into the respective map implementation files. Add forward declares for all the map types to make them known.
| * | | | khash: remove intricate knowledge of khash typesPatrick Steinhardt2018-11-2819-54/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using the `khiter_t`, `git_strmap_iter` and `khint_t` types, simply use `size_t` instead. This decouples code from the khash stuff and makes it possible to move the khash includes into the implementation files.
| * | | | khash: implement map-specific foreach macrosPatrick Steinhardt2018-11-284-5/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current foreach map macros simply redirect to the type-indifferent `kh_foreach` macro. As this type-indifferent macro directly accesses the structures, the current implementation makes it impossible to make the stuctures private to the implementation only. And making them private is required to move out the khash include into the implementations to decrease the namespace leak.
| * | | | khash: implement begin/end via functions instead of macrosPatrick Steinhardt2018-11-286-5/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, the `git_*map_begin()` and `git_*map_end()` helpers are implemented via macros which simply redirect to `kh_begin` and `kh_end`. As these macros refer to members of the map structures, they make it impossible to move the khash include into the implementation files. Implement these helpers as real functions instead to further decouple the headers from implementations.
| * | | | submodule: remove string map implementation that strips trailing slashesPatrick Steinhardt2018-11-281-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The submodule code currently has its own implementation of a string map, which overrides the hashing and hash equals functions with functions that ignore potential trailing slashes. These functions aren't actually used by our code, making them useless.
| * | | | idxmap: remove unused foreach macrosPatrick Steinhardt2018-11-281-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The foreach macros of the idxmap types are not used anywhere. As we are about to open-code all foreach macros for the maps in order to be able to make the khash structure internal, removing these unused macros will leave a few places less that need conversion.
| * | | | iterator: remove unused function `tree_iterator_entry_cmp`Patrick Steinhardt2018-11-281-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function `tree_iterator_entry_cmp` has been introduced in commit be30387e8 (iterators: refactored tree iterator, 2016-02-25), but in fact it has never been used at all. Remove it to avoid unused function warnings as soon as we re-enable "-Wunused-functions".
* | | | | Merge pull request #4870 from libgit2/ethomson/proxyEdward Thomson2018-11-2822-746/+956
|\ \ \ \ \ | | | | | | | | | | | | Add builtin proxy support for the http transport
| * | | | | http: reset replay_count upon connectionethomson/proxyEdward Thomson2018-11-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset the replay_count upon a successful connection. It's possible that we could encounter a situation where we connect successfully but need to replay a request - for example, a connection and initial request succeeds without authentication but a subsequent call does require authentication. Reset the replay count upon any successful request to afford subsequent replays room to manuever.
| * | | | | stream registration: take an enum typeEdward Thomson2018-11-284-20/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accept an enum (`git_stream_t`) during custom stream registration that indicates whether the registration structure should be used for standard (non-TLS) streams or TLS streams.
| * | | | | http: don't allow SSL connections to a proxyEdward Thomson2018-11-281-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Temporarily disallow SSL connections to a proxy until we can understand the valgrind warnings when tunneling OpenSSL over OpenSSL.
| * | | | | http: only load proxy configuration during connectionEdward Thomson2018-11-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only load the proxy configuration during connection; we need this data when we're going to connect to the server, however we may mutate it after connection (connecting through a CONNECT proxy means that we should send requests like normal). If we reload the proxy configuration but do not actually reconnect (because we're in a keep-alive session) then we will reload the proxy configuration that we should have mutated. Thus, only load the proxy configuration when we know that we're going to reconnect.
| * | | | | stream: provide generic registration APIEdward Thomson2018-11-286-73/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the new stream registration API to be `git_stream_register` which takes a registration structure and a TLS boolean. This allows callers to register non-TLS streams as well as TLS streams. Provide `git_stream_register_tls` that takes just the init callback for backward compatibliity.
| * | | | | http: disallow repeated headers from serversEdward Thomson2018-11-281-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't allow servers to send us multiple Content-Type, Content-Length or Location headers.
| * | | | | http: remove cURLEdward Thomson2018-11-289-466/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously used cURL to support HTTP proxies. Now that we've added this support natively, we can remove the curl dependency.
| * | | | | streams: remove unused tls functionsEdward Thomson2018-11-285-42/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementations of git_openssl_stream_new and git_mbedtls_stream_new have callers protected by #ifdefs and are never called unless compiled in. There's no need for a dummy implementation. Remove them.
| * | | | | http: use CONNECT to talk to proxiesEdward Thomson2018-11-281-13/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Natively support HTTPS connections through proxies by speaking CONNECT to the proxy and then adding a TLS connection on top of the socket.
| * | | | | tls: introduce a wrap functionEdward Thomson2018-11-2810-88/+297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce `git_tls_stream_wrap` which will take an existing `stream` with an already connected socket and begin speaking TLS on top of it. This is useful if you've built a connection to a proxy server and you wish to begin CONNECT over it to tunnel a TLS connection. Also update the pluggable TLS stream layer so that it can accept a registration structure that provides an `init` and `wrap` function, instead of a single initialization function.