summaryrefslogtreecommitdiff
path: root/src/diff_tform.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed handling of GIT_DELTA_CONFLICTED in git_diff_find_similar()Pierre-Olivier Latour2015-06-101-4/+4
| | | | | git_diff_find_similar() now ignores git_diff_delta records with a status of GIT_DELTA_CONFLICTED, which fixes a crash due to assert() being hit.
* Make sure to also update delta->nfiles when merging diffsPierre-Olivier Latour2015-03-301-2/+8
| | | | | | | When diffs are generated, the value for the 'nfiles' field of 'git_diff_delta' will be consistent with the value in the 'status' field. Merging diffs can modify the 'status' field of some deltas and the 'nfiles' field needs to be updated accordingly.
* Plug a few leaksCarlos Martín Nieto2015-03-041-1/+3
|
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-2/+3
| | | | | | | | | 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/+1
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* Added GIT_HASHSIG_ALLOW_SMALL_FILES to allow computing signatures for small ↵Pierre-Olivier Latour2015-01-141-22/+15
| | | | | | | | | | | | | files The implementation of the hashsig API disallows computing a signature on small files containing only a few lines. This new flag disables this behavior. git_diff_find_similar() sets this flag by default which means that rename / copy detection of small files will now work. This in turn affects the behavior of the git_status and git_blame APIs which will now detect rename of small files assuming the right options are passed.
* Removed some useless variable assignmentsPierre-Olivier Latour2014-10-271-2/+0
|
* hashsig: Export as a `sys` headervmg/hashsigVicent Marti2014-10-011-1/+1
|
* Start adding GIT_DELTA_UNREADABLE and GIT_STATUS_WT_UNREADABLE.Alan Rogers2014-05-201-1/+3
|
* Add build option for diff internal statisticsRussell Belfer2014-05-021-4/+4
|
* Use a portable castBen Straub2014-02-241-2/+2
|
* Avoid casting warningBen Straub2014-02-241-2/+2
|
* diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-14/+14
| | | | In the same vein as the previous commits in this series.
* Sometimes a zero byte file is just a zero byte fileEdward Thomson2014-01-221-1/+1
| | | | Don't go to the ODB to resolve zero byte files in the workdir
* Cleanups, renames, and leak fixesRussell Belfer2013-12-121-2/+2
| | | | | | | | | 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.
* Fix up some valgrind leaks and warningsRussell Belfer2013-12-111-15/+14
|
* Add git_vector_free_allRussell Belfer2013-12-111-6/+2
| | | | | | 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.
* Add config read fns with controlled error behaviorRussell Belfer2013-12-111-20/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Check version earlierBen Straub2013-12-111-1/+2
|
* Don't clobber whitespace settingsBen Straub2013-12-061-5/+5
|
* Don't use weird return codesBen Straub2013-12-051-3/+8
|
* Implement GIT_DIFF_FIND_BY_CONFIGBen Straub2013-12-051-11/+17
|
* GIT_DIFF_FIND_REMOVE_UNMODIFIED sounds betterRussell Belfer2013-12-021-1/+1
|
* Add GIT_DIFF_FIND_DELETE_UNMODIFIED flagRussell Belfer2013-12-021-0/+2
| | | | | | | | | | When doing copy detection, it is often necessary to include UNMODIFIED records in the git_diff so they are available as source records for GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED. Yet in the final diff, often you will not want to have these UNMODIFIED records. This adds a flag which marks these UNMODIFIED records for deletion from the diff list so they will be removed after the rename detect phase is over.
* Fix bug making split deltas a COPIED targetsRussell Belfer2013-12-021-16/+30
| | | | | | | | When FIND_COPIES is used in combination with BREAK_REWRITES for rename detection, there was a bug where the split MODIFIED delta was only used as a target for RENAME records and not for COPIED records. This fixes that, converting the split into a pair of DELETED and COPIED deltas when that circumstance arises.
* More tests and fixed for merging reversed diffsRussell Belfer2013-11-011-14/+43
| | | | | | There were a lot more cases to deal with to make sure that our merged (i.e. workdir-to-tree-to-index) diffs were matching the output of core Git.
* Fix some of the glaring errors in GIT_DIFF_REVERSERussell Belfer2013-11-011-14/+24
| | | | | | | | | | | These changes fix the basic problem with GIT_DIFF_REVERSE being broken for text diffs. The reversed diff entries were getting added to the git_diff correctly, but some of the metadata was kept incorrectly in a way that prevented the text diffs from being generated correctly. Once I fixed that, it became clear that it was not possible to merge reversed diffs correctly. This has a first pass at fixing that problem. We probably need more tests to make sure that is really fixed thoroughly.
* Tweak to git_diff_delta structure for nfilesRussell Belfer2013-10-211-20/+27
| | | | | | While the base git_diff_delta structure always contains two files, when we introduce conflict data, it will be helpful to have an indicator when an additional file is involved.
* Diff API cleanupRussell Belfer2013-10-151-6/+6
| | | | | | | | This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
* Rename diff objects and split patch.hRussell Belfer2013-10-111-11/+11
| | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* Merge pull request #1804 from ethomson/rewritesVicent Martí2013-09-031-1/+5
|\ | | | | Minor changes for rewrites
| * Split rewrites, status doesn't return rewritesEdward Thomson2013-08-281-1/+5
| | | | | | | | | | | | | | | | Ensure that we apply splits to rewrites, even if we're not interested in examining it closely for rename/copy detection. In keeping with core git, status should not display rewrites, it should simply show files as "modified".
* | Trying to fix Win32 warningsRussell Belfer2013-08-221-3/+3
|/
* Update rename src map for any split srcRussell Belfer2013-08-041-1/+6
| | | | | | | | | When using a rename source that is actually a to-be-split record, we have to update the best-fit mapping data in both the case where the target is also a split record and the case where the target is a simple added record. Before this commit, we were only doing the update when the target was itself a split record (and even in that case, the test was slightly wrong).
* Major rename detection changesRussell Belfer2013-07-311-91/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After doing further profiling, I found that a lot of time was being spent attempting to insert hashes into the file hash signature when using the rolling hash because the rolling hash approach generates a hash per byte of the file instead of one per run/line of data. To optimize this, I decided to convert back to a run-based file signature algorithm which would be more like core Git. After changing this, a number of the existing tests started to fail. In some cases, this appears to have been because the test was coded to be too specific to the particular results of the file similarity metric and in some cases there appear to have been bugs in the core rename detection code where only by the coincidence of the file similarity scoring were the expected results being generated. This renames all the variables in the core rename detection code to be more consistent and hopefully easier to follow which made it a bit easier to reason about the behavior of that code and fix the problems that I was seeing. I think it's in better shape now. There are a couple of tests now that attempt to stress test the rename detection code and they are quite slow. Most of the time is spent setting up the test data on disk and in the index. When we roll out performance improvements for index insertion, it should also speed up these tests I hope.
* Fix rename detection to use actual blob sizeRussell Belfer2013-07-251-1/+7
| | | | | | | | | | | | | | | | | | The size data in the index may not reflect the actual size of the blob data from the ODB when content filtering comes into play. This commit fixes rename detection to use the actual blob size when calculating data signatures instead of the value from the index. Because of a misunderstanding on my part, I first converted the git_index_add_bypath API to use the post-filtered blob data size in creating the index entry. I backed that change out, but I kept the overall refactoring of that routine and the new internal git_blob__create_from_paths API because it eliminates an extra stat() call from the code that adds a file to the index. The existing tests actually cover this code path, at least when running on Windows, so at this point I'm not adding new tests to cover the changes.
* Make rename detection file size fix betterRussell Belfer2013-07-241-58/+58
| | | | | | | | The previous fix for checking file sizes with rename detection always loads the blob. In this version, if the odb backend can get the object header without loading the whole thing into memory, then we'll just use that, so that we can eliminate possible rename sources & targets without loading them.
* Fix rename detection for tree-to-tree diffsRussell Belfer2013-07-241-47/+98
| | | | | | | | | | | | The performance improvements I introduced for rename detection were not able to run successfully for tree-to-tree diffs because the blob size was not known early enough and so the file signature always had to be calculated nonetheless. This change separates loading blobs into memory from calculating the signature. I can't avoid having to load the large blobs into memory, but by moving it forward, I'm able to avoid the signature calculation if the blob won't come into play for renames.
* Fix incorrect commentRussell Belfer2013-07-241-1/+1
|
* Don't check rename if file size difference is hugeRussell Belfer2013-07-241-0/+9
|
* don't include ignored as rename candidatesEdward Thomson2013-07-171-1/+3
|
* Fix compilation warningsnulltoken2013-06-291-1/+1
|
* Fix rename looped reference issuesRussell Belfer2013-06-181-106/+145
| | | | | | | This makes the diff rename tracking code more careful about the order in which it processes renames and more thorough in updating the mapping of correct renames when an earlier rename update alters the index of a later matched pair.
* More tests and bug fixes for status with renameRussell Belfer2013-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | This changes the behavior of the status RENAMED flags so that they will be combined with the MODIFIED flags if appropriate. If a file is modified in the index and also renamed, then the status code will have both the GIT_STATUS_INDEX_MODIFIED and INDEX_RENAMED bits set. If it is renamed but the OID has not changed, then just the GIT_STATUS_INDEX_RENAMED bit will be set. Similarly, the flags GIT_STATUS_WT_MODIFIED and GIT_STATUS_WT_RENAMED can both be set independently of one another. This fixes a serious bug where the check for unmodified files that was done at data load time could end up erasing the RENAMED state of a file that was renamed with no changes. Lastly, this contains a bunch of new tests for status with renames, including tests where the only rename changes are case changes. The expected results of these tests have to vary by whether the platform uses a case sensitive filesystem or not, so the expected data covers those platform differences separately.
* Fix Windows warningsRussell Belfer2013-06-121-3/+3
| | | | | This fixes problems with missing function prototypes and 64-bit data issues on Windows.
* Merge pull request #1643 from ethomson/rename_sourceVicent Martí2013-06-121-17/+23
|\ | | | | Keep data about source of similarity
| * keep source similarity in rename detectionEdward Thomson2013-06-101-17/+23
| |
* | Reorganize diff and add basic diff driverRussell Belfer2013-06-101-1/+5
|/ | | | | | | | | | | | | | | | | | This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
* Fill out diff rename test coverageRussell Belfer2013-05-231-1/+1
| | | | | | | This extends the rename tests to make sure that every rename scenario in the inner loop of git_diff_find_similar is actually exercised. Also, fixes an incorrect assert that was in one of the clauses that was not previously being exercised.
* More diff rename tests; better split swap handlingRussell Belfer2013-05-231-9/+24
| | | | | | | | | | | | | This adds a couple more tests of different rename scenarios. Also, this fixes a problem with the case where you have two "split" deltas and the left half of one matches the right half of the other. That case was already being handled, but in the wrong order in a way that could result in bad output. Also, if the swap also happened to put the other two halves into the correct place (i.e. two files exchanged places with each other), then the second delta was left with the SPLIT flag set when it really should be cleared.