Commit Graph

5254 Commits

Author SHA1 Message Date
Edward Thomson
a1f69452a2 git_strndup fix when OOM 2013-08-08 12:36:11 -05:00
Edward Thomson
57f31f058c Fixes to safely reading the index
Avoid wrapping around extension size when reading, avoid walking off
the end of the buffer when reading names.
2013-08-08 12:32:23 -05:00
Ben Straub
5e96f31638 Merge pull request #1738 from libgit2/diff-patch-content-size
Add API for getting at git_diff_patch->content_size
2013-08-08 08:54:38 -07:00
Ben Straub
bf145a6a2f Merge pull request #1746 from libgit2/rename-detection-performance
Rename detection slow
2013-08-08 08:53:37 -07:00
Ben Straub
aaefbdeea2 Discriminate path-specific and general UTF-X conversions 2013-08-08 08:48:57 -07:00
Russell Belfer
46c3791115 Merge pull request #1638 from brodie/brodie/handle-duplicate-objects-across-packs
odb_pack: handle duplicate objects from different packs
2013-08-08 07:50:59 -07:00
Brodie Rao
d19bcb3352 odb_pack: handle duplicate objects from different packs
This is based on 24634c6fd0.

This also corrects an issue with error codes being mixed up with the
number of found objects.
2013-08-08 00:41:16 -07:00
Ben Straub
2c0128ee79 Rename git_win_str_utf* to git_win32_path_utf* 2013-08-07 19:29:33 -07:00
Ben Straub
9c38f7a652 Add typedefs for win32 utf-8 and utf-16 buffers
...and normalize the signatures of the two conversion functions.
2013-08-07 13:22:41 -07:00
Ben Straub
75f98a95ee Add checkout test for long file name 2013-08-07 11:55:47 -07:00
Ben Straub
c0c5169352 Add long-file-name branch to test repo 2013-08-07 11:55:39 -07:00
Ben Straub
2984f3190e Don't use win32-only macro in test code 2013-08-07 11:47:56 -07:00
Ben Straub
8c8a549010 Add status test for long paths 2013-08-07 11:47:56 -07:00
Russell Belfer
c7d4904c47 Merge pull request #1769 from ethomson/configparse
Parse config headers with quoted quotes
2013-08-07 10:38:41 -07:00
Edward Thomson
2d9f5b9f13 Parse config headers with quoted quotes
Parse config headers that have the last quote on the
line quoted instead of walking off the end.
2013-08-07 12:38:09 -05:00
Russell Belfer
c5780abb02 Merge pull request #1765 from arrbee/ambiguous-oids
More tests for ambiguous OIDs across packs
2013-08-05 21:58:48 -07:00
Russell Belfer
437224b4b9 More tests for ambiguous OIDs across packs
The test coverage for ambiguous OIDs was pretty thin.  This adds
a bunch of new objects both in packs, across packs, and loose that
match to 8 characters so that we can test various cases of
ambiguous lookups.
2013-08-05 21:46:32 -07:00
Russell Belfer
ee77378d9b Merge pull request #1763 from nvloff/nameless_submodule_segfault
submodule: check alloc and name presence
2013-08-05 13:33:44 -07:00
Edward Thomson
e38f0d69ab Add rename from rewrites to status
In git_diff_paired_foreach, temporarily resort the
index->workdir diff list by index path so that we can
track a rename in the workdir from head->index->workdir.
2013-08-05 14:09:56 -05:00
Nikolai Vladimirov
f1af935b89 submodule: check alloc and name presense 2013-08-05 22:00:55 +03:00
Ben Straub
d85636190f Split UTF-16 and UTF-8 buffer sizes for win32
Also fixed up call-sites to use the correct buffer sizes, especially
when converting to utf-8.
2013-08-05 11:41:39 -07:00
Russell Belfer
9b7d02ff2d Update submodule documentation
Fixes #1762
2013-08-05 10:53:39 -07:00
Russell Belfer
e8242022bc Move slow tests to "stress" clar module
Create a new section of clar tests "stress" that will default to
being off where we can put slow tests that push the library for
performance testing purposes.
2013-08-05 09:59:02 -07:00
Russell Belfer
31b42eacce Restore commented out tests
This restores the commented out tests (even though they're slow)
and fixes some trailing whitespace.
2013-08-04 14:09:44 -07:00
Edward Thomson
0a38eb42ca Rename test for rename from rewrite
A rename test that illustrates a rename from a rewrite.
2013-08-04 14:08:51 -07:00
Russell Belfer
7edb74d374 Update rename src map for any split src
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).
2013-08-04 14:06:13 -07:00
Edward Thomson
a42c2a8c89 Rename test for multiple similar matches
A rename test that illustrates a source matching multiple targets.
2013-08-04 13:44:51 -07:00
Russell Belfer
d730d3f4f0 Major rename detection changes
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.
2013-07-31 16:40:42 -07:00
Carlos Martín Nieto
1cd0acf672 Merge pull request #1748 from arthurschreiber/patch-1
Allow Makefile.embed to be used when cross-compiling
2013-07-31 10:43:56 -07:00
Arthur Schreiber
a6837b5fc9 When building with MINGW, specify __USE_MINGW_ANSI_STDIO.
This option is already present in the CMake config, but was missing from `Makefile.embed` and would cause all kinds of weird failures when compiling rugged on windows with the ruby devkit.
2013-07-31 19:13:35 +02:00
Ben Straub
94d12ffab7 Merge pull request #1755 from csware/double-close
Fix possible double close
2013-07-28 08:39:41 -07:00
Vicent Martí
a873449f1c Merge pull request #1753 from 13ren/log-bugfix
Fix -n bug; default to all ancestors
2013-07-27 17:00:21 -07:00
Sven Strickroth
f5254d7844 Fix possible double close
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2013-07-27 20:15:06 +02:00
Brendan Macmillan
c3ae047361 Fix -n bug; default to all ancestors 2013-07-27 05:34:49 +10:00
Russell Belfer
8dd8aa480b Fix some warnings 2013-07-26 10:28:57 -07:00
Russell Belfer
a16e41729d Fix rename detection to use actual blob size
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.
2013-07-25 12:27:39 -07:00
Vicent Martí
d477a9ab7e Merge pull request #1749 from csware/handle-fixes
Close p->mwf.fd only if necessary
2013-07-25 06:44:56 -07:00
Sven Strickroth
3a2d48d5ee Close p->mwf.fd only if necessary
This fixes a regression introduced in revision 9d2f841a5d.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2013-07-25 15:21:55 +02:00
Russell Belfer
effdbeb323 Make rename detection file size fix better
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.
2013-07-24 17:48:37 -07:00
Russell Belfer
a5140f4dda Fix rename detection for tree-to-tree diffs
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.
2013-07-24 17:11:49 -07:00
Arthur Schreiber
847c679309 Allow Makefile.embed to be used when cross-compiling
This allows libgit2 to be cross-compiled (e.g. when building native rugged binaries for windows from Linux or OS X).

