summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Use git_diff_get_stats in example/diff + refactorRussell Belfer2014-04-222-391/+159
| | | | | | | | | | | | | | | | | | | | | This takes the `--stat` and related example options in the example diff.c program and converts them to use the `git_diff_get_stats` API which nicely formats stats for you. I went to add bar-graph scaling to the stats formatter and noticed that the `git_diff_stats` structure was holding on to all of the `git_patch` objects. Unfortunately, each of these objects keeps the full text of the diff in memory, so this is very expensive. I ended up modifying `git_diff_stats` to keep just the data that it needs to keep and allowed it to release the patches. Then, I added width scaling to the output on top of that. In making the diff example program match 'git diff' output, I ended up removing an newline from the sumamry output which I then had to compensate for in the email formatting to match the expectations. Lastly, I went through and refactored the tests to use a couple of helper functions and reduce the overall amount of code there.
* Fix reset for staged deletesRussell Belfer2014-04-211-2/+37
|
* Merge pull request #2279 from libgit2/rb/moar-eegnöre-fîxésVicent Marti2014-04-194-214/+227
|\ | | | | Fix several ignore and attribute file behavior bugs
| * Fix ignore difference from git with trailing /*Russell Belfer2014-04-181-0/+18
| | | | | | | | | | | | | | | | | | Ignore patterns that ended with a trailing '/*' were still needing to match against another actual '/' character in the full path. This is not the same behavior as core Git. Instead, we strip a trailing '/*' off of any patterns that were matching and just take it to imply the FNM_LEADING_DIR behavior.
| * Preload attribute files that may contain macrosRussell Belfer2014-04-181-39/+64
| | | | | | | | | | | | | | | | | | There was a latent bug where files that use macro definitions could be parsed before the macro definitions were loaded. Because of attribute file caching, preloading files that are going to be used doesn't add a significant amount of overhead, so let's always preload any files that could contain macros before we assemble the actual vector of files to scan for attributes.
| * Cleanup tests with helper functionsRussell Belfer2014-04-182-154/+83
| |
| * Pop ignore only if whole relative path matchesRussell Belfer2014-04-182-29/+70
| | | | | | | | | | | | | | | | | | | | | | When traversing the directory structure, the iterator pushes and pops ignore files using a vector. Some directories don't have ignore files, so it uses a path comparison to decide when it is right to actually pop the last ignore file. This was only comparing directory suffixes, though, so a subdirectory with the same name as a parent could result in the parent's .gitignore being popped off the list ignores too early. This changes the logic to compare the entire relative path of the ignore file.
* | Merge pull request #2213 from ethomson/safecrlfRussell Belfer2014-04-181-0/+80
|\ \ | |/ |/| Introduce core.safecrlf handling
| * Introduce core.safecrlf handlingEdward Thomson2014-04-071-0/+80
| |
* | Some memory leak fixesRussell Belfer2014-04-173-4/+10
| |
* | Fix broken logic for attr cache invalidationRussell Belfer2014-04-174-12/+17
| | | | | | | | | | | | | | The checks to see if files were out of date in the attibute cache was wrong because the cache-breaker data wasn't getting stored correctly. Additionally, when the cache-breaker triggered, the old file data was being leaked.
* | Fix race checking for existing index itemsRussell Belfer2014-04-171-2/+8
| | | | | | | | | | | | | | In the threading tests, I was still seeing a race condition where the same item could end up being inserted multiple times into the index. Preserving the sorted-ness of the index outside of the `index_insert` call fixes the issue.
* | Attribute file cache refactorRussell Belfer2014-04-176-60/+122
| | | | | | | | | | | | | | This is a big refactoring of the attribute file cache to be a bit simpler which in turn makes it easier to enforce a lock around any updates to the cache so that it can be used in a threaded env. Tons of changes to the attributes and ignores code.
* | Fix threading tests when threads disabledRussell Belfer2014-04-171-1/+2
| |
* | Index locking and entry allocation changesRussell Belfer2014-04-172-33/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add diff threading tests and attr file cache locksRussell Belfer2014-04-173-38/+188
| | | | | | | | | | | | This adds a basic test of doing simultaneous diffs on multiple threads and adds basic locking for the attr file cache because that was the immediate problem that arose from these tests.
* | Decouple index iterator sort from indexRussell Belfer2014-04-171-7/+51
| | | | | | | | | | | | | | | | 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.
* | Add public diff print helpersRussell Belfer2014-04-171-22/+7
| | | | | | | | | | | | | | The usefulness of these helpers came up for me while debugging some of the iterator changes that I was making, so since they have also been requested (albeit indirectly) I thought I'd include them.
* | Some vector utility tweaksRussell Belfer2014-04-172-24/+11
| | | | | | | | | | This is just laying some groundwork for internal index changes that I'm working on.
* | Merge pull request #2261 from jacquesg/format-patchVicent Marti2014-04-1692-0/+1096
|\ \ | | | | | | Support for format-patch
| * | Added a test case for formatting a binary patch e-mailJacques Germishuys2014-04-151-0/+43
| | |
| * | Sanitize git_diff_format_email_options' summary parameterJacques Germishuys2014-04-151-0/+68
| | | | | | | | | | | | It will form part of the subject line and should thus be one line.
| * | Introduce git_diff_format_email and git_diff_commit_as_emailJacques Germishuys2014-04-151-0/+445
| | |
| * | Introduce git_diff_get_stats, git_diff_stats_files_changed, ↵Jacques Germishuys2014-04-151-0/+428
| | | | | | | | | | | | git_diff_stats_insertions, git_diff_stats_deletions and git_diff_stats_to_buf
| * | Added git_diff_stats test filesJacques Germishuys2014-04-1589-0/+72
| | |
| * | Added RFC2822 date format test casesJacques Germishuys2014-04-111-0/+40
| | |
* | | Add GIT_BRANCH_ALL to git_branch_t enumSven Strickroth2014-04-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | git_branch_t is an enum so requesting GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE is not possible as it is not a member of the enum (at least VS2013 C++ complains about it). This fixes a regression introduced in commit a667ca8298193b3103c1dbdcb1f6c527e6e99eb2 (PR #1946). Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | | Merge pull request #2269 from libgit2/rb/fix-leading-slash-ignoresVicent Marti2014-04-164-12/+89
|\ \ \ | | | | | | | | Fix core.excludesfile named .gitignore
| * | | Fix core.excludesfile named .gitignorerb/fix-leading-slash-ignoresRussell Belfer2014-04-144-12/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ignore rules with slashes in them are matched using FNM_PATHNAME and use the path to the .gitignore file from the root of the repository along with the path fragment (including slashes) in the ignore file itself. Unfortunately, the relative path to the .gitignore file was being applied to the global core.excludesfile if that was also named ".gitignore". This fixes that with more precise matching and includes test for ignore rules with leading slashes (which were the primary example of this being broken in the real world). This also backports an improvement to the file context logic from the threadsafe-iterators branch where we don't rely on mutating the key of the attribute file name to generate the context path.
* | | | Merge pull request #2235 from jacquesg/cherry-pickVicent Marti2014-04-1594-2/+653
|\ \ \ \ | |/ / / |/| | | Add cherry pick support
| * | | Capture conflict information in MERGE_MSG for revert and mergeJacques Germishuys2014-04-142-2/+22
| | | |
| * | | Added cherry pick testsJacques Germishuys2014-04-1492-0/+631
| | | |
* | | | Merge pull request #2264 from jacquesg/fix-warningsVicent Marti2014-04-141-2/+3
|\ \ \ \ | | | | | | | | | | Correct C90 warnings
| * | | | Correct C90 warningsJacques Germishuys2014-04-111-2/+3
| | |/ / | |/| |
* | | | Merge pull request #2262 from libgit2/rb/fix-ignore-popVicent Marti2014-04-141-30/+81
|\ \ \ \ | |/ / / |/| | | Fix bug popping ignore files during wd iteration
| * | | Fix bug popping ignore files during wd iterationRussell Belfer2014-04-101-30/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were a couple bugs in popping ignore files during iteration that could result in incorrect decisions be made and thus ignore files below the root either not being loaded correctly or not being popped at the right time. One bug was an off-by-one in comparing the path of the gitignore file with the path being exited during iteration. The second bug was not correctly truncating the path being tracked during traversal if there were no ignores on the list (i.e. when you have no .gitignore at the root, but do have some in contained directories).
* | | | Merge pull request #2259 from libgit2/vmg/state-cleanupVicent Marti2014-04-091-0/+18
|\ \ \ \ | | | | | | | | | | Rewrite `state-cleanup`
| * | | | git_repository_state_cleanup() should remove rebase-merge/, rebase-apply/ ↵Jacques Germishuys2014-04-071-0/+18
| | |/ / | |/| | | | | | | | | | and BISECT_LOG
* | | | Update submodules with parent-tracked contentrb/fix-submodules-with-tracked-contentRussell Belfer2014-04-081-3/+90
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates how libgit2 treats submodule-like directories that actually have tracked content inside of them. This is a strange corner case, but it seems that many people have abortive submodule setups and then just went ahead and added the files into the parent repository. In this case, we should just treat the submodule as if it was a normal directory. Libgit2 will still try to skip over real submodules and contained repositories that do not have tracked files inside them, but this adds some new handling for cases where the apparently submodule data is in conflict with the actual list of tracked files.
* | | Merge pull request #2256 from jacquesg/graph-descendantVicent Marti2014-04-081-0/+8
|\ \ \ | |_|/ |/| | Correct grouping of parentheses
| * | Added a no path test for git_graph_descendant_ofJacques Germishuys2014-04-081-0/+8
| |/
* | Fix bug with multiple iconv conversions in one dirRussell Belfer2014-04-071-1/+11
|/ | | | | | | | The internal buffer in the `git_path_iconv_t` structure was not being reset before the calls to `iconv` were made to convert data, so if there were multiple decomposed Unicode paths in a single directory, paths after the first one were being appended to the first instead of treated as independent data.
* More ** tests for pattern rulesRussell Belfer2014-04-062-6/+54
|
* Add support for ** matches in ignoresRussell Belfer2014-04-041-0/+13
| | | | | This is an experimental addition to add ** support to fnmatch pattern matching in libgit2. It needs more testing.
* Merge pull request #2215 from libgit2/rb/submodule-cache-fixesVicent Marti2014-04-048-98/+420
|\ | | | | Improve submodule cache management
| * Test (and fix) the git_submodule_sync changesRussell Belfer2014-04-031-8/+26
| | | | | | | | | | I wrote this stuff a while ago and forgot to write tests. Wanted to do so now to wrap up the PR and immediately found problems.
| * Minor code cleanupRussell Belfer2014-04-031-30/+32
| |
| * git_submodule_resolve_url supports relative urlsJan Melcher2014-04-032-73/+115
| | | | | | | | | | | | | | | | | | | | | | The base for the relative urls is determined as follows, with descending priority: - remote url of HEAD's remote tracking branch - remote "origin" - workdir This follows git.git behaviour
| * Test git_submodule_add_setup with relative urlJan Melcher2014-04-031-0/+24
| |
| * More tests and fix submodule index refreshRussell Belfer2014-04-013-13/+129
| | | | | | | | | | | | | | | | | | | | There was a little bug where the submodule cache thought that the index date was out of date even when it wasn't that was resulting in some extra scans of index data even when not needed. Mostly this commit adds a bunch of new tests including adding and removing submodules in the index and in the HEAD and seeing if we can automatically pick them up when refreshing.