summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Introduce a function to create a tree based on a different onecmn/tree-updateCarlos Martín Nieto2016-05-173-0/+458
| | | | | | | | | | | Instead of going through the usual steps of reading a tree recursively into an index, modifying it and writing it back out as a tree, introduce a function to perform simple updates more efficiently. `git_tree_create_updated` avoids reading trees which are not modified and supports upsert and delete operations. It is not as versatile as modifying the index, but it makes some common operations much more efficient.
* Merge pull request #3767 from pks-t/pks/misc-fixesEdward Thomson2016-05-096-23/+21
|\ | | | | Misc fixes
| * diff: simplify code for handling empty dirsPatrick Steinhardt2016-05-031-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When determining diffs between two iterators we may need to recurse into an unmatched directory for the "new" iterator when it is either a prefix to the current item of the "old" iterator or when untracked/ignored changes are requested by the user and the directory is untracked/ignored. When advancing into the directory and no files are found, we will get back `GIT_ENOTFOUND`. If so, we simply skip the directory, handling resulting unmatched old items in the next iteration. The other case of `iterator_advance_into` returning either `GIT_NOERROR` or any other error but `GIT_ENOTFOUND` will be handled by the caller, which will now either compare the first directory entry of the "new" iterator in case of `GIT_ENOERROR` or abort on other cases. Improve readability of the code to make the above logic more clear.
| * delta-apply: fix sign extensionPatrick Steinhardt2016-05-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We compute offsets by executing `off |= (*delta++ << 24)` for multiple constants, where `off` is of type `size_t` and `delta` is of type `unsigned char`. The usual arithmetic conversions (see ISO C89 §3.2.1.5 "Usual arithmetic conversions") kick in here, causing us to promote both operands to `int` and then extending the result to an `unsigned long` when OR'ing it with `off`. The integer promotion to `int` may result in wrong size calculations for big values. Fix the issue by making the constants `unsigned long`, causing both operands to be promoted to `unsigned long`.
| * odb_loose: fix undefined behavior when computing sizePatrick Steinhardt2016-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An object's size is computed by reading the object header's size field until the most significant bit is not set anymore. To get the total size, we increase the shift on each iteration and add the shifted value to the total size. We read the current value into a variable of type `unsigned char`, from which we then take all bits except the most significant bit and shift the result. We will end up with a maximum shift of 60, but this exceeds the width of the value's type, resulting in undefined behavior. Fix the issue by instead reading the values into a variable of type `unsigned long`, which matches the required width. This is equivalent to git.git, which uses an `unsigned long` as well.
| * checkout: set ignorecase=0 when config lookup failsPatrick Steinhardt2016-05-021-2/+4
| | | | | | | | | | | | | | | | | | | | When `git_repository__cvar` fails we may end up with a `ignorecase` value of `-1`. As we subsequently check if `ignorecase` is non-zero, we may end up reporting that data should be removed when in fact it should not. Err on the safer side and set `ignorecase = 0` when `git_repository__cvar` fails.
| * merge_file: do not unnecessarily check ours/theirs for NULLPatrick Steinhardt2016-05-021-4/+4
| | | | | | | | | | | | | | | | | | The `merge_file__xdiff` function checks if either `ours` or `theirs` is `NULL`. The function is to be called with existing files, though, and in fact already unconditionally dereferences both pointers. Remove the unnecessary check to silence warnings.
| * index: fix memory leak on error casePatrick Steinhardt2016-05-021-1/+1
| |
* | Merge pull request #3773 from lucasderraugh/patch-1Edward Thomson2016-05-081-0/+1
|\ \ | | | | | | Fix unused variable 'message' warning
| * | Fix unused variable 'message' warningLucas Derraugh2016-05-051-0/+1
| | |
* | | Merge pull request #3757 from johnhaley81/jh/fix-create-initial-commitCarlos Martín Nieto2016-05-062-1/+61
|\ \ \ | |/ / |/| | Fix `git_commit_create` for an initial commit
| * | Fix initial commit testJohn Haley2016-05-041-30/+5
| | | | | | | | | | | | | | | | | | `test_commit_commit__create_initial_commit_parent_not_current` was not correctly testing that `HEAD` was not changed. Now we grab the oid that it was pointing to before the call to `git_commit_create` and the oid that it's pointing to afterwards and compare those.
| * | Add tests for creating an initial commitJohn Haley2016-05-031-0/+85
| | |
| * | Fix `git_commit_create` for an initial commitJohn Haley2016-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | When calling `git_commit_create` with an empty array of `parents` and `parent_count == 0` the call will segfault at https://github.com/libgit2/libgit2/blob/master/src/commit.c#L107 when it's trying to compare `current_id` to a null parent oid. This just puts in a check to stop that segfault.
* | | Merge pull request #3769 from libgit2/ethomson/rebase_inmemory_no_baseCarlos Martín Nieto2016-05-043-9/+119
|\ \ \ | |/ / |/| | Rebase: rebase a branch with no merge base for in-memory
| * | rebase: handle no common ancestor for inmemoryethomson/rebase_inmemory_no_baseEdward Thomson2016-05-031-4/+15
| | |
| * | rebase: test rebase (merge) w/ no common ancestorEdward Thomson2016-05-032-5/+104
|/ /
* | Merge pull request #3759 from libgit2/cmn/faster-headerEdward Thomson2016-05-023-6/+48
|\ \ | |/ |/| odb: avoid inflating the full delta to read the header
| * odb: avoid inflating the full delta to read the headercmn/faster-headerCarlos Martín Nieto2016-05-023-6/+48
| | | | | | | | | | | | | | | | | | | | When we read the header, we want to know the size and type of the object. We're currently inflating the full delta in order to read the first few bytes. This can mean hundreds of kB needlessly inflated for large objects. Instead use a packfile stream to read just enough so we can read the two varints in the header and avoid inflating most of the delta.
* | Merge pull request #3764 from libgit2/ethomson/cmake_pcCarlos Martín Nieto2016-04-291-0/+2
|\ \ | | | | | | cmake: include threading libraries in pkg-config
| * | cmake: include threading libraries in pkg-configethomson/cmake_pcEdward Thomson2016-04-291-0/+2
|/ / | | | | | | Include any required threading libraries in our `libgit2.pc`.
* | Merge pull request #3763 from libgit2/ethomson/signature_from_bufferCarlos Martín Nieto2016-04-293-1/+52
|\ \ | | | | | | Introduce `git_signature_from_buffer`
| * | Introduce `git_signature_from_buffer`ethomson/signature_from_bufferEdward Thomson2016-04-283-1/+52
| |/ | | | | | | | | Allow users to construct a signature from the type of signature lines that actually appear in commits.
* | Merge pull request #3760 from backhub/bug/openssl_readEdward Thomson2016-04-281-1/+1
|\ \ | |/ |/| Fix return value of openssl_read (infinite loop)
| * Fix style: no bracesChristian Schlack2016-04-271-2/+1
| |
| * Fix return value of openssl_read (infinite loop)Christian Schlack2016-04-261-2/+3
| | | | | | | | | | | | | | | | | | | | openssl_read should return -1 in case of error. SSL_read returns values <= 0 in case of error. A return value of 0 can lead to an infinite loop, so the return value of ssl_set_error will be returned if SSL_read is not successful (analog to openssl_write).
* | Merge pull request #3758 from libgit2/ethomson/annotated_commit_refsCarlos Martín Nieto2016-04-266-85/+127
|\ \ | |/ |/| Annotated commits: differentiate between the ref names and the description
| * annotated_commit: provide refs and descriptionethomson/annotated_commit_refsEdward Thomson2016-04-265-85/+108
| | | | | | | | | | | | | | | | | | | | | | Differentiate between the ref_name used to create an annotated_commit (that can subsequently be used to look up the reference) and the description that we resolved this with (which _cannot_ be looked up). The description is used for things like reflogs (and may be a ref name, and ID something that we revparsed to get here), while the ref name must actually be a reference name, and is used for things like rebase to return to the initial branch.
| * rebase::abort: test we can abort rebase by revspecEdward Thomson2016-04-261-0/+19
|/ | | | | Test that we can properly abort a rebase when it is initialized by a revspec. This ensures that we do not conflate revspecs and refnames.
* Merge pull request #3755 from arthurschreiber/patch-9Carlos Martín Nieto2016-04-261-41/+0
|\ | | | | Remove traces of `git_blob_create_fromchunks`
| * Remove traces of `git_blob_create_fromchunks`Arthur Schreiber2016-04-261-41/+0
|/
* Merge pull request #3749 from arthurschreiber/arthur/add-git-reference-dupCarlos Martín Nieto2016-04-263-1/+64
|\ | | | | Allow creating copies of `git_reference` objects.
| * Allow creating copies of `git_reference` objects.Arthur Schreiber2016-04-223-1/+64
| |
* | Merge pull request #3748 from libgit2/ethomson/rebase_detachedCarlos Martín Nieto2016-04-263-32/+161
|\ \ | | | | | | Rebase improvements with IDs
| * | rebase: correctly finish rebasing detached headsethomson/rebase_detachedEdward Thomson2016-04-212-24/+85
| | | | | | | | | | | | | | | When rebasing with IDs, we do not return to the `branch`, we remain in a detached HEAD state.
| * | rebase: handle detached HEADs in `init`Edward Thomson2016-04-211-3/+11
| | | | | | | | | | | | | | | | | | When `init`ing a rebase from a detached HEAD, be sure to remember that we were in a detached HEAD state so that we can correctly `abort` the object that we just created.
| * | rebase: test abort immediately after initEdward Thomson2016-04-211-5/+65
| |/ | | | | | | | | Instead of `open`ing a rebase and `abort`ing that, test that we can `abort` a rebase that has just begun with `init`.
* | Merge pull request #3752 from libgit2/cmn/silly-tagsEdward Thomson2016-04-252-2/+45
|\ \ | | | | | | tag: ignore extra header fields
| * | tag: ignore extra header fieldscmn/silly-tagsCarlos Martín Nieto2016-04-252-2/+45
|/ / | | | | | | | | | | | | While no extra header fields are defined for tags, git accepts them by ignoring them and continuing the search for the message. There are a few tags like this in the wild which git parses just fine, so we should do the same.
* | Merge pull request #3747 from libgit2/ethomson/warningsCarlos Martín Nieto2016-04-224-8/+11
|\ \ | |/ |/| :zap: some warnings
| * clone test: annotate unused varsEdward Thomson2016-04-211-1/+3
| |
| * transport: cast away constness for freeEdward Thomson2016-04-211-1/+1
| |
| * stransport: pass proxy opts instead of char*Edward Thomson2016-04-211-2/+4
| |
| * iterator: ignore submodule in has_endedEdward Thomson2016-04-211-4/+3
|/
* Merge pull request #3110 from libgit2/cmn/proxy-configEdward Thomson2016-04-1930-71/+574
|\ | | | | Proxy configuration
| * CI: download the proxy jar also on mingwcmn/proxy-configCarlos Martín Nieto2016-04-191-2/+3
| | | | | | | | | | | | We were downloading the jar from within an block which only runs for MSVC. Move the download to the start of the test so it gets downloaded for both.
| * CI: run proxy tests with ctestCarlos Martín Nieto2016-04-192-2/+4
| | | | | | | | | | Running clar directly on appveyor makes it think the command returned failure, so it stops the tests. Running it via ctest lets it go through.
| * proxy: don't specify the protocol in the typeCarlos Martín Nieto2016-04-194-14/+9
| | | | | | | | | | | | We leave this up to the scheme in the url field. The type should only tell us about whether we want a proxy and whether we want to auto-detect it.
| * CI: start the proxy before the build so it's readyCarlos Martín Nieto2016-04-192-9/+10
| | | | | | | | | | | | It takes a bit for the propxy to get ready to accept connections, so start it before the build so we can be reasonably sure that it's going to be ready in time.
| * winhttp: correctly detect HTTPS usageCarlos Martín Nieto2016-04-191-2/+14
| |