```
CROSS_COMPILE=i686-w64-mingw32 make -f Makefile.embed
```
2013-07-25 00:26:51 +02:00
Russell Belfer
f5c4d02251 Fix incorrect comment 2013-07-24 13:44:35 -07:00
Russell Belfer
397357a048 Add rename test that used to be really slow
Before the optimization commits, this test used to take about 20
seconds to run on my machine.  Afterwards, there is still a couple
seconds of data setup, but the actual diff and rename detection
runs in a fraction of a second.
2013-07-24 13:12:00 -07:00
Russell Belfer
427cc255df Use local variables in hash calc to avoid aliasing 2013-07-24 13:11:11 -07:00
Russell Belfer
18e9efc425 Don't check rename if file size difference is huge 2013-07-24 13:10:16 -07:00
Russell Belfer
69c66b554e Don't do text diff unless content will be used 2013-07-24 13:09:33 -07:00
Russell Belfer
39a1a66242 Don't unload diff data unless loaded 2013-07-24 13:09:07 -07:00
Russell Belfer
eb1c1707ab Restore GIT_DIFF_LINE_BINARY usage
This restores the usage of GIT_DIFF_LINE_BINARY for the diff
output line that reads "Binary files x and y differ" so that it
can be optionally colorized independently of the file header.
2013-07-23 15:45:58 -07:00
Russell Belfer
df40f3981c Make compact output more like core Git 2013-07-23 15:18:28 -07:00
Russell Belfer
197b8966db Add hunk/file headers to git_diff_patch_size
This allows git_diff_patch_size to account for hunk headers and
file headers in the returned size.  This required some refactoring
of the code that is used to print file headers so that it could be
invoked by the git_diff_patch_size API.

Also this increases the test coverage and fixes an off-by-one bug
in the size calculation when newline changes happen at the end of
the file.
2013-07-23 14:34:31 -07:00