src


Log

Author Commit Date CI Message
Carlos Martín Nieto 77965c68 2016-04-11T17:43:07 refs: provide a more general error message for dwim If we cannot dwim the input, set the error message to be explicit about that. Otherwise we leave the error for the last failed lookup, which can be rather unexpected as it mentions a remote when the user thought they were trying to look up a branch.
Carlos Martín Nieto 381caf56 2016-04-02T22:19:42 Merge pull request #3724 from ethomson/submodule_start_supports_silly_slashes iterator/diff: allow trailing `/` on start/end paths to match submodules
Edward Thomson d47f7e1c 2016-04-02T13:03:09 iterator: support trailing `/` in start for submod Allow callers to specify a start path with a trailing slash to match a submodule, instead of just a directory. This is for some legacy behavior that's sort of dumb, but there it is.
Carlos Martín Nieto d364dc8b 2016-04-01T14:33:42 ignore: don't use realpath to canonicalize path If we're looking for a symlink, realpath will give us the resolved path, which is not what we're after, but a canonicalized version of the path the user asked for.
Carlos Martín Nieto 36fc2557 2016-04-01T04:09:50 Merge pull request #3720 from pks-t/pks/merge-driver-memleaks merge_driver: fix missing `goto done;`
Patrick Steinhardt 83c93a7c 2016-04-01T09:37:55 merge_driver: fix missing `goto done;` The code initializing the merge driver registry accidentally forgot a `goto done` in case of an error. Because of this the next line, which registers the global shutdown callback for the merge drivers, is only called when an error occured. Fix this by adding the missing `goto done`. This fixes some memory leaks when the global state is shut down.
Carlos Martín Nieto 1cac688d 2016-04-01T00:29:51 Merge pull request #3719 from libgit2/ethomson/submodule_status WD iterator: properly identify submodules
Edward Thomson 4df6ddaa 2016-03-31T15:05:34 iterator: use correct search function
Edward Thomson c4aa5c04 2016-03-31T10:43:57 leaks: call `xdl_free_classifier`
Edward Thomson 97054833 2016-03-30T17:41:08 leaks: fix some iterator leaks
Carlos Martín Nieto f5c874a4 2016-03-29T14:47:31 Plug a few leaks
Carlos Martín Nieto d53cc13e 2016-03-31T04:12:46 Merge pull request #3575 from pmq20/master-13jan16 Remove duplicated calls to git_mwindow_close
Patrick Steinhardt 6045afd3 2016-03-31T11:32:36 xdiff/xprepare: fix a memory leak The xdl_prepare_env() function may initialise an xdlclassifier_t data structure via xdl_init_classifier(), which allocates memory to several fields, for example 'rchash', 'rcrecs' and 'ncha'. If this function later exits due to the failure of xdl_optimize_ctxs(), then this xdlclassifier_t structure, and the memory allocated to it, is not cleaned up. In order to fix the memory leak, insert a call to xdl_free_classifier() before returning. This patch was originally written by Ramsay Jones (see commit 87f16258367a3b9a62663b11f898a4a6f3c19d31 in git.git).
Patrick Steinhardt 1bce1487 2016-03-31T11:30:31 xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits Commit 307ab20b3 ("xdiff: PATIENCE/HISTOGRAM are not independent option bits", 19-02-2012) introduced the XDF_DIFF_ALG() macro to access the flag bits used to represent the diff algorithm requested. In addition, code which had used explicit manipulation of the flag bits was changed to use the macros. However, one example of direct manipulation remains. Update this code to use the XDF_DIFF_ALG() macro. This patch was originally written by Ramsay Jones (see commit 5cd6978a9cfef58de061a9525f3678ade479564d in git.git).
Carlos Martín Nieto 2f0450f4 2016-03-29T03:26:43 Merge pull request #3712 from ethomson/config_duplicate_section config: don't write duplicate section
Edward Thomson b085ecbe 2016-03-28T13:51:21 Merge pull request #3703 from libgit2/cmn/multivar-set-locked config: don't special-case multivars that don't exist yet
Edward Thomson e25e1ca1 2016-03-28T11:13:51 config: don't write section header if we're in it If we hit the EOF while trying to write a new value, it may be that we're already in the section that we were looking for. If so, do not write a (duplicate) section header, just write the value.
Carlos Martín Nieto 7b29be31 2016-03-26T05:39:07 Merge pull request #3691 from ethomson/iterators Some FANTASTIC iterator refactoring
Marc Strapetz d6713ec6 2016-03-22T10:30:07 iterator: comment fixed
Marc Strapetz f4777058 2016-03-22T10:29:41 iterator: unused includes removed
Edward Thomson 9eb9e5fa 2016-03-21T17:19:24 iterator: cleanups Remove some unused functions, refactor some ugliness.
Edward Thomson 35877463 2016-03-21T17:03:00 iterator: refactor empty iterator to new style
Edward Thomson 247e3b43 2016-03-21T16:51:45 iterator: mandate `advance_over` Since the three iterators implement `advance_over` differently, mandate it and implement each.
Edward Thomson 0ef0b71c 2016-03-21T12:54:47 iterator: refactor index iterator
Edward Thomson ba6f86eb 2016-03-18T17:33:46 Introduce `git_path_common_dirlen`
Edward Thomson 82a1aab6 2016-03-18T12:59:35 iterator: move the index into the iterator itself
Carlos Martín Nieto d4763c98 2016-03-24T06:56:25 Merge pull request #3574 from chescock/buffer-sideband-pack-data Buffer sideband packet data
Edward Thomson 67885532 2016-03-17T15:29:21 diff: stop processing nitem when its removed When a directory is removed out from underneath us, stop trying to manipulate it.
Edward Thomson 0a2e1032 2016-03-17T15:19:45 iterator: drop `advance_into_or_over` Now that iterators do not return `GIT_ENOTFOUND` when advancing into an empty directory, we do not need a special `advance_into_or_over` function.
Edward Thomson 4c88198a 2016-03-16T10:17:20 iterator: test that we're at the end of iteration Ensure that we have hit the end of iteration; previously we tested that we saw all the values that we expected to see. We did not then ensure that we were at the end of the iteration (and that there were subsequently values in the iteration that we did *not* expect.)
Edward Thomson 0e0589fc 2016-03-10T00:04:26 iterator: combine fs+workdir iterators more completely Drop some of the layers of indirection between the workdir and the filesystem iterators. This makes the code a little bit easier to follow, and reduces the number of unnecessary allocations a bit as well. (Prior to this, when we filter entries, we would allocate them, filter them and then free them; now we do the filtering before allocation.) Also, rename `git_iterator_advance_over_with_status` to just `git_iterator_advance_over`. Mostly because it's a fucking long-ass function name otherwise.
Edward Thomson 702b23d7 2016-03-11T11:27:58 checkout: provide internal func to compute target path Many code paths in checkout need the final, full on-disk path of the file they're writing. (No surprise). However, they all munge the `data->path` buffer themselves to get there. Provide a nice helper method for them. Plus, drop the use `git_iterator_current_workdir_path` which does the same thing but different. Checkout is the only caller of this silly function, which lets us remove it.
Edward Thomson be30387e 2016-02-25T16:05:18 iterators: refactored tree iterator Refactored the tree iterator to never recurse; simply process the next entry in order in `advance`. Additionally, reduce the number of allocations and sorting as much as possible to provide a ~30% speedup on case-sensitive iteration. (The gains for case-insensitive iteration are less majestic.)
Edward Thomson f0224772 2016-02-17T18:04:19 git_object_dup: introduce typesafe versions
Edward Thomson 684b35c4 2016-02-25T15:11:14 iterator: disambiguate reset and reset_range Disambiguate the reset and reset_range functions. Now reset_range with a NULL path will clear the start or end; reset will leave the existing start and end unchanged.
Edward Thomson ac05086c 2016-02-25T14:51:23 iterator: drop unused/unimplemented `seek`
Carlos Martín Nieto 1a2d8bd3 2016-03-23T16:51:52 array: fix search for empty arrays When the array is empty `cmp` never gets set by the comparison function. Initialize it so we return ENOTFOUND in those cases.
Carlos Martín Nieto 661db4f4 2016-03-23T03:45:53 Merge pull request #3704 from ethomson/tree-reuse tree: drop the now-unnecessary entries vector
Carlos Martín Nieto 6669e3e8 2015-11-08T04:28:08 blob: remove _fromchunks() The callback mechanism makes it awkward to write data from an IO source; move to `_fromstream()` which lets the caller remain in control, in the same vein as we prefer iterators over foreach callbacks.
Carlos Martín Nieto 0a5c6028 2015-11-04T10:30:48 blob: introduce creating a blob by writing into a stream The pair of `git_blob_create_frombuffer()` and `git_blob_create_frombuffer_commit()` is meant to replace `git_blob_create_fromchunks()` by providing a way for a user to write a new blob when they want filtering or they do not know the size. This approach allows the caller to retain control over when to add data to this buffer and a more natural fit into higher-level language's own stream abstractions instead of having to handle IO wait in the callback. The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a round multiple of usual page sizes and a value where most blobs seem likely to be either going to be way below or way over that size. It's also a round number of pages. This implementation re-uses the helper we have from `_fromchunks()` so we end up writing everything to disk, but hopefully more efficiently than with a default filebuf. A later optimisation can be to avoid writing the in-memory contents to disk, with some extra complexity.
Carlos Martín Nieto 3fa764ed 2015-11-04T09:20:14 filebuf: allow using a custom buffer size Allow setting the buffer size on open in order to use this data structure more generally as a spill buffer, with larger buffer sizes for specific use-cases.
Edward Thomson e2e4bae9 2016-03-22T00:18:44 tree: drop the now-unnecessary entries vector Remove the now-unnecessary entries vector. Add `git_array_search` to binary search through an array to accomplish this.
Carlos Martín Nieto e50a49ee 2016-03-22T01:54:49 Merge pull request #3559 from yongthecoder/master Add a sanity check in git_indexer_commit to avoid subtraction overflow.
Carlos Martín Nieto 6f09911c 2016-03-21T21:10:26 config: don't special-case multivars that don't exist yet This special-casing ignores that we might have a locked file, so the hashtable does not represent the contents of the file we want to write. This causes multivar writes to overwrite entries instead of add to them when under lock. There is no need for this as the normal code-path will write to the file just fine, so simply get rid of it.
Carlos Martín Nieto 4ed9e939 2016-03-20T12:01:45 tree: store the entries in a growable array Take advantage of the constant size of tree-owned arrays and store them in an array instead of a pool. This still lets us free them all at once but lets the system allocator do the work of fitting them in.
Carlos Martín Nieto 60a194aa 2016-03-20T11:00:12 tree: re-use the id and filename in the odb object Instead of copying over the data into the individual entries, point to the originals, which are already in a format we can use.
Carlos Martin Nieto a177756b 2016-03-18T13:00:27 win32: free thread-local data on thread exit
Edward Thomson ec5a43b6 2016-03-18T06:37:41 Merge pull request #3699 from libgit2/cmn/win32-free-tls win32: free thread-local data on thread exit
Edward Thomson d953c450 2016-02-28T21:30:00 merge drivers: handle configured but not found driver
Edward Thomson 6d8b2cdb 2016-02-28T09:34:11 merge driver: remove `check` callback Since the `apply` callback can defer, the `check` callback is not necessary. Removing the `check` callback further makes the `payload` unnecessary along with the `cleanup` callback.
Edward Thomson 967e073d 2016-02-27T16:42:02 merge driver: correct global initialization
Edward Thomson 7a3ab14f 2016-02-07T15:58:34 merge driver: get a pointer to favor
Edward Thomson 46625836 2016-02-07T15:19:43 merge driver: correct indentation
Edward Thomson 30a94ab7 2015-12-24T22:52:23 merge driver: allow custom default driver Allow merge users to configure a custom default merge driver via `git_merge_options`. Similarly, honor the `merge.default` configuration option.
Edward Thomson 3f04219f 2015-12-23T10:23:08 merge driver: introduce custom merge drivers Consumers can now register custom merged drivers with `git_merge_driver_register`. This allows consumers to support the merge drivers, as configured in `.gitattributes`. Consumers will be asked to perform the file-level merge when a custom driver is configured.
Stan Hu 7a74590d 2015-12-03T09:57:56 Fix rebase bug and include test for merge=union
Stan Hu f8787098 2015-10-31T18:50:13 Support union merges via .gitattributes file
Edward Thomson ba349322 2016-03-17T06:57:56 Merge pull request #3673 from libgit2/cmn/commit-with-signature commit: add function to attach a signature to a commit
Carlos Martín Nieto bf804d40 2016-03-17T10:45:22 commit: fix extraction of single-line signatures The function to extract signatures suffers from a similar bug to the header field finding one by having an unecessary line feed check as a break condition of its loop. Fix that and add a test for this single-line signature situation.
Carlos Martín Nieto 87c18197 2016-03-16T19:05:11 Split the page size from the mmap alignment While often similar, these are not the same on Windows. We want to use the page size on Windows for the pools, but for mmap we need to use the allocation granularity as the alignment. On the other platforms these values remain the same.
Carlos Martín Nieto 02d61a3b 2016-03-10T10:53:20 commit: add function to attach a signature to a commit In combination with the function which creates a commit into a buffer, this allows us to more easily create signed commits.
Carlos Martín Nieto 77394a27 2016-03-14T19:15:20 Merge pull request #3677 from pks-t/pks/coverity-fixes-round7 Coverity fixes round 7
Carlos Martín Nieto 4848dd32 2016-03-14T17:45:15 Merge pull request #3647 from pks-t/pks/coverity-fixes-round6 Coverity fixes round 6
Dirkjan Bussink 8f4cbc76 2016-03-14T12:41:12 Start error string with lower case character
Dirkjan Bussink fa72d6da 2016-03-14T12:02:00 Setup better defaults for OpenSSL ciphers This ensures that when using OpenSSL a safe default set of ciphers is selected. This is done so that the client communicates securely and we don't accidentally enable unsafe ciphers like RC4, or even worse some old export ciphers. Implements the first part of https://github.com/libgit2/libgit2/issues/3682
Patrick Steinhardt 13c371dc 2016-03-10T17:21:02 config_cache: check return value of `git_config__lookup_entry` Callers of `git_config__cvar` already handle the case where the function returns an error due to a failed configuration variable lookup, but we are actually swallowing errors when calling `git_config__lookup_entry` inside of the function. Fix this by returning early when `git_config__lookup_entry` returns an error. As we call `git_config__lookup_entry` with `no_errors == false` which leads us to call `get_entry` with `GET_NO_MISSING` we will not return early when the lookup fails due to a missing entry. Like this we are still able to set the default value of the cvar and exit successfully.
Patrick Steinhardt 6ff8a7c4 2016-03-10T17:05:30 filebuf: handle write error in `lock_file` When writing to a file with locking not check if writing the locked file actually succeeds. Fix the issue by returning error code and message when writing fails.
Patrick Steinhardt 836447e5 2016-03-10T16:52:09 config_file: handle error when trying to lock strmap Accessing the current values map is handled through the `refcounder_strmap_take` function, which first acquires a mutex before accessing its values. While this assures everybody is trying to access the values with the mutex only we do not check if the locking actually succeeds. Fix the issue by checking if acquiring the lock succeeds and returning `NULL` if we encounter an error. Adjust callers.
Patrick Steinhardt e850e98d 2016-03-10T16:42:55 blame: handle error when resoling HEAD in normalize_options When normalizing options we try to look up HEAD's OID. While this action may fail in malformed repositories we never check the return value of the function. Fix the issue by converting `normalize_options` to actually return an error and handle the error in `git_blame_file`.
Patrick Steinhardt 8a4a343a 2016-03-10T16:33:49 blame_git: handle error returned by `git_commit_parent`
Patrick Steinhardt b27ccad2 2016-03-10T16:11:51 refdb_fs: fail if refcache returns NULL pointer We usually check entries returned by `git_sortedcache_entry` for NULL pointers. As we have a write lock in `packed_write`, though, it really should not happen that the function returns NULL. Assert that ref is not NULL to silence a Coverity warning.
Patrick Steinhardt 1a8c11f4 2016-03-10T10:40:47 diff_tform: fix potential NULL pointer access When the user passes in a diff which has no repository associated we may call `git_config__get_int_force` with a NULL-pointer configuration. Even though `git_config__get_int_force` is designed to swallow errors, it is not intended to be called with a NULL pointer configuration. Fix the issue by only calling `git_config__get_int_force` only when configuration could be retrieved from the repository.
Patrick Steinhardt 486302d6 2016-03-01T19:11:33 submodule: avoid passing NULL pointers to strncmp In C89 it is undefined behavior to pass `NULL` pointers to `strncmp` and later on in C99 it has been explicitly stated that functions with an argument declared as `size_t nmemb` specifying the array length shall always have valid parameters, no matter if `nmemb` is 0 or not (see ISO 9899 §7.21.1.2). The function `str_equal_no_trailing_slash` always passes its parameters to `strncmp` if their lengths match. This means if one parameter is `NULL` and the other one either `NULL` or a string with length 0 we will pass the pointers to `strncmp` and cause undefined behavior. Fix this by explicitly handling the case when both lengths are 0.
Patrick Steinhardt 3fe5768b 2016-03-01T17:55:40 pack-objects: fix memory leak on overflow
Patrick Steinhardt 80a834a5 2016-03-01T16:00:49 index: assert required OID are non-NULL
Patrick Steinhardt 61d7328d 2016-03-01T15:35:45 object: avoid call of memset with ouf of bounds pointer When computing a short OID we do this by first copying the leading parts into the new OID structure and then setting the trailing part to zero. In the case of the desired length being `GIT_OID_HEXSZ - 1` we will call `memset` with an out of bounds pointer and a length of 0. While this seems to cause no problems for common platforms the C89 standard does not explicitly state that calling `memset` with an out of bounds pointer and length of 0 is valid. Fix the potential issue by using the newly introduced `git_oid__cpy_prefix` function.
Patrick Steinhardt e126bc95 2016-03-01T14:40:17 config_file: handle missing quotation marks in section header When parsing a section header we expect something along the format of '[section "subsection"]'. When a section is mal-formated and is entirely missing its quotation marks we catch this case by observing that `strchr(line, '"') - strrchr(line, '"') = NULL - NULL = 0` and error out. Unfortunately, the error message is misleading though, as we state that we are missing the closing quotation mark while we in fact miss both quotation marks. Improve the error message by explicitly checking if the first quotation mark could be found and, if not, stating that quotation marks are completely missing.
Patrick Steinhardt 345758ad 2016-03-01T14:24:09 describe: handle error code returned by git_pqueue_insert
Edward Thomson 997c67da 2016-03-09T18:12:34 Merge pull request #3670 from libgit2/vmg/expand-fixes Fixes for `gid_odb_expand_ids`
Vicent Marti 1bbcb2b2 2016-03-09T17:47:53 odb: Try to lookup headers in all backends before passthrough
Vicent Marti e78d2ac9 2016-03-09T16:41:08 odb: Refactor `git_odb_expand_ids`
Vicent Marti 4416aa77 2016-03-09T11:29:46 odb: Implement new helper to read types without refreshing
Carlos Martín Nieto d50fd571 2016-03-09T11:16:16 mwindow: free unused windows if we fail to mmap The first time may be due to memory fragmentation or just bad luck on a 32-bit system. When we hit the mmap error for the first time, free up the unused windows and try again.
Vicent Marti 9a786650 2016-03-09T11:00:27 odb: Handle corner cases in `git_odb_expand_ids` The old implementation had two issues: 1. OIDs that were too short as to be ambiguous were not being handled properly. 2. If the last OID to expand in the array was missing from the ODB, we would leak a `GIT_ENOTFOUND` error code from the function.
Vicent Marti c68044a8 2016-03-08T21:17:38 Merge pull request #3656 from ethomson/exists_prefixes Introduce `git_odb_expand_ids`
Edward Thomson 62484f52 2016-03-08T14:09:55 git_odb_expand_ids: accept git_odb_expand_id array Take (and write to) an array of a struct, `git_odb_expand_id`.
Edward Thomson 4b1f0f79 2016-03-08T11:44:21 git_odb_expand_ids: rename func, return the type
Chris Hescock 9028a8a2 2016-03-08T10:16:37 Only buffer if necessary.
Edward Thomson b7809b84 2016-03-08T13:38:55 Merge pull request #3555 from cbargren/ssh-git-protocols Support for ssh+git and git+ssh protocols
Carlos Martín Nieto 47cb42da 2016-03-03T22:56:02 commit: split creating the commit and writing it out Sometimes you want to create a commit but not write it out to the objectdb immediately. For these cases, provide a new function to retrieve the buffer instead of having to go through the db.
Edward Thomson 6c04269c 2016-03-04T00:50:35 git_odb_exists_many_prefixes: query odb for multiple short ids Query the object database for multiple objects at a time, given their object ID (which may be abbreviated) and optional type.
Edward Thomson e10144ae 2016-03-04T01:18:30 odb: improved not found error messages When looking up an abbreviated oid, show the actual (abbreviated) oid the caller passed instead of a full (but ambiguously truncated) oid.
Carlos Martín Nieto ea5bf6bb 2016-03-04T12:34:38 treebuilder: don't try to verify submodules exist in the odb Submodules don't exist in the objectdb and the code is making us try to look for a blob with its commit id, which is obviously not going to work. Skip the test if the user wants to insert a submodule.
Carlos Martín Nieto 22f3d3aa 2016-03-03T22:26:31 ssh: initialize libssh2 We should have been doing this, but it initializes itself upon first use, which works as long as nobody's doing concurrent network operations. Initialize it on our init to make sure it's not getting initialized concurrently.
Carlos Martín Nieto 66a530eb 2016-03-03T20:11:18 Merge pull request #3648 from libgit2/cmn/auth-retry test: make sure we retry the auth callback on all platforms
Carlos Martín Nieto 778fb695 2016-03-03T12:14:02 Merge pull request #3646 from pks-t/pks/xdiff-fix-from-upstream xdiff: fix memleak on error case
Carlos Martín Nieto a4cba9d4 2016-03-03T10:48:24 winhttp: retry authentication If the caller has provided bad authentication, give them another apportunity to get it right until they give up. This brings WinHTTP in line with the other transports.
Edward Thomson edaffe22 2016-03-01T17:16:27 Merge pull request #3633 from ethomson/safe_creation Stricter object dependency checking during creation
Patrick Steinhardt a4ea7faa 2016-03-01T08:54:00 xdiff: fix memleak on error case Commit 3d1abc5afce fixes a memory leak in the xdiff code. In the process of upstreaming the fix it was pointed out by Johannes Schindelin that there is another memory leak present (see [1]). Fix the second memory leak by applying the upstream fix to our code base. [1]: http://thread.gmane.org/gmane.comp.version-control.git/287034
Edward Thomson dbee6835 2016-02-28T20:13:24 Merge pull request #3567 from sba1/few-p_getaddrinfo-fixes Few p_getaddrinfo fixes