summaryrefslogtreecommitdiff
path: root/src/merge.c
Commit message (Collapse)AuthorAgeFilesLines
* merge: checkout default shouldn't clobber givenEdward Thomson2014-04-231-5/+3
|
* merge: default checkout strategy for should be SAFEEdward Thomson2014-04-231-1/+1
|
* Index locking and entry allocation changesRussell Belfer2014-04-171-5/+5
| | | | | | | | | | | | | | | | | This makes the lock management on the index a little bit broader, having a number of routines hold the lock across looking up the item to be modified and actually making the modification. Still not true thread safety, but more pure index modifications are now safe which allows the simple cases (such as starting up a diff while index modifications are underway) safe enough to get the snapshot without hitting allocation problems. As part of this, I simplified the allocation of index entries to use a flex array and just put the path at the end of the index entry. This makes every entry self-contained and makes it a little easier to feel sure that pointers to strings aren't being accidentally copied and freed while other references are still being held.
* Decouple index iterator sort from indexRussell Belfer2014-04-171-1/+1
| | | | | | | | This makes the index iterator honor the GIT_ITERATOR_IGNORE_CASE and GIT_ITERATOR_DONT_IGNORE_CASE flags without modifying the index data itself. To take advantage of this, I had to export a number of the internal index entry comparison functions. I also wrote some new tests to exercise the capability.
* Some vector utility tweaksRussell Belfer2014-04-171-2/+4
| | | | | This is just laying some groundwork for internal index changes that I'm working on.
* Capture conflict information in MERGE_MSG for revert and mergeJacques Germishuys2014-04-141-0/+1
|
* Introduce git_merge__extract_conflict_pathsJacques Germishuys2014-04-141-0/+41
|
* Const correctness!Jacques Germishuys2014-04-031-1/+1
|
* Introduce git_merge_head_idEdward Thomson2014-03-311-0/+8
|
* Free temporary merge indexEdward Thomson2014-03-261-2/+1
|
* Merge pull request #2183 from ethomson/merge_refactorVicent Marti2014-03-241-205/+195
|\ | | | | Refactor the `git_merge` API
| * UNBORN implies FAST_FORWARDEdward Thomson2014-03-201-1/+1
| |
| * Introduce GIT_MERGE_ANALYSIS_UNBORNEdward Thomson2014-03-201-10/+25
| |
| * git_merge_status -> git_merge_analysisEdward Thomson2014-03-201-5/+5
| |
| * Remove `git_merge_result` as it's now unnecessaryEdward Thomson2014-03-201-47/+1
| |
| * Update git_merge_tree_opts to git_merge_optionsEdward Thomson2014-03-201-24/+24
| |
| * Change signature of `git_merge` to take merge and checkout optsEdward Thomson2014-03-201-38/+26
| |
| * Remove fastforward / uptodate from `git_merge`Edward Thomson2014-03-201-82/+23
| |
| * Add `git_merge_status` to provide info about an upcoming mergeEdward Thomson2014-03-201-9/+74
| |
| * Introduce git_merge_file for consumersEdward Thomson2014-03-201-14/+41
| |
* | revwalk: don't try to find merge bases when there can be noneCarlos Martín Nieto2014-03-201-0/+6
|/ | | | | | | | | | | | | | | | | | | As a way to speed up the cases where we need to hide some commits, we find out what the merge bases are so we know to stop marking commits as uninteresting and avoid walking down a potentially very large amount of commits which we will never see. There are however two oversights in current code. The merge-base finding algorithm fails to recognize that if it is only given one commit, there can be no merge base. It instead walks down the whole ancestor chain needlessly. Make it return an empty list immediately in this situation. The revwalk does not know whether the user has asked to hide any commits at all. In situation where the user pushes multiple commits but doesn't hide any, the above fix wouldn't do the trick. Keep track of whether the user wants to hide any commits and only run the merge-base finding algorithm when it's needed.
* Implement git_merge_base_octopusAimeast2014-03-181-0/+25
|
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+24
| | | | The basic structure of each function is courtesy of arrbee.
* Address PR commentsRussell Belfer2014-02-201-1/+1
| | | | | | | * Make GIT_INLINE an internal definition so it cannot be used in public headers * Fix language in CONTRIBUTING * Make index caps API use signed instead of unsigned values
* Merge pull request #2100 from libgit2/rb/update-pqueueVicent Marti2014-02-071-7/+8
|\ | | | | Replace priority queue code with implementation from hashsig
| * Replace pqueue with code from hashsig heapRussell Belfer2014-02-031-7/+8
| | | | | | | | | | | | | | | | | | | | | | I accidentally wrote a separate priority queue implementation when I was working on file rename detection as part of the file hash signature calculation code. To simplify licensing terms, I just adapted that to a general purpose priority queue and replace the old priority queue implementation that was borrowed from elsewhere. This also removes parts of the COPYING document that no longer apply to libgit2.
* | Remove unused pointer assignmentEdward Thomson2014-02-031-1/+1
| |
* | Merge wd validation tests against index not HEADEdward Thomson2014-02-031-6/+3
|/ | | | | | | | | | | | Validating the workdir should not compare HEAD to working directory - this is both inefficient (as it ignores the cache) and incorrect. If we had legitimately allowed changes in the index (identical to the merge result) then comparing HEAD to workdir would reject these changes as different. Further, this will identify files that were filtered strangely as modified, while testing with the cache would prevent this. Also, it's stupid slow.
* Two-phase index mergingEdward Thomson2014-01-291-5/+14
| | | | | | | | | When three-way merging indexes, we previously changed each path as we read them, which would lead to us adding an index entry for 'foo', then removing an index entry for 'foo/file'. With the new index requirements, this is not allowed. Removing entries in the merged index, then adding them, resolves this. In the previous example, we now remove 'foo/file' before adding 'foo'.
* merge: rename _oid() -> id()Carlos Martín Nieto2014-01-251-3/+3
| | | | Following the rest of the series, use 'id' when refering to the value.
* diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-1/+1
| | | | In the same vein as the previous commits in this series.
* index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-13/+13
| | | | This was not converted when we converted the rest, so do it now.
* Merge submodulesEdward Thomson2014-01-201-4/+10
|
* Remove the "merge none" flagEdward Thomson2014-01-201-11/+6
| | | | | | | The "merge none" (don't automerge) flag was only to aide in merge trivial tests. We can easily determine whether merge trivial resulted in a trivial merge or an automerge by examining the REUC after automerge has completed.
* Introduce diff3 mode for checking out conflictsEdward Thomson2014-01-201-5/+19
|
* Don't try to merge binary filesEdward Thomson2014-01-201-0/+43
|
* merge_file should use more aggressive levelsEdward Thomson2014-01-201-7/+10
| | | | | | | | | | | The default merge_file level was XDL_MERGE_MINIMAL, which will produce conflicts where there should not be in the case where both sides were changed identically. Change the defaults to be more aggressive (XDL_MERGE_ZEALOUS) which will more aggressively compress non-conflicts. This matches git.git's defaults. Increase testing around reverting a previously reverted commit to illustrate this problem.
* Merge pull request #1986 from libgit2/rb/error-handling-cleanupsVicent Marti2013-12-131-19/+11
|\ | | | | Clean up some error handling and change callback error behavior
| * Cleanups, renames, and leak fixesRussell Belfer2013-12-121-1/+1
| | | | | | | | | | | | | | | | | | This renames git_vector_free_all to the better git_vector_free_deep and also contains a couple of memory leak fixes based on valgrind checks. The fixes are specifically: failure to free global dir path variables when not compiled with threading on and failure to free filters from the filter registry that had not be initialized fully.
| * One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
| |
| * Some callback error check style cleanupsRussell Belfer2013-12-111-1/+3
| | | | | | | | I find this easier to read...
| * Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
| * Add git_vector_free_allRussell Belfer2013-12-111-5/+1
| | | | | | | | | | | | There are a lot of places that we call git__free on each item in a vector and then call git_vector_free on the vector itself. This just wraps that up into one convenient helper function.
| * Further EUSER and error propagation fixesRussell Belfer2013-12-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
| * Add config read fns with controlled error behaviorRussell Belfer2013-12-111-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds `git_config__lookup_entry` which will look up a key in a config and return either the entry or NULL if the key was not present. Optionally, it can either suppress all errors or can return them (although not finding the key is not an error for this function). Unlike other accessors, this does not normalize the config key string, so it must only be used when the key is known to be in normalized form (i.e. all lower-case before the first dot and after the last dot, with no invalid characters). This also adds three high-level helper functions to look up config values with no errors and a fallback value. The three functions are for string, bool, and int values, and will resort to the fallback value for any error that arises. They are: * `git_config__get_string_force` * `git_config__get_bool_force` * `git_config__get_int_force` None of them normalize the config `key` either, so they can only be used for internal cases where the key is known to be in normal format.
* | Validate struct versions in merge, revertEdward Thomson2013-12-121-0/+4
|/
* Clean up warningsEdward Thomson2013-12-091-2/+2
|
* Bare naked merge and rebaseEdward Thomson2013-12-031-0/+34
|
* clean up state metadata more consistentlyEdward Thomson2013-12-021-34/+12
|
* Introduce git_revert to revert a single commitEdward Thomson2013-12-021-8/+10
|