src


Log

Author Commit Date CI Message
Carlos Martín Nieto 1db3035d 2016-11-15T12:18:49 Merge pull request #3996 from pks-t/pks/curl-lastsocket-deprecation curl_stream: use CURLINFO_ACTIVESOCKET if curl is recent enough
Patrick Steinhardt 5cbd5260 2016-11-11T11:37:00 curl_stream: use CURLINFO_ACTIVESOCKET if curl is recent enough The `CURLINFO_LASTSOCKET` information has been deprecated since curl version 7.45.0 as it may result in an overflow in the returned socket on certain systems, most importantly on 64 bit Windows. Instead, a new call `CURLINFO_ACTIVESOCKET` has been added which instead returns a `curl_socket_t`, which is always sufficiently long to store a socket. As we need to provide backwards compatibility with curl versions smaller than 7.45.0, alias CURLINFO_ACTIVESOCKET to CURLINFO_LASTSOCKET on platforms without CURLINFO_ACTIVESOCKET.
Edward Thomson 1d683c1d 2016-11-14T19:21:56 Merge pull request #4006 from libgit2/cmn/compress-buf-free Plug a leak in the refs compressor
Carlos Martín Nieto 21e0fc32 2016-11-14T17:55:49 Plug a leak in the refs compressor
Carlos Martín Nieto a39f18ac 2016-11-14T17:10:43 Merge pull request #3998 from pks-t/pks/repo-discovery Repository discovery starting from files
Edward Thomson df045cef 2016-11-14T12:12:38 Merge pull request #4003 from libgit2/cmn/tree-updater-ordering Use the sorted input in the tree updater
Carlos Martín Nieto 89776585 2016-11-14T12:44:52 tree: look for conflicts in the new tree when updating We look at whether we're trying to replace a blob with a tree during the update phase, but we fail to look at whether we've just inserted a blob where we're now trying to insert a tree. Update the check to look at both places. The test for this was previously succeeding due to the bu where we did not look at the sorted output.
Carlos Martín Nieto b85929c5 2016-11-14T12:44:01 tree: use the sorted update list in our loop The loop is made with the assumption that the inputs are sorted and not using it leads to bad outputs.
Carlos Martín Nieto ce5553d4 2016-03-10T22:01:09 refdb: bubble up locked files on the read side On Windows we can find locked files even when reading a reference or the packed-refs file. Bubble up the error in this case as well to allow callers on Windows to retry more intelligently.
Carlos Martín Nieto 33248b9e 2016-03-10T12:22:34 refdb: remove a check-delete race when removing a loose ref It does not help us to check whether the file exists before trying to unlink it since it might be gone by the time unlink is called. Instead try to remove it and handle the resulting error if it did not exist.
Carlos Martín Nieto 40ffa07f 2015-12-31T14:51:42 sortedcache: check file size after opening the file Checking the size before we open the file descriptor can lead to the file being replaced from under us when renames aren't quite atomic, so we can end up reading too little of the file, leading to us thinking the file is corrupted.
Carlos Martín Nieto 2e09106e 2015-12-24T17:49:49 refdb: bubble up the error code when compressing the db This allows the caller to know the errors was e.g. due to the packed-refs file being already locked and they can try again later.
Carlos Martín Nieto dd1ca6f1 2015-12-24T17:38:41 refdb: refactor the lockfile cleanup We can reduce the duplication by cleaning up at the beginning of the loop, since it's something we want to do every time we continue.
Carlos Martín Nieto 7ea4710a 2015-12-24T17:30:24 refdb: don't report failure for expected errors There might be a few threads or processes working with references concurrently, so fortify the code to ignore errors which come from concurrent access which do not stop us from continuing the work. This includes ignoring an unlinking error. Either someone else removed it or we leave the file around. In the former case the job is done, and in the latter case, the ref is still in a valid state.
Carlos Martín Nieto f94825c1 2015-12-24T17:21:51 fileops: save errno and report file existence We need to save the errno, lest we clobber it in the giterr_set() call. Also add code for reporting that a path component is missing, which is a distinct failure mode.
Carlos Martín Nieto 2d9aec99 2015-12-24T14:01:38 refdb: make ref deletion after pack safer In order not to undo concurrent modifications to references, we must make sure that we only delete a loose reference if it still has the same value as when we packed it. This means we need to lock it and then compare the value with the one we put in the packed file.
Carlos Martín Nieto 9914efec 2015-12-24T14:00:48 refdb: bubble up errors We can get useful information like GIT_ELOCKED out of this instead of just -1.
Patrick Steinhardt 0f316096 2016-11-11T16:55:33 repository: do not interpret all files as gitlinks in discovery When trying to find a discovery, we walk up the directory structure checking if there is a ".git" file or directory and, if so, check its validity. But in the case that we've got a ".git" file, we do not want to unconditionally assume that the file is in fact a ".git" file and treat it as such, as we would error out if it is not. Fix the issue by only treating a file as a gitlink file if it ends with "/.git". This allows users of the function to discover a repository by handing in any path contained inside of a git repository.
Carlos Martín Nieto e1c14335 2016-11-14T10:48:57 Merge pull request #4002 from pks-t/pks/giterr-format giterr format
Carlos Martín Nieto cc5966b0 2016-11-14T10:39:45 Merge pull request #3983 from pks-t/pks/smart-early-eof transports: smart: abort on early end of stream
Patrick Steinhardt b81fe7c9 2016-11-14T10:07:13 path: pass string instead of git_buf to giterr_set
Patrick Steinhardt 90a934a5 2016-11-14T10:06:17 checkout: pass string instead of git_buf to `giterr_set`
Patrick Steinhardt 901434b0 2016-11-14T10:07:37 common: cast precision specifiers to int
Patrick Steinhardt c77a55a9 2016-11-14T10:05:31 common: use PRIuZ for size_t in `giterr_set` calls
Patrick Steinhardt 8effd26f 2016-11-14T09:54:08 common: mark printf-style formatting for `giterr_set`
Patrick Steinhardt 2d205516 2016-11-14T09:38:44 Merge pull request #3992 from joshtriplett/env-namespace git_repository_open_ext: fix handling of $GIT_NAMESPACE
Patrick Steinhardt 7b3f49f0 2016-11-14T09:27:15 fileops: fix typos in `git_futils_creat_locked{,with_path}`
Josh Triplett c9e967a1 2016-11-10T03:51:12 git_repository_open_ext: fix handling of $GIT_NAMESPACE The existing code would set a namespace of "" (empty string) with GIT_NAMESPACE unset. In a repository where refs/heads/namespaces/ exists, that can produce incorrect results. Detect that case and avoid setting the namespace at all. Since that makes the last assignment to error conditional, and the previous assignment can potentially get GIT_ENOTFOUND, set error to 0 explicitly to prevent the call from incorrectly failing with GIT_ENOTFOUND.
Alex Crichton 5ca75fd5 2016-11-10T08:00:22 curl_stream: check for -1 after CURLINFO_LASTSOCKET We're recently trying to upgrade to the current master of libgit2 in Cargo but we're unfortunately hitting a segfault in one of our tests. This particular test is just a small smoke test that https works (e.g. it's configured in libgit2). It attempts to clone from a URL which simply immediately drops connections after they're accepted (e.g. terminate abnormally). We expect to see a standard error from libgit2 but unfortunately we're seeing a segfault. This segfault is happening inside of the `wait_for` function of `curl_stream.c` at the line `FD_SET(fd, &errfd)` because `fd` is -1. This ends up doing an out-of-bounds array access that faults the program. I tracked back to where this -1 came from to the line here (returned by `CURLINFO_LASTSOCKET`) and added a check to return an error.
Patrick Steinhardt 5fe5557e 2016-11-04T18:18:46 Merge pull request #3974 from libgit2/pks/synchronize-shutdown global: synchronize initialization and shutdown with pthreads
Patrick Steinhardt 6e2fab9e 2016-11-04T18:14:00 Merge pull request #3977 from jfultz/fix-forced-branch-creation-on-bare-repo
John Fultz f9793884 2016-10-28T14:32:01 branch: fix forced branch creation on HEAD of a bare repo The code correctly detects that forced creation of a branch on a nonbare repo should not be able to overwrite a branch which is the HEAD reference. But there's no reason to prevent this on a bare repo, and in fact, git allows this. I.e., git branch -f master new_sha works on a bare repo with HEAD set to master. This change fixes that problem, and updates tests so that, for this case, both the bare and nonbare cases are checked for correct behavior.
Carlos Martín Nieto 7175222c 2016-11-02T14:50:59 Merge pull request #3960 from ignatenkobrain/openssl-1.1.0 add support for OpenSSL 1.1.0 for BIO filter
Carlos Martín Nieto 3b832a08 2016-11-02T13:11:31 openssl: include OpenSSL headers only when we're buliding against it We need to include the initialisation and construction functions in all backend, so we include this header when building against SecureTransport and WinHTTP as well.
Carlos Martín Nieto 2f3adf95 2016-11-02T12:35:46 openssl: use ASN1_STRING_get0_data when compiling against 1.1 For older versions we can fall back on the deprecated ASN1_STRING_data.
Carlos Martín Nieto f15eedb3 2016-11-02T12:28:25 openssl: recreate the OpenSSL 1.1 BIO interface for older versions We want to program against the interface, so recreate it when we compile against pre-1.1 versions.
Patrick Steinhardt 0cf15e39 2016-11-02T12:23:12 pack: fix race in pack_entry_find_offset In `pack_entry_find_offset`, we try to find the offset of a certain object in the pack file. To do so, we first assert if the packfile has already been opened and open it if not. Opening the packfile is guarded with a mutex, so concurrent access to this is in fact safe. What is not thread-safe though is our calculation of offsets inside the packfile. Assume two threads calling `pack_entry_find_offset` at the same time. We first calculate the offset and index location and only then determine if the pack has already been opened. If so, we re-calculate the offset and index address. Now the case for two threads: thread 1 first calculates the addresses and is subsequently suspended. The second thread will now call `pack_index_open` and initialize the pack file, calculating its addresses correctly. When the first thread is resumed now, he'll see that the pack file has already been initialized and will happily proceed with the addresses it has already calculated before the check. As the pack file was not initialized before, these addresses are bogus. Fix the issue by only calculating the addresses after having checked if the pack file is open.
Patrick Steinhardt 62494bf2 2016-11-02T09:38:40 transports: smart: abort receiving packets on end of stream When trying to receive packets from the remote, we loop until either an error distinct to `GIT_EBUFS` occurs or until we successfully parsed the packet. This does not honor the case where we are looping over an already closed socket which has no more data, leaving us in an infinite loop if we got a bogus packet size or if the remote hang up. Fix the issue by returning `GIT_EEOF` when we cannot read data from the socket anymore.
Patrick Steinhardt 61530c49 2016-11-01T16:56:07 transports: smart: abort ref announcement on early end of stream When reading a server's reference announcements via the smart protocol, we expect the server to send multiple flushes before the protocol is finished. If we fail to receive new data from the socket, we will only return an end of stream error if we have not seen any flush yet. This logic is flawed in that we may run into an infinite loop when receiving a server's reference announcement with a bogus flush packet. E.g. assume the last flushing package is changed to not be '0000' but instead any other value. In this case, we will still await one more flush package and ignore the fact that we are not receiving any data from the socket, causing an infinite loop. Fix the issue by always returning `GIT_EEOF` if the socket indicates an end of stream.
Patrick Steinhardt 19001ca7 2016-11-02T09:23:53 Merge pull request #3976 from pks-t/pks/pqueue-null-deref pqueue: resolve possible NULL pointer dereference
Patrick Steinhardt 038f0e1b 2016-11-02T08:49:24 global: reset global state on shutdown without threading When threading is not enabled for libgit2, we keep global state in a simple static variable. When libgit2 is shut down, we clean up the global state by freeing the global state's dynamically allocated memory. When libgit2 is built with threading, we additionally free the thread-local storage and thus completely remove the global state. In a non-threaded build, though, we simply leave the global state as-is, which may result in an error upon reinitializing libgit2. Fix the issue by zeroing out the variable on a shutdown, thus returning it to its initial state.
Patrick Steinhardt 59c6c286 2016-10-27T12:31:17 global: synchronize initialization and shutdown with pthreads When trying to initialize and tear down global data structures from different threads at once with `git_libgit2_init` and `git_libgit2_shutdown`, we race around initializing data. While we use `pthread_once` to assert that we only initilize data a single time, we actually reset the `pthread_once_t` on the last call to `git_libgit2_shutdown`. As resetting this variable is not synchronized with other threads trying to access it, this is actually racy when one thread tries to do a complete shutdown of libgit2 while another thread tries to initialize it. Fix the issue by creating a mutex which synchronizes `init_once` and the library shutdown.
Patrick Steinhardt dc98cb28 2016-10-31T13:50:23 openssl_stream: fix typo
Patrick Steinhardt 95fa3880 2016-10-28T16:07:40 pqueue: resolve possible NULL pointer dereference The `git_pqueue` struct allows being fixed in its total number of entries. In this case, we simply throw away items that are inserted into the priority queue by examining wether the new item to be inserted has a higher priority than the previous smallest one. This feature somewhat contradicts our pqueue implementation in that it is allowed to not have a comparison function. In fact, we also fail to check if the comparison function is actually set in the case where we add a new item into a fully filled fixed-size pqueue. As we cannot determine which item is the smallest item in absence of a comparison function, we fix the `NULL` pointer dereference by simply dropping all new items which are about to be inserted into a full fixed-size pqueue.
Igor Gnatenko feb330d5 2016-10-12T12:41:36 add support for OpenSSL 1.1.0 for BIO filter Closes: https://github.com/libgit2/libgit2/issues/3959 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Edward Thomson 610cff13 2016-10-09T16:05:48 Merge branch 'pr/3809'
Sim Domingo dc5cfdba 2016-06-02T23:18:31 make git_diff_stats_to_buf not show 0 insertions or 0 deletions
Edward Thomson aae89534 2016-10-09T12:51:48 Merge pull request #3956 from pks-t/pks/object-parsing-hardening Object parsing hardening
Patrick Steinhardt a719ef5e 2016-10-07T09:31:41 commit: always initialize commit message When parsing a commit, we will treat all bytes left after parsing the headers as the commit message. When no bytes are left, we leave the commit's message uninitialized. While uncommon to have a commit without message, this is the right behavior as Git unfortunately allows for empty commit messages. Given that this scenario is so uncommon, most programs acting on the commit message will never check if the message is actually set, which may lead to errors. To work around the error and not lay the burden of checking for empty commit messages to the developer, initialize the commit message with an empty string when no commit message is given.
Edward Thomson 45dc219f 2016-10-07T16:01:28 Merge pull request #3921 from libgit2/cmn/walk-limit-enough Improve revision walk preparation logic
Patrick Steinhardt 4974e3a5 2016-10-07T09:18:55 tree: validate filename and OID length when parsing object When parsing tree entries from raw object data, we do not verify that the tree entry actually has a filename as well as a valid object ID. Fix this by asserting that the filename length is non-zero as well as asserting that there are at least `GIT_OID_RAWSZ` bytes left when parsing the OID.
Carlos Martín Nieto fedc05c8 2016-10-06T18:13:34 revwalk: don't show commits that become uninteresting after being enqueued When we read from the list which `limit_list()` gives us, we need to check that the commit is still interesting, as it might have become uninteresting after it was added to the list.
Arthur Schreiber ab96ca55 2016-10-06T13:15:31 Make sure we use the `C` locale for `regcomp` on macOS.
Carlos Martín Nieto 3cc5ec94 2016-10-05T12:57:53 rebase: don't ask for time sorting `git-rebase--merge` does not ask for time sorting, but uses the default. We now produce the same default time-ordered output as git, so make us of that since it's not always the same output as our time sorting.
Carlos Martín Nieto 82d4c0e6 2016-10-05T12:55:53 revwalk: update the description for the default sorting It changed from implementation-defined to git's default sorting, as there are systems (e.g. rebase) which depend on this order. Also specify more explicitly how you can get git's "date-order".
Carlos Martín Nieto ea1ceb7f 2016-10-05T12:23:26 revwalk: remove a useless enqueueing phase for topological and default sorting After `limit_list()` we already have the list in time-sorted order, which is what we want in the "default" case. Enqueueing into the "unsorted" list would just reverse it, and the topological sort will do its own sorting if it needs to.
Carlos Martín Nieto 9db367bf 2016-09-27T16:14:42 revwalk: get rid of obsolete marking code We've now moved to code that's closer to git and produces the output during the preparation phase, so we no longer process the commits as part of generating the output. This makes a chunk of code redundant, as we're simply short-circuiting it by detecting we've processed the commits alrady.
Carlos Martín Nieto e93b7e32 2016-09-27T13:35:48 revwalk: style change Change the condition for returning 0 more in line with that we write elsewhere in the library.
Carlos Martín Nieto 5e2a29a7 2016-09-27T13:11:47 commit_list: fix the date comparison function This returns the integer-cast truth value comparing the dates. What we want instead of a (-1, 0, 1) output depending on how they compare.
Carlos Martín Nieto 48c64362 2016-09-27T11:59:24 revwalk: port over the topological sorting After porting over the commit hiding and selection we were still left with mistmaching output due to the topologial sort. This ports the topological sorting code to make us match with our equivalent of `--date-order` and `--topo-order` against the output from `rev-list`.
Carlos Martín Nieto 938f8e32 2016-09-23T13:25:35 pqueue: support not having a comparison function In this case, we simply behave like a vector.
Carlos Martín Nieto 0bd43371 2016-09-23T12:42:33 vector, pqueue: add git_vector_reverse and git_pqueue_reverse This is a convenience function to reverse the contents of a vector and a pqueue in-place. The pqueue function is useful in the case where we're treating it as a LIFO queue.
Carlos Martín Nieto 6708618c 2016-07-21T01:24:12 revwalk: get closer to git We had some home-grown logic to figure out which objects to show during the revision walk, but it was rather inefficient, looking over the same list multiple times to figure out when we had run out of interesting commits. We now use the lists in a smarter way. We also introduce the slop mechanism to determine when to stpo looking. When we run out of interesting objects, we continue preparing the walk for another 5 rounds in order to make it less likely that we miss objects in situations with complex graphs.
Edward Thomson 9fbbb0ee 2016-10-01T19:32:16 Merge pull request #3931 from libgit2/ethomson/checkout_dont_calculate_oid_for_dirs checkout: don't try to calculate oid for directories
Edward Thomson 955c99c2 2016-09-14T10:28:24 checkout: don't try to calculate oid for directories When trying to determine if we can safely overwrite an existing workdir item, we may need to calculate the oid for the workdir item to determine if its identical to the old side (and eligible for removal). We previously did this regardless of the type of entry in the workdir; if it was a directory, we would open(2) it and then try to read(2). The read(2) of a directory fails on many platforms, so we would treat it as if it were unmodified and continue to perform the checkout. On FreeBSD, you _can_ read(2) a directory, so this pattern failed. We would calculate an oid from the data read and determine that the directory was modified and would therefore generate a checkout conflict. This reliance on read(2) is silly (and was most likely accidentally giving us the behavior we wanted), we should be explicit about the directory test.
Vicent Marti 2749ff46 2016-09-13T15:52:43 time: Export `git_time_monotonic`
Edward Thomson 9ad07fc0 2016-09-06T10:43:21 Merge pull request #3923 from libgit2/ethomson/diff-read-empty-binary Read binary patches (with no binary data)
Patrick Steinhardt 46035d98 2016-09-06T11:21:29 Merge pull request #3882 from pks-t/pks/fix-fetch-refspec-dst-parsing refspec: do not set empty rhs for fetch refspecs
Edward Thomson adedac5a 2016-09-02T02:03:45 diff: treat binary patches with no data special When creating and printing diffs, deal with binary deltas that have binary data specially, versus diffs that have a binary file but lack the actual binary data.
Edward Thomson f4e3dae7 2016-09-02T11:26:16 diff_print: change test for skipping binary printing Instead of skipping printing a binary diff when there is no data, skip printing when we have a status of `UNMODIFIED`. This is more in-line with our internal data model and allows us to expand the notion of binary data. In the future, there may have no data because the files were unmodified (there was no data to produce) or it may have no data because there was no data given to us in a patch. We want to treat these cases separately.
Edward Thomson 4bfd7c63 2016-09-01T16:55:27 patch: error on diff callback failure
Patrick Steinhardt 4b34f687 2016-09-01T15:14:25 patch_generate: only calculate binary diffs if requested When generating diffs for binary files, we load and decompress the blobs in order to generate the actual diff, which can be very costly. While we cannot avoid this for the case when we are called with the `GIT_DIFF_SHOW_BINARY` flag, we do not have to load the blobs in the case where this flag is not set, as the caller is expected to have no interest in the actual content of binary files. Fix the issue by only generating a binary diff when the caller is actually interested in the diff. As libgit2 uses heuristics to determine that a blob contains binary data by inspecting its size without loading from the ODB, this saves us quite some time when diffing in a repository with binary files.
Stefan Huber 88cfe614 2016-08-24T01:20:39 git_checkout_tree options fix According to the reference the git_checkout_tree and git_checkout_head functions should accept NULL in the opts field This was broken since the opts field was dereferenced and thus lead to a crash.
Patrick Steinhardt ace0d36b 2016-08-29T09:29:34 Merge pull request #3900 from pks-t/pks/http-close-substream-on-connect transports: http: set substream as disconnected after closing
Edward Thomson b859faa6 2016-08-23T23:38:39 Teach `git_patch_from_diff` about parsed diffs Ensure that `git_patch_from_diff` can return the patch for parsed diffs, not just generate a patch for a generated diff.
Jason Haslam 7a3f1de5 2016-08-22T09:27:47 filesystem_iterator: fixed double free on error
Edward Thomson c1b370e9 2016-08-17T09:24:44 Merge pull request #3837 from novalis/dturner/indexv4 Support index v4
Edward Thomson 635a9222 2016-08-17T08:54:48 Merge pull request #3895 from pks-t/pks/negate-basename-in-subdirs ignore: allow unignoring basenames in subdirectories
Patrick Steinhardt b1453601 2016-08-17T11:38:26 transports: http: reset `connected` flag when closing transport
Patrick Steinhardt c4cba4e9 2016-08-17T11:00:05 transports: http: reset `connected` flag when re-connecting transport When calling `http_connect` on a subtransport whose stream is already connected, we first close the stream in case no keep-alive is in use. When doing so, we do not reset the transport's connection state, though. Usually, this will do no harm in case the subsequent connect will succeed. But when the connection fails we are left with a substransport which is tagged as connected but which has no valid stream attached. Fix the issue by resetting the subtransport's connected-state when closing its stream in `http_connect`.
Patrick Steinhardt fcb2c1c8 2016-08-12T09:06:15 ignore: allow unignoring basenames in subdirectories The .gitignore file allows for patterns which unignore previous ignore patterns. When unignoring a previous pattern, there are basically three cases how this is matched when no globbing is used: 1. when a previous file has been ignored, it can be unignored by using its exact name, e.g. foo/bar !foo/bar 2. when a file in a subdirectory has been ignored, it can be unignored by using its basename, e.g. foo/bar !bar 3. when all files with a basename are ignored, a specific file can be unignored again by specifying its path in a subdirectory, e.g. bar !foo/bar The first problem in libgit2 is that we did not correctly treat the second case. While we verified that the negative pattern matches the tail of the positive one, we did not verify if it only matches the basename of the positive pattern. So e.g. we would have also negated a pattern like foo/fruz_bar !bar Furthermore, we did not check for the third case, where a basename is being unignored in a certain subdirectory again. Both issues are fixed with this commit.
David Turner 5625d86b 2016-05-17T15:40:32 index: support index v4 Support reading and writing index v4. Index v4 uses a very simple compression scheme for pathnames, but is otherwise similar to index v3. Signed-off-by: David Turner <dturner@twitter.com>
David Turner aeb5ee5a 2016-05-17T15:40:46 varint: Add varint encoding/decoding This code is ported from git.git Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: David Turner <dturner@twopensource.com>
Patrick Steinhardt b9895144 2016-08-08T14:47:32 stransport: do not use `git_stream_free` on uninitialized stransport When failing to initialize a new stransport stream, we try to release already allocated memory by calling out to `git_stream_free`, which in turn called out to the stream's `free` function pointer. As we only initialize the function pointer later on, this leads to a `NULL` pointer exception. Furthermore, plug another memory leak when failing to create the SSL context.
Carlos Martín Nieto 97e57e87 2016-08-08T15:13:59 Merge pull request #3887 from libgit2/ethomson/empty_blob odb: only provide the empty tree
Edward Thomson b47e79e2 2016-08-08T08:42:32 Merge pull request #3890 from pks-t/pks/stransport-static-linkage stransport: make internal functions static
Patrick Steinhardt 067bf5dc 2016-08-08T13:49:17 stransport: make internal functions static
Edward Thomson becadafc 2016-08-05T19:30:56 odb: only provide the empty tree Only provide the empty tree internally, which matches git's behavior. If we provide the empty blob then any users trying to write it with libgit2 would omit it from actually landing in the odb, which appear to git proper as a broken repository (missing that object).
Carlos Martín Nieto 9884dd61 2016-08-05T18:40:37 SecureTransport: handle NULL trust on success The `SSLCopyPeerTrust` call can succeed but fail to return a trust object if it can't load the certificate chain and thus cannot check the validity of a certificate. This can lead to us calling `CFRelease` on a `NULL` trust object, causing a crash. Handle this by returning ECERTIFICATE.
Patrick Steinhardt 274a727e 2016-08-05T10:57:42 apply: fix warning when initializing patch images
Patrick Steinhardt 844f5b20 2016-08-05T10:57:13 pool: provide macro to statically initialize git_pool
Edward Thomson 27051d4e 2016-07-22T13:34:19 odb: only freshen pack files every 2 seconds Since writing multiple objects may all already exist in a single packfile, avoid freshening that packfile repeatedly in a tight loop. Instead, only freshen pack files every 2 seconds.
Edward Thomson 8f09a98e 2016-07-14T16:23:24 odb: freshen existing objects when writing When writing an object, we calculate its OID and see if it exists in the object database. If it does, we need to freshen the file that contains it.
Carlos Martín Nieto d2794b0e 2016-08-04T20:49:50 Merge pull request #3877 from libgit2/ethomson/paths_init sysdir: don't assume an empty dir is uninitialized
Edward Thomson 0d84de02 2016-08-04T13:20:49 Merge pull request #3869 from richardipsum/fix-outdated-comment Fix outdated comment
Edward Thomson 78b500bf 2016-08-04T12:45:19 Merge pull request #3850 from wildart/custom-tls Enable https transport for custom TLS streams
Edward Thomson 031d34b7 2016-07-29T12:59:42 sysdir: use the standard `init` pattern Don't try to determine when sysdirs are uninitialized. Instead, simply initialize them all at `git_libgit2_init` time and never try to reinitialize, except when consumers explicitly call `git_sysdir_set`. Looking at the buffer length is especially problematic, since there may no appropriate path for that value. (For example, the Windows-specific programdata directory has no value on non-Windows machines.) Previously we would continually trying to re-lookup these values, which could get racy if two different threads are each calling `git_sysdir_get` and trying to lookup / clear the value simultaneously.
Edward Thomson da7f9feb 2016-08-04T11:51:06 Merge pull request #3879 from libgit2/ethomson/mwindow_init mwindow: init mwindow files in git_libgit2_init
Edward Thomson 2381d9e4 2016-08-03T17:01:48 mwindow: init mwindow files in git_libgit2_init
Patrick Steinhardt 1eee631d 2016-08-04T13:45:28 refspec: do not set empty rhs for fetch refspecs According to git-fetch(1), "[t]he colon can be omitted when <dst> is empty." So according to git, the refspec "refs/heads/master" is the same as the refspec "refs/heads/master:" when fetching changes. When trying to fetch from a remote with a trailing colon with libgit2, though, the fetch actually fails while it works when the trailing colon is left out. So obviously, libgit2 does _not_ treat these two refspec formats the same for fetches. The problem results from parsing refspecs, where the resulting refspec has its destination set to an empty string in the case of a trailing colon and to a `NULL` pointer in the case of no trailing colon. When passing this to our DWIM machinery, the empty string gets translated to "refs/heads/", which is simply wrong. Fix the problem by having the parsing machinery treat both cases the same for fetch refspecs.