|
ecf4f33a
|
2018-02-08T11:14:48
|
|
Convert usage of `git_buf_free` to new `git_buf_dispose`
|
|
1403c612
|
2018-01-22T14:44:31
|
|
merge: virtual commit should be last argument to merge-base
Our virtual commit must be the last argument to merge-base: since our
algorithm pushes _both_ parents of the virtual commit, it needs to be
the last argument, since merge-base:
> Given three commits A, B and C, git merge-base A B C will compute the
> merge base between A and a hypothetical commit M
We want to calculate the merge base between the actual commit ("two")
and the virtual commit ("one") - since one actually pushes its parents
to the merge-base calculation, we need to calculate the merge base of
"two" and the parents of one.
|
|
b924df1e
|
2018-01-21T18:05:45
|
|
merge: reverse merge bases for recursive merge
When the commits being merged have multiple merge bases, reverse the
order when creating the virtual merge base. This is for compatibility
with git's merge-recursive algorithm, and ensures that we build
identical trees.
Git does this to try to use older merge bases first. Per 8918b0c:
> It seems to be the only sane way to do it: when a two-head merge is
> done, and the merge-base and one of the two branches agree, the
> merge assumes that the other branch has something new.
>
> If we start creating virtual commits from newer merge-bases, and go
> back to older merge-bases, and then merge with newer commits again,
> chances are that a patch is lost, _because_ the merge-base and the
> head agree on it. Unlikely, yes, but it happened to me.
|
|
185b0d08
|
2018-01-20T19:41:28
|
|
merge: recursive uses larger conflict markers
Git uses longer conflict markers in the recursive merge base - two more
than the default (thus, 9 character long conflict markers). This allows
users to tell the difference between the recursive merge conflicts and
conflicts between the ours and theirs branches.
This was introduced in git d694a17986a28bbc19e2a6c32404ca24572e400f.
Update our tests to expect this as well.
|
|
0c7f49dd
|
2017-06-30T13:39:01
|
|
Make sure to always include "common.h" first
Next to including several files, our "common.h" header also declares
various macros which are then used throughout the project. As such, we
have to make sure to always include this file first in all
implementation files. Otherwise, we might encounter problems or even
silent behavioural differences due to macros or defines not being
defined as they should be. So in fact, our header and implementation
files should make sure to always include "common.h" first.
This commit does so by establishing a common include pattern. Header
files inside of "src" will now always include "common.h" as its first
other file, separated by a newline from all the other includes to make
it stand out as special. There are two cases for the implementation
files. If they do have a matching header file, they will always include
this one first, leading to "common.h" being transitively included as
first file. If they do not have a matching header file, they instead
include "common.h" as first file themselves.
This fixes the outlined problems and will become our standard practice
for header and source files inside of the "src/" from now on.
|
|
4dc87e72
|
2017-06-21T13:35:46
|
|
merge: fix potential free of uninitialized memory
The function `merge_diff_mark_similarity_exact` may error our early and,
when it does so, free the `ours_deletes_by_oid` and
`theirs_deletes_by_oid` variables. While the first one can never be
uninitialized due to the first call actually assigning to it, the second
variable can be freed without being initialized.
Fix the issue by initializing both variables to `NULL`.
|
|
cee1e7af
|
2017-04-12T14:38:30
|
|
merge: perform exact rename detection in linear time
The current exact rename detection has order n^2 complexity.
We can do better by using a map to first aggregate deletes and
using that to match deletes to adds.
This results in a substantial performance improvement for merges
with a large quantity of adds and deletes.
|
|
69873685
|
2017-03-23T09:49:09
|
|
Merge branch 'pr/3957'
|
|
b53d834f
|
2017-03-23T09:46:22
|
|
merge: indentation fixup
|
|
84f56cb0
|
2016-11-04T11:59:52
|
|
repository: rename `path_repository` and `path_gitlink`
The `path_repository` variable is actually confusing to think
about, as it is not always clear what the repository actually is.
It may either be the path to the folder containing worktree and
.git directory, the path to .git itself, a worktree or something
entirely different. Actually, the intent of the variable is to
hold the path to the gitdir, which is either the .git directory
or the bare repository.
Rename the variable to `gitdir` to avoid confusion. While at it,
also rename `path_gitlink` to `gitlink` to improve consistency.
|
|
95367366
|
2017-02-09T16:57:22
|
|
merge: don't do rename detection on submodules
|
|
2854e619
|
2017-01-14T17:12:23
|
|
Merge pull request #4061 from libgit2/ethomson/merge_opts
merge: set default rename threshold
|
|
19ed4d0c
|
2017-01-01T22:19:23
|
|
merge: set default rename threshold
When `GIT_MERGE_FIND_RENAMES` is set, provide a default for
`rename_threshold` when it is unset.
|
|
909d5494
|
2016-12-29T12:25:15
|
|
giterr_set: consistent error messages
Error messages should be sentence fragments, and therefore:
1. Should not begin with a capital letter,
2. Should not conclude with punctuation, and
3. Should not end a sentence and begin a new one
|
|
c77a55a9
|
2016-11-14T10:05:31
|
|
common: use PRIuZ for size_t in `giterr_set` calls
|
|
6d354747
|
2016-10-18T08:20:41
|
|
Perf: Don't perform merge operations for trivial merges.
When one side of a merge is treesame to the ancestor, we can take the other side and skip all the expensive merge operations. This optimization can only be performed when the generation of REUC extension data is skipped.
|
|
9be638ec
|
2016-04-19T15:12:18
|
|
git_diff_generated: abstract generated diffs
|
|
c864b4ab
|
2016-05-12T13:18:07
|
|
Ignore submodules when checking for merge conflicts in the workdir.
|
|
d953c450
|
2016-02-28T21:30:00
|
|
merge drivers: handle configured but not found driver
|
|
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.
|
|
967e073d
|
2016-02-27T16:42:02
|
|
merge driver: correct global initialization
|
|
7a3ab14f
|
2016-02-07T15:58:34
|
|
merge driver: get a pointer to favor
|
|
46625836
|
2016-02-07T15:19:43
|
|
merge driver: correct indentation
|
|
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.
|
|
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.
|
|
7a74590d
|
2015-12-03T09:57:56
|
|
Fix rebase bug and include test for merge=union
|
|
f8787098
|
2015-10-31T18:50:13
|
|
Support union merges via .gitattributes file
|
|
3679ebae
|
2016-02-11T23:37:52
|
|
Horrible fix for #3173.
|
|
fac42ff9
|
2016-02-08T16:58:08
|
|
merge: fix memory leak
|
|
879ebab3
|
2015-12-16T12:30:52
|
|
merge: Use `git_index__fill` to populate the index
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.
|
|
5b9c63c3
|
2015-11-20T19:01:42
|
|
recursive merge: add a recursion limit
|
|
78859c63
|
2015-11-20T17:33:49
|
|
merge: handle conflicts in recursive base building
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.
|
|
76ade3a0
|
2015-11-10T21:21:26
|
|
merge: use annotated commits for recursion
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.
|
|
7730fe8e
|
2015-11-09T13:01:48
|
|
merge: merge annotated commits instead of regular commits
|
|
3f2bb387
|
2015-10-28T11:00:55
|
|
merge: octopus merge common ancestors when >2
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.
|
|
1b82f7b6
|
2015-10-27T14:24:51
|
|
merge: compute octopus merge bases
|
|
75dee59c
|
2015-10-26T10:37:58
|
|
merge: build virtual base of multiple merge bases
When the commits to merge have multiple common ancestors, build a
"virtual" base tree by merging the common ancestors.
|
|
fa78782f
|
2015-10-22T17:00:09
|
|
merge: rename `git_merge_tree_flags_t` -> `git_merge_flags_t`
|
|
1d0bed9d
|
2015-10-30T14:02:01
|
|
merge-base: Style
|
|
4cacf5b5
|
2015-10-30T11:50:43
|
|
merge-base: Do not read parents from the root
|
|
136a71f4
|
2015-10-30T11:45:52
|
|
merge-base: Remove redundant merge bases
|
|
d845abe6
|
2015-10-28T14:49:28
|
|
merge: Do not mallocz unecessary entries
|
|
d3416dfe
|
2015-10-28T10:50:25
|
|
pool: Dot not assume mallocs are zeroed out
|
|
1e5e02b4
|
2015-10-27T17:26:04
|
|
pool: Simplify implementation
|
|
7a02e93e
|
2015-10-27T22:42:40
|
|
merge: Plug memory leak
|
|
a1f5d691
|
2015-10-27T22:42:15
|
|
merge: Implement `GIT_MERGE_TREE_SKIP_REUC`
|
|
8683d31f
|
2015-10-22T14:39:20
|
|
merge: add GIT_MERGE_TREE_FAIL_ON_CONFLICT
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.
|
|
6c014bcc
|
2015-09-29T12:18:17
|
|
diff: don't feed large files to xdiff
|
|
e4352066
|
2015-09-28T18:25:24
|
|
merge_file: treat large files as binary
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.
|
|
56ed415a
|
2015-08-30T19:10:00
|
|
diff: drop `FILELIST_MATCH`
Now that non-pathspec matching diffs are implemented at the iterator
level, drop `FILELIST_MATCH`ing.
|
|
4a0dbeb0
|
2015-08-30T17:06:26
|
|
diff: use new iterator pathlist handling
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`.
|
|
ef206124
|
2015-07-28T19:55:37
|
|
Move filelist into the iterator handling itself.
|
|
ed1c6446
|
2015-07-28T11:41:27
|
|
iterator: use an options struct instead of args
|
|
768f8be3
|
2015-06-30T19:00:41
|
|
Fix #3094 - improve use of portable size_t/ssize_t format specifiers.
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.
|
|
8960dc1e
|
2015-06-24T18:10:30
|
|
iterator: provide git_iterator_walk
Provide `git_iterator_walk` to walk each iterator in lockstep,
returning each iterator's idea of the contents of the next path.
|
|
ca2857d8
|
2015-06-10T10:30:08
|
|
merge: actually increment the counts, not the pointers
`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.
|
|
885b94aa
|
2015-05-28T15:26:13
|
|
Rename GIT_EMERGECONFLICT to GIT_ECONFLICT
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.
|
|
9f545b9d
|
2015-05-19T11:23:59
|
|
introduce `git_index_entry_is_conflict`
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.
|
|
9ebb5a3f
|
2015-02-18T22:53:40
|
|
merge: merge iterators
|
|
89ba9f1a
|
2015-03-18T13:17:04
|
|
Merge pull request #2967 from jacquesg/merge-whitespace
Allow merges of files (and trees) with whitespace problems/fixes
|
|
fea24c53
|
2015-03-16T15:54:53
|
|
PERF: In MERGE, lazily compute is_binary
|
|
13de9363
|
2015-03-12T12:36:09
|
|
Collapse whitespace flags into git_merge_file_flags_t
|
|
f29dde68
|
2015-03-12T12:29:47
|
|
Renamed git_merge_options 'flags' to 'tree_flags'
|
|
45a86bbf
|
2015-03-09T17:02:52
|
|
Allow for merges with whitespace discrepancies
|
|
a291790a
|
2015-02-15T05:18:01
|
|
Merge pull request #2831 from ethomson/merge_lock
merge: lock index during the merge (not just checkout)
|
|
41fae48d
|
2015-02-03T22:31:10
|
|
indexwriter: an indexwriter for repo operations
Provide git_indexwriter_init_for_operation for the common locking
pattern in merge, rebase, revert and cherry-pick.
|
|
8b0ddd5d
|
2015-01-17T23:28:53
|
|
merge: lock the index at the start of the merge
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.
|
|
f1453c59
|
2015-02-12T12:19:37
|
|
Make our overflow check look more like gcc/clang's
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.
|
|
392702ee
|
2015-02-09T23:41:13
|
|
allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
|
|
85880693
|
2015-01-14T10:19:28
|
|
Merge branch 'pr/2740'
|
|
b3837d4d
|
2014-12-02T05:47:32
|
|
Always use GIT_HASHSIG_SMART_WHITESPACE when diffing for merges
git_merge_tree_flag_t cannot contain any GIT_DIFF_FIND_xxx flags so there's not point in checking for them
|
|
6f73e026
|
2014-12-24T11:42:50
|
|
Plug some leaks
|
|
18b00406
|
2014-10-03T19:02:29
|
|
s/git_merge_head/git_annotated_commit
Rename git_merge_head to git_annotated_commit, as it becomes used
in more operations than just merge.
|
|
867a36f3
|
2014-07-14T14:35:01
|
|
Introduce git_rebase to set up a rebase session
Introduce `git_rebase` to set up a rebase session that can
then be continued. Immediately, only merge-type rebase is
supported.
|
|
917f85a1
|
2014-10-09T14:16:10
|
|
Extract shared functionality.
|
|
eca07bcd
|
2014-10-09T13:58:23
|
|
Add git_merge_bases_many.
|
|
737b5051
|
2014-10-01T12:03:24
|
|
hashsig: Export as a `sys` header
|
|
dc68ee8d
|
2014-09-12T22:37:15
|
|
Remove local unused index_repo variable
|
|
a565f364
|
2014-09-12T22:53:56
|
|
Only check for workdir conflicts if the index has merged files
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
|
|
46a13f32
|
2014-08-29T18:19:56
|
|
Merge pull request #2481 from libgit2/cmn/oidarray
merge: expose multiple merge bases
|
|
017c0eac
|
2014-08-25T22:41:07
|
|
merge base: Correctly raise an error if a non-commit object is passed.
|
|
7db0e6ee
|
2014-07-18T16:00:21
|
|
merge: expose multiple merge bases
We always calculate multiple merge bases, but up to now we had only
exposed the "best" merge base.
Introduce git_oidarray which analogously to git_strarray lets us return
multiple ids.
|
|
994404b5
|
2014-07-17T01:25:31
|
|
Don't allow conflicts by default
|
|
02bf955f
|
2014-07-02T15:42:15
|
|
merge: don't open COMMIT_MSG unless we need to append conflicts
|
|
967f5a76
|
2014-05-23T14:50:51
|
|
git_checkout_index: checkout other indexes
git_checkout_index can now check out other git_index's (that are not
necessarily the repository index). This allows checkout_index to use
the repository's index for stat cache information instead of the index
data being checked out. git_merge and friends now check out their
indexes directly instead of trying to blend it into the running index.
|
|
eff531e1
|
2014-05-27T20:58:20
|
|
Modify GIT_MERGE_CONFIG -> GIT_MERGE_PREFERENCE
|
|
de3f851e
|
2014-05-21T09:44:05
|
|
Staticify `merge_config`
|
|
22ab8881
|
2014-05-20T22:07:15
|
|
Use a config snapshot
|
|
a3622ba6
|
2014-05-16T13:54:40
|
|
Move GIT_MERGE_CONFIG_* to its own enum
|
|
d362093f
|
2014-05-08T15:41:36
|
|
Introduce GIT_MERGE_CONFIG_* for merge.ff settings
git_merge_analysis will now return GIT_MERGE_CONFIG_NO_FASTFORWARD
when merge.ff=false and GIT_MERGE_CONFIG_FASTFORWARD_ONLY when
merge.ff=true
|
|
702efc89
|
2014-04-30T10:57:42
|
|
Make init_options fns use unsigned ints and macro
Use an unsigned int for the version and add a helper macro so the
code is simplified (and so the error message is a common string).
|
|
a4e2c36a
|
2014-04-23T19:40:21
|
|
merge: checkout default shouldn't clobber given
|
|
26564d80
|
2014-04-23T19:26:58
|
|
merge: default checkout strategy for should be SAFE
|
|
8a2834d3
|
2014-03-14T13:20:51
|
|
Index locking and entry allocation changes
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.
|
|
3b4c401a
|
2014-02-10T13:20:08
|
|
Decouple index iterator sort from index
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.
|
|
c67fd4c9
|
2014-02-07T11:20:36
|
|
Some vector utility tweaks
This is just laying some groundwork for internal index changes
that I'm working on.
|
|
6fefb7af
|
2014-04-13T19:53:35
|
|
Capture conflict information in MERGE_MSG for revert and merge
|
|
399f2b62
|
2014-04-07T20:15:45
|
|
Introduce git_merge__extract_conflict_paths
|
|
3b4ba278
|
2014-04-03T15:50:21
|
|
Const correctness!
|
|
976634c4
|
2014-03-30T19:56:18
|
|
Introduce git_merge_head_id
|