Commit Graph

1349 Commits

Author SHA1 Message Date
Vicent Martí
9d1751bf6e Merge pull request #1783 from libgit2/cmn/relax-remote
remote: relax the url rules
2013-08-14 06:44:28 -07:00
Carlos Martín Nieto
0b9ebb54ff remote: relax the url rules
Accept any value for the remote's url, including an empty string which
we used to reject as invalid configuration.

This is not quite what git does (although it has its own problems with
such configurations) and it makes it harder to fix the issue, by not
letting the user modify it.

As we already need to check for a valid URL when we try to connect to
the network, let that perform the check, as we don't need to do it
anywhere else.
2013-08-14 11:52:49 +02:00
Carlos Martín Nieto
5be622fb56 Test SSH in travis
Set up the ssh credentials so we are able to talk to localhost and
issue git commands. Move to use a script, as the command list is
getting somewhat long.

While here, delay installing valgrind until we need it, as it and its
dependencies are by far the largest downloads and this allows us to
start compiling (and failing) faster and we only incur this cost when
the test suite runs successfully.
2013-08-14 10:49:10 +02:00
Vicent Martí
40948998ba Merge pull request #1767 from libgit2/win32-bigger-utf8-buffer
Bigger buffer for utf-8 parsing in win32
2013-08-13 11:36:24 -07:00
Russell Belfer
ee0656012c Minor win32 fixes and improvements
This is just a bunch of small fixes that I noticed while looking
at the UTF8 and UTF16 path stuff.  It fixes a slowdown in looking
for an empty directory (not exiting loop asap), makes the dir name
in the git__DIR structure be a GIT_FLEX_ARRAY to save an allocation,
and fixes some slightly odd assumptions in the cl_getenv helper.
2013-08-13 09:53:56 -07:00
Russell Belfer
d4cff0cb1c Rename git__win32_path fns to git_win32_path 2013-08-13 09:40:32 -07:00
Vicent Marti
abf3732728 windows: Path conversion with better semantics 2013-08-13 09:15:39 +02:00
Ben Straub
423e3b0c48 Update to clar 7bf638b80 2013-08-12 11:02:53 -07:00
Carlos Martín Nieto
e54cfb9b54 odb: free object data when id is ambiguous
By the time we recognise this as an ambiguous id, the object's data
has been loaded into memory. Free it when returning EABMIGUOUS.
2013-08-12 11:50:27 +02:00
Russell Belfer
ba8b8c0407 Improve building ignore file lists
The routines to push and pop ignore files while traversing a
directory had some issues. In particular, setting up the initial
list would sometimes push an ignore file before it ought to be
applied if the starting path was a directory containing an ignore
file. Also, the pop function was not always matching the right
part of the path and would fail to pop ignores from the list in
some cases.

This adds some tests that exercise a particular problematic case
and then fixes the problems that I could find related to this.

At some point, I'd like to isolate this ignore rule management
code and rewrite it, but that's a larger project and right now,
I'll opt to just try to fix the broken behaviors.
2013-08-09 11:41:41 -07:00
Russell Belfer
4ba64794ae Revert PR #1462 and provide alternative fix
This rolls back the changes to fnmatch parsing from commit
2e40a60e84 except for the tests
that were added.  Instead this adds couple of new flags that can
be passed in when attempting to parse an fnmatch pattern.  Also,
this changes the pathspec match logic to special case matching a
filename with a '!' prefix against a negative pattern.

This fixes the build.
2013-08-09 10:52:35 -07:00
Russell Belfer
fbb6c0c84c Merge pull request #1764 from ethomson/status_renames_from_rewrites
Add rename from rewrites to status
2013-08-09 09:35:23 -07:00
Russell Belfer
33d532dcfa Merge pull request #1462 from yorah/fix/libgit2sharp-issue-379
status: fix handling of filenames with special prefixes
2013-08-09 09:32:06 -07:00
Russell Belfer
7f7ebe13c4 Merge pull request #1771 from nvloff/write_empty_config_value
config: allow setting  empty string as value
2013-08-08 12:57:13 -07:00
Nikolai Vladimirov
c57f668268 config: allow empty string as value
`git_config_set_string(config, "config.section", "")` fails when
escaping the value.

The buffer in `escape_value` is allocated without NULL-termination. And
in case of empty string 0 is passed for buffer size in `git_buf_grow`.

`git_buf_detach` returns NULL when the allocated size is 0 and that
leads to an error return in `GITERR_CHECK_ALLOC` called after
`escape_value`

The change in `config_file.c` was suggested by Russell Belfer <rb@github.com>
2013-08-08 22:25:25 +03: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
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
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
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
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
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
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
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
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
Russell Belfer
b4a4cf24a5 Add git_diff_patch_size() API
This adds a new API to get the size in bytes of the diffs in a
git_diff_patch object.
2013-07-22 16:07:56 -07:00
Russell Belfer
4cee9b8618 Update init and clean for revwalk::basic tests
The new tests don't always want to use the same fixture data as
the old ones so this makes it configurable on a per-test basis.
2013-07-22 11:41:23 -07:00
Russell Belfer
b71071313f git_reference_next_name must match git_reference_next
The git_reference_next API silently skips invalid references when
scanning the loose refs.  The git_reference_next_name API should
skip the same ones even though it isn't creating the reference
object.

This adds a test with a an invalid loose reference and makes sure
that both APIs skip the same entries and generate the same results.
2013-07-22 11:01:19 -07:00
Ben Straub
97309dd025 Merge pull request #1726 from crazymaster/development
git_buf_text_gather_stats doesn't work for multi-byte characters
2013-07-19 10:43:53 -07:00
crazymaster
d0b25d9dff Fix 2013-07-15 08:14:00 +09:00
crazymaster
2185dd6f99 Fix typo 2013-07-15 08:06:09 +09:00
crazymaster
19bee769d4 Revert "Replace Japanese characters with the encoded hexadecimal values"
This reverts commit a91e4d6b21.
2013-07-15 07:39:16 +09:00
crazymaster
a91e4d6b21 Replace Japanese characters with the encoded hexadecimal values 2013-07-15 07:30:18 +09:00
crazymaster
d6d34cd0f4 Add test for multi-byte characters 2013-07-14 21:07:40 +09:00
nulltoken
80fd31faf7 revparse: Don't return a reference when asked for a git object
Fix #1722
2013-07-13 16:07:10 +02:00
nulltoken
d6cb13d743 tests: Fix memory leak 2013-07-13 14:14:43 +02:00