summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tree: use a specialised mode parse functioncmn/parse-modeCarlos Martín Nieto2015-12-021-5/+21
| | | | | Instead of going out to strtol, which is made to parse generic numbers, copy a parse function from git which is specialised for file modes.
* Merge pull request #3527 from pks-t/pks/tree-entry-memleakEdward Thomson2015-12-011-0/+2
|\ | | | | tree: mark cloned tree entries as un-pooled
| * tree: mark cloned tree entries as un-pooledPatrick Steinhardt2015-12-011-0/+2
|/ | | | | | | | | | | | When duplicating a `struct git_tree_entry` with `git_tree_entry_dup` the resulting structure is not allocated inside a memory pool. As we do a 1:1 copy of the original struct, though, we also copy the `pooled` field, which is set to `true` for pooled entries. This results in a huge memory leak as we never free tree entries that were duplicated from a pooled tree entry. Fix this by marking the newly duplicated entry as un-pooled.
* Merge pull request #3508 from libgit2/cmn/tree-parse-speedEdward Thomson2015-11-302-17/+55
|\ | | | | Improvements to tree parsing speed
| * tree: ensure the entry filename fits in 16 bitscmn/tree-parse-speedCarlos Martín Nieto2015-11-301-16/+26
| | | | | | | | | | | | Return an error in case the length is too big. Also take this opportunity to have a single allocating function for the size and overflow logic.
| * tree: make path len uint16_t and avoid holesCarlos Martín Nieto2015-11-282-2/+2
| | | | | | | | | | | | This reduces the size of the struct from 32 to 26 bytes, and leaves a single padding byte at the end of the struct (which comes from the zero-length array).
| * tree: calculate the filename length onceCarlos Martín Nieto2015-11-281-5/+8
| | | | | | | | | | We already know the size due to the `memchr()` so use that information instead of calling `strlen()` on it.
| * tree: pool the entry memory allocationsCarlos Martín Nieto2015-11-282-6/+33
| | | | | | | | | | | | | | These are rather small allocations, so we end up spending a non-trivial amount of time asking the OS for memory. Since these entries are tied to the lifetime of their tree, we can give the tree a pool so we speed up the allocations.
| * tree: avoid advancing over the filename multiple timesCarlos Martín Nieto2015-11-281-4/+2
| | | | | | | | | | | | | | We've already looked at the filename with `memchr()` and then used `strlen()` to allocate the entry. We already know how much we have to advance to get to the object id, so add the filename length instead of looking at each byte again.
* | Merge pull request #3525 from pks-t/pks/fix-nested-struct-warningCarlos Martín Nieto2015-11-302-3/+1
|\ \ | | | | | | Compiler warning fixes
| * | object: remove unused constant OBJECT_BASE_SIZEPatrick Steinhardt2015-11-301-2/+0
| | |
| * | tests: fix warning for nested struct initializationPatrick Steinhardt2015-11-301-1/+1
|/ /
* | Merge pull request #3513 from ethomson/merge_recursiveCarlos Martín Nieto2015-11-30175-192/+1237
|\ \ | |/ |/| Recursive Merge
| * recursive merge: add a recursion limitEdward Thomson2015-11-253-3/+49
| |
| * merge: handle conflicts in recursive base buildingEdward Thomson2015-11-2528-20/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 tests: add complex recursive exampleEdward Thomson2015-11-2512-6/+39
| |
| * recursive: test conflict output during recursive mergeEdward Thomson2015-11-252-0/+81
| |
| * merge tests: move expected data into own fileEdward Thomson2015-11-256-44/+47
| |
| * merge: use annotated commits for recursionEdward Thomson2015-11-253-68/+122
| | | | | | | | | | | | | | 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-253-166/+159
| |
| * merge: octopus merge common ancestors when >2Edward Thomson2015-11-253-119/+189
| | | | | | | | | | | | 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: add recursive test with conflicting contentsEdward Thomson2015-11-259-0/+32
| |
| * merge: compute octopus merge basesEdward Thomson2015-11-251-89/+100
| |
| * merge: add recursive test with three merge basesEdward Thomson2015-11-2528-0/+65
| |
| * merge: improve test names in recursive merge testsEdward Thomson2015-11-251-8/+8
| |
| * merge: add a third-level recursive mergeEdward Thomson2015-11-2513-0/+58
| |
| * merge: add a second-level recursive mergeEdward Thomson2015-11-2512-2/+57
| |
| * 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: add simple recursive testEdward Thomson2015-11-2571-5/+245
| | | | | | | | | | Add a simple recursive test - where multiple ancestors exist and creating a virtual merge base from them would prevent a conflict.
| * merge: rename `git_merge_tree_flags_t` -> `git_merge_flags_t`Edward Thomson2015-11-259-34/+44
| |
* | Merge pull request #3523 from pks-t/memleak-fixesEdward Thomson2015-11-243-1/+6
|\ \ | | | | | | Memleak fixes
| * | tests: win32::longpath: free expected_msgPatrick Steinhardt2015-11-241-0/+2
| | |
| * | tests: config::stress: free `git_config` structsPatrick Steinhardt2015-11-241-0/+3
| | |
| * | tests: config::global: fix memleak in open_programdataPatrick Steinhardt2015-11-241-1/+1
| | |
* | | Merge pull request #3520 from ethomson/checkout_nsecsCarlos Martín Nieto2015-11-245-66/+46
|\ \ \ | |/ / |/| | checkout: only consider nsecs when built that way
| * | checkout: only consider nsecs when built that wayEdward Thomson2015-11-235-66/+46
|/ / | | | | | | | | | | | | | | When examining the working directory and determining whether it's up-to-date, only consider the nanoseconds in the index entry when built with `GIT_USE_NSEC`. This prevents us from believing that the working directory is always dirty when the index was originally written with a git client that uinderstands nsecs (like git 2.x).
* | Merge pull request #3515 from jacquesg/unsigned-signedEdward Thomson2015-11-211-1/+1
|\ \ | |/ |/| Fix <0 unsigned comparison (stat.st_size should be an off_t)
| * Make stat.st_size a __int64 not a uint64_tJacques Germishuys2015-11-211-1/+1
| |
* | Merge pull request #3517 from jacquesg/warnings-fixesEdward Thomson2015-11-204-3/+3
|\ \ | | | | | | Fix some warnings
| * | Fix some warningsJacques Germishuys2015-11-204-3/+3
| |/
* | Merge pull request #3514 from jacquesg/stat-fixesEdward Thomson2015-11-202-11/+24
|\ \ | | | | | | Stat fixes
| * | Detect stat's structureJacques Germishuys2015-11-202-11/+24
| |/
* | Merge pull request #3516 from libgit2/cmn/repository-state-sequencerEdward Thomson2015-11-204-3/+35
|\ \ | |/ |/| repository: distinguish sequencer cherry-pick and revert
| * repository: distinguish sequencer cherry-pick and revertcmn/repository-state-sequencerCarlos Martín Nieto2015-11-204-3/+35
|/ | | | These are not quite like their plain counterparts and require special handling.
* Merge pull request #3511 from ethomson/racy_fixes_2Carlos Martín Nieto2015-11-173-53/+286
|\ | | | | Racy fixes for writing new indexes
| * racy: make git_index_read_index handle racinessEdward Thomson2015-11-162-30/+96
| | | | | | | | | | | | | | | | | | | | | | Ensure that `git_index_read_index` clears the uptodate bit on files that it modifies. Further, do not propagate the cache from an on-disk index into another on-disk index. Although this should not be done, as `git_index_read_index` is used to bring an in-memory index into another index (that may or may not be on-disk), ensure that we do not accidentally bring in these bits when misused.
| * racy: ensure git_index_read_tree clears uptodateEdward Thomson2015-11-161-0/+28
| | | | | | | | | | Ensure that `git_index_read_tree` clears the uptodate bit on files that it modifies.
| * index: clear uptodate bit on saveEdward Thomson2015-11-161-1/+16
| | | | | | | | | | | | The uptodate bit should have a lifecycle of a single read->write on the index. Once the index is written, the files within it should be scanned for racy timestamps against the new index timestamp.
| * index: test for smudged entries on write onlyEdward Thomson2015-11-161-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test that entries are only smudged when we write the index: the entry smudging is to prevent us from updating an index in a way that it would be impossible to tell that an item was racy. Consider when we load an index: any entries that have the same (or newer) timestamp than the index itself are considered racy, and are subject to further scrutiny. If we *save* that index with the same entries that we loaded, then the index would now have a newer timestamp than the entries, and they would no longer be given that additional scrutiny, failing our racy detection! So test that we smudge those entries only on writing the new index, but that we can detect them (in diff) without having to write.
| * checkout::crlf test: don't crash when no idx entryEdward Thomson2015-11-161-4/+5
| | | | | | | | | | | | | | | | | | | | When there's no matching index entry (for whatever reason), don't try to dereference the null return value to get at the id. Otherwise when we break something in the index API, the checkout test crashes for confusing reasons and causes us to step through it in a debugger thinking that we had broken much more than we actually did.