summaryrefslogtreecommitdiff
path: root/src/merge.c
Commit message (Collapse)AuthorAgeFilesLines
* merge: Use `git_index__fill` to populate the indexvmg/index-fillVicent Marti2015-12-161-5/+2
| | | | | | | | | | | | | Instead of calling `git_index_add` in a loop, use the new `git_index_fill` internal API to fill the index with the initial staged entries. The new `fill` helper assumes that all the entries will be unique and valid, so it can append them at the end of the entries vector and only sort it once at the end. It performs no validation checks. This prevents the quadratic behavior caused by having to sort the entries list once after every insertion.
* recursive merge: add a recursion limitEdward Thomson2015-11-251-3/+10
|
* merge: handle conflicts in recursive base buildingEdward Thomson2015-11-251-19/+48
| | | | | | | | | | | | | | | | | When building a recursive merge base, allow conflicts to occur. Use the file (with conflict markers) as the common ancestor. The user has already seen and dealt with this conflict by virtue of having a criss-cross merge. If they resolved this conflict identically in both branches, then there will be no conflict in the result. This is the best case scenario. If they did not resolve the conflict identically in the two branches, then we will generate a new conflict. If the user is simply using standard conflict output then the results will be fairly sensible. But if the user is using a mergetool or using diff3 output, then the common ancestor will be a conflict file (itself with diff3 output, haha!). This is quite terrible, but it matches git's behavior.
* merge: use annotated commits for recursionEdward Thomson2015-11-251-59/+83
| | | | | | | Use annotated commits to act as our virtual bases, instead of regular commits, to avoid polluting the odb with virtual base commits and trees. Instead, build an annotated commit with an index and pointers to the commits that it was merged from.
* merge: merge annotated commits instead of regular commitsEdward Thomson2015-11-251-156/+125
|
* merge: octopus merge common ancestors when >2Edward Thomson2015-11-251-119/+165
| | | | | | When there are more than two common ancestors, continue merging the virtual base with the additional common ancestors, effectively octopus merging a new virtual base.
* merge: compute octopus merge basesEdward Thomson2015-11-251-89/+100
|
* merge: build virtual base of multiple merge basesEdward Thomson2015-11-251-10/+123
| | | | | When the commits to merge have multiple common ancestors, build a "virtual" base tree by merging the common ancestors.
* merge: rename `git_merge_tree_flags_t` -> `git_merge_flags_t`Edward Thomson2015-11-251-6/+6
|
* merge-base: StyleVicent Marti2015-11-021-1/+6
|
* merge-base: Do not read parents from the rootVicent Marti2015-11-021-1/+1
|
* merge-base: Remove redundant merge basesVicent Marti2015-11-021-22/+165
|
* merge: Do not mallocz unecessary entriesvmg/poolVicent Marti2015-10-281-2/+2
|
* pool: Dot not assume mallocs are zeroed outVicent Marti2015-10-281-4/+4
|
* pool: Simplify implementationVicent Marti2015-10-281-3/+3
|
* merge: Plug memory leakvmg/reuc-insertVicent Marti2015-10-271-3/+3
|
* merge: Implement `GIT_MERGE_TREE_SKIP_REUC`Vicent Marti2015-10-271-28/+43
|
* merge: add GIT_MERGE_TREE_FAIL_ON_CONFLICTEdward Thomson2015-10-221-1/+8
| | | | | | Provide a new merge option, GIT_MERGE_TREE_FAIL_ON_CONFLICT, which will stop on the first conflict and fail the merge operation with GIT_EMERGECONFLICT.
* diff: don't feed large files to xdiffEdward Thomson2015-10-051-1/+0
|
* merge_file: treat large files as binaryEdward Thomson2015-10-051-55/+0
| | | | | | | | xdiff craps the bed on large files. Treat very large files as binary, so that it doesn't even have to try. Refactor our merge binary handling to better match git.git, which looks for a NUL in the first 8000 bytes.
* diff: drop `FILELIST_MATCH`Edward Thomson2015-08-301-1/+1
| | | | | Now that non-pathspec matching diffs are implemented at the iterator level, drop `FILELIST_MATCH`ing.
* diff: use new iterator pathlist handlingEdward Thomson2015-08-301-1/+2
| | | | | | | | When using literal pathspecs in diff with `GIT_DIFF_DISABLE_PATHSPEC_MATCH` turn on the faster iterator pathlist handling. Updates iterator pathspecs to include directory prefixes (eg, `foo/`) for compatibility with `GIT_DIFF_DISABLE_PATHSPEC_MATCH`.
* Move filelist into the iterator handling itself.Edward Thomson2015-08-281-3/+2
|
* iterator: use an options struct instead of argsEdward Thomson2015-08-281-11/+24
|
* Fix #3094 - improve use of portable size_t/ssize_t format specifiers.Matthew Plough2015-07-121-3/+3
| | | | The header src/cc-compat.h defines portable format specifiers PRIuZ, PRIdZ, and PRIxZ. The original report highlighted the need to use these specifiers in examples/network/fetch.c. For this commit, I checked all C source and header files not in deps/ and transitioned to the appropriate format specifier where appropriate.
* iterator: provide git_iterator_walkEdward Thomson2015-06-251-86/+30
| | | | | Provide `git_iterator_walk` to walk each iterator in lockstep, returning each iterator's idea of the contents of the next path.
* merge: actually increment the counts, not the pointersCarlos Martín Nieto2015-06-101-2/+2
| | | | | | | | `merge_diff_list_count_candidates()` takes pointers to the source and target counts, but when it comes time to increase them, we're increasing the pointer, rather than the value it's pointing to. Dereference the value to increase.
* Rename GIT_EMERGECONFLICT to GIT_ECONFLICTEdward Thomson2015-05-291-1/+1
| | | | | | | | | | We do not error on "merge conflicts"; on the contrary, merge conflicts are a normal part of merging. We only error on "checkout conflicts", where a change exists in the index or the working directory that would otherwise be overwritten by performing the checkout. This *may* happen during merge (after the production of the new index that we're going to checkout) but it could happen during any checkout.
* introduce `git_index_entry_is_conflict`Edward Thomson2015-05-281-2/+2
| | | | | | | | | It's not always obvious the mapping between stage level and conflict-ness. More importantly, this can lead otherwise sane people to write constructs like `if (!git_index_entry_stage(entry))`, which (while technically correct) is unreadable. Provide a nice method to help avoid such messy thinking.
* merge: merge iteratorsEdward Thomson2015-05-111-20/+66
|
* Merge pull request #2967 from jacquesg/merge-whitespaceEdward Thomson2015-03-181-6/+10
|\ | | | | Allow merges of files (and trees) with whitespace problems/fixes
| * Collapse whitespace flags into git_merge_file_flags_tJacques Germishuys2015-03-161-5/+5
| |
| * Renamed git_merge_options 'flags' to 'tree_flags'Jacques Germishuys2015-03-161-2/+2
| |
| * Allow for merges with whitespace discrepanciesJacques Germishuys2015-03-161-4/+8
| |
* | PERF: In MERGE, lazily compute is_binaryJeff Hostetler2015-03-161-8/+19
|/
* Merge pull request #2831 from ethomson/merge_lockCarlos Martín Nieto2015-02-151-11/+14
|\ | | | | merge: lock index during the merge (not just checkout)
| * indexwriter: an indexwriter for repo operationsEdward Thomson2015-02-141-24/+10
| | | | | | | | | | Provide git_indexwriter_init_for_operation for the common locking pattern in merge, rebase, revert and cherry-pick.
| * merge: lock the index at the start of the mergeEdward Thomson2015-02-141-2/+19
| | | | | | | | | | | | | | | | | | | | Always lock the index when we begin the merge, before we write any of the metdata files. This prevents a race where another client may run a commit after we have written the MERGE_HEAD but before we have updated the index, which will produce a merge commit that is treesame to one parent. The merge will finish and update the index and the resultant commit would not be a merge at all.
* | Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-5/+4
| | | | | | | | | | | | | | | | | | Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
* | allocations: test for overflow of requested sizeEdward Thomson2015-02-121-0/+2
|/ | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* Merge branch 'pr/2740'Edward Thomson2015-01-141-7/+1
|\
| * Always use GIT_HASHSIG_SMART_WHITESPACE when diffing for mergesPierre-Olivier Latour2015-01-141-7/+1
| | | | | | | | git_merge_tree_flag_t cannot contain any GIT_DIFF_FIND_xxx flags so there's not point in checking for them
* | Plug some leaksJacques Germishuys2014-12-291-1/+3
|/
* s/git_merge_head/git_annotated_commitEdward Thomson2014-10-261-147/+39
| | | | | Rename git_merge_head to git_annotated_commit, as it becomes used in more operations than just merge.
* Introduce git_rebase to set up a rebase sessionEdward Thomson2014-10-261-24/+1
| | | | | | Introduce `git_rebase` to set up a rebase session that can then be continued. Immediately, only merge-type rebase is supported.
* Extract shared functionality.Arthur Schreiber2014-10-091-55/+41
|
* Add git_merge_bases_many.Arthur Schreiber2014-10-091-0/+67
|
* hashsig: Export as a `sys` headervmg/hashsigVicent Marti2014-10-011-1/+1
|
* Remove local unused index_repo variableJacques Germishuys2014-09-121-3/+1
|
* Only check for workdir conflicts if the index has merged filesJacques Germishuys2014-09-121-0/+10
| | | | | | Passing 0 as the length of the paths to check to git_diff_index_to_workdir results in all files being treated as conflicting, that is, all untracked or modified files in the worktree is reported as conflicting