summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* commit: safer commit creation with reference updatecmn/commit-create-safeCarlos Martín Nieto2014-04-302-0/+13
| | | | | | | | | | | | | | The current version of the commit creation and amend function are unsafe to use when passing the update_ref parameter, as they do not check that the reference at the moment of update points to what the user expects. Make sure that we're moving history forward when we ask the library to update the reference for us by checking that the first parent of the new commit is the current value of the reference. We also make sure that the ref we're updating hasn't moved between the read and the write. Similarly, when amending a commit, make sure that the current tip of the branch is the commit we're amending.
* Reset tests: Use sandboxed indexJiri Pospisil2014-04-251-6/+3
|
* Merge pull request #2284 from jacquesg/push-progress-callbackVicent Marti2014-04-251-35/+83
|\ | | | | Fire progress and update tips callbacks also for pushes.
| * Verify update_tips callbacks in push test casesJacques Germishuys2014-04-211-35/+83
| |
* | Merge pull request #2297 from libgit2/rb/status-with-precomposed-changesVicent Marti2014-04-251-37/+164
|\ \ | | | | | | Improve test coverage of status with different core.precomposeunicode settings
| * | Improve docs for status rename detection limitsrb/status-with-precomposed-changesRussell Belfer2014-04-241-2/+5
| | | | | | | | | | | | and make tests empty on platforms without iconv support.
| * | Test toggling core.precomposeunicode yields renameRussell Belfer2014-04-241-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | There is an interesting difference with core Git here, though. Because libgit2 will do rename detection with the working directory, in the last case where the HEAD and the working directory both have the decomposed data and the index has the composed data, we generate a single status record with two renames whereas Git will generate one rename (head to index) and one untracked file.
| * | Test decomposed unicode renames work as expectedRussell Belfer2014-04-241-37/+92
| | |
* | | Merge pull request #2241 from libgit2/rb/stash-skip-submodulesVicent Marti2014-04-252-10/+40
|\ \ \ | | | | | | | | Improve stash and checkout for ignored + untracked items
| * | | Make checkout match diff for untracked/ignored dirRussell Belfer2014-04-222-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When diff finds an untracked directory, it emulates Git behavior by looking inside the directory to see if there are any untracked items inside it. If there are only ignored items inside the dir, then diff considers it ignored, even if there is no direct ignore rule for it. Checkout was not copying this behavior - when it found an untracked directory, it just treated it as untracked. Unfortunately, when combined with GIT_CHECKOUT_REMOVE_UNTRACKED, this made is seem that checkout (and stash, which uses checkout) was removing ignored items when you had only asked it to remove untracked ones. This commit moves the logic for advancing past an untracked dir while scanning for non-ignored items into an iterator helper fn, and uses that for both diff and checkout.
| * | | Failing test for stashing a buried ignored fileRussell Belfer2014-04-221-0/+13
| | | |
| * | | Make stash and checkout ignore contained reposRussell Belfer2014-04-222-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To emulate git, stash should not remove untracked git repositories inside the parent repo, and checkout's REMOVE_UNTRACKED should also skip over these items. `git stash` actually prints a warning message for these items. That should be possible with a checkout notify callback if you wanted to, although it would require a bit of extra logic as things are at the moment.
* | | | Merge pull request #2294 from ethomson/merge_checkout_strategyRussell Belfer2014-04-242-9/+27
|\ \ \ \ | |_|/ / |/| | | Merge checkout strategy
| * | | merge: checkout default shouldn't clobber givenEdward Thomson2014-04-232-10/+11
| | | |
| * | | merge: default checkout strategy for should be SAFEEdward Thomson2014-04-231-0/+17
| | | |
* | | | fetchhead: deal with quotes in branch namesCarlos Martín Nieto2014-04-242-0/+12
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | The current FETCH_HEAD parsing code assumes that a quote must end the branch name. Git however allows for quotes as part of a branch name, which causes us to consider the FETCH_HEAD file as invalid. Instead of searching for a single quote char, search for a quote char followed by SP, which is not a valid part of a ref name.
* | | Merge pull request #2291 from ethomson/patch_binaryVicent Marti2014-04-233-0/+284
|\ \ \ | | | | | | | | patch: emit deflated binary patches (optionally)
| * | | patch: emit binary patches (optionally)Edward Thomson2014-04-223-0/+284
| | |/ | |/|
* | | Merge pull request #2283 from phkelley/win32_fsVicent Marti2014-04-234-31/+637
|\ \ \ | | | | | | | | Win32: UTF-8 <-> WCHAR conversion overhaul
| * | | React to feedback for UTF-8 <-> WCHAR and reparse workPhilip Kelley2014-04-231-1/+1
| | | |
| * | | Handle win32 reparse points properlyEdward Thomson2014-04-222-0/+613
| | | |
| * | | Win32: UTF-8 <-> WCHAR conversion overhaulPhilip Kelley2014-04-192-31/+24
| |/ /
* | | 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