summaryrefslogtreecommitdiff
path: root/tests-clar
Commit message (Collapse)AuthorAgeFilesLines
* Move crlf conversion into buf_textautocrlf-fixesRussell Belfer2013-03-252-0/+83
| | | | | | | | | | | | | | This adds crlf/lf conversion functions into buf_text with more efficient implementations that bypass the high level buffer functions. They attempt to minimize the number of reallocations done and they directly write the buffer data as needed if they know that there is enough memory allocated to memcpy data. Tests are added for these new functions. The crlf.c code is updated to use the new functions. Removed the include of buf_text.h from filter.h and just include it more narrowly in the places that need it.
* Fix up checkout file contents checksRussell Belfer2013-03-255-59/+80
| | | | | | | | | | | | This fixes of the file contents checks in checkout to give slightly better error messages by directly calling the underlying clar assertions so the file and line number of the top level call can be reported correctly, and renames the helpers to not start with "test_" since that is kind of reserved by clar. This also enables some of the CRLF tests on all platforms that were previously Windows only (by pushing a check of the native line endings into the test body).
* don't convert CRLF to CRCRLFEdward Thomson2013-03-251-1/+45
|
* Test fixes and cleanupRussell Belfer2013-03-256-152/+55
| | | | | | | | This fixes some places where the new tests were leaving the test area in a bad state or were freeing data they should not free. It also removes code that is extraneous to the core issue and fixes an invalid SHA being looked up in one of the tests (which was failing, but for the wrong reason).
* Added some tests for issue #1397Sven Strickroth2013-03-2519-0/+335
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* oid: Do not parse OIDs longer than 40Vicent Marti2013-03-251-3/+1
|
* Merge pull request #1428 from xavier-l/nul-terminated-oidVicent Martí2013-03-251-0/+14
|\ | | | | Nul terminated oid
| * Clarified string valueXavier L.2013-03-211-1/+1
| |
| * Added test case for new functionXavier L2013-03-211-0/+14
| |
* | Add cl_repo_set_bool and cleanup testsRussell Belfer2013-03-2212-111/+45
| | | | | | | | | | | | This adds a helper function for the cases where you want to quickly set a single boolean config value for a repository. This allowed me to remove a lot of code.
* | Update cl_assert_equal_sz to be nicerRussell Belfer2013-03-222-7/+7
| | | | | | | | | | | | | | This makes the size_t comparison test nicer (assuming that the values are actually not using the full length), and converts some cases that were using it for pointer comparison to use the macro that is designed for pointer comparison.
* | Update to latest ClarRussell Belfer2013-03-223-23/+93
|/
* Three submodule status bug fixesRussell Belfer2013-03-1820-19/+104
| | | | | | | | | | | | | | | | 1. Fix sort order problem with submodules where "mod" was sorting after "mod-plus" because they were being sorted as "mod/" and "mod-plus/". This involved pushing the "contains a .git entry" test significantly lower in the stack. 2. Reinstate behavior that a directory which contains a .git entry will be treated as a submodule during iteration even if it is not yet added to the .gitmodules. 3. Now that any directory containing .git is reported as submodule, we have to be more careful checking for GIT_EEXISTS when we do a submodule lookup, because that is the error code that is returned by git_submodule_lookup when you try to look up a directory containing .git that has no record in gitmodules or the index.
* Merge pull request #1417 from arrbee/opts-for-pathsVicent Martí2013-03-182-11/+130
|\ | | | | Implement opts interface for global/system file search paths
| * Fixes and cleanupsRussell Belfer2013-03-181-59/+47
| | | | | | | | | | Get rid of some dead code, tighten things up a bit, and fix a bug with core::env test.
| * Switch search paths to classic delimited stringsRussell Belfer2013-03-182-26/+65
| | | | | | | | | | | | | | | | | | | | | | | | This switches the APIs for setting and getting the global/system search paths from using git_strarray to using a simple string with GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment PATH variable would contain. This makes it simpler to get and set the value. I also added code to expand "$PATH" when setting a new value to embed the old value of the path. This means that I no longer require separate actions to PREPEND to the value.
| * Implement global/system file search pathsRussell Belfer2013-03-151-6/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this work is to expose the search logic for "global", "system", and "xdg" files through the git_libgit2_opts() interface. Behind the scenes, I changed the logic for finding files to have a notion of a git_strarray that represents a search path and to store a separate search path for each of the three tiers of config file. For each tier, I implemented a function to initialize it to default values (generally based on environment variables), and then general interfaces to get it, set it, reset it, and prepend new directories to it. Next, I exposed these interfaces through the git_libgit2_opts interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants for the user to control which search path they were modifying. There are alternative designs for the opts interface / argument ordering, so I'm putting this phase out for discussion. Additionally, I ended up doing a little bit of clean up regarding attr.h and attr_file.h, adding a new attrcache.h so the other two files wouldn't have to be included in so many places.
* | Merge pull request #1080 from carlosmn/config-set-nullVicent Martí2013-03-182-2/+16
|\ \ | |/ |/| Failing config related test
| * config: don't allow passing NULL as a value to setCarlos Martín Nieto2013-03-092-2/+16
| | | | | | | | | | | | Passing NULL is non-sensical. The error message leaves to be desired, though, as it leaks internal implementation details. Catch it at the `git_config_set_string` level and set an appropriate error message.
* | Merge pull request #1413 from arrbee/more-iterator-refactorVicent Martí2013-03-152-0/+52
|\ \ | | | | | | Further tree_iterator refactoring
| * | Fix valgrind issues (and mmap fallback for diff)Russell Belfer2013-03-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a number of issues identified by valgrind - mostly missed free calls. Inside valgrind, mmap() may fail which causes some of the diff tests to fail. This adds a fallback code path to diff_output.c:get_workdir_content() where is the mmap() fails the code will now try to read the file data directly into allocated memory (which is what it would do if the data needed to be filtered anyhow).
| * | Improved tree iterator internalsRussell Belfer2013-03-141-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the tree iterator internals to be more efficient. The tree_iterator_entry objects are now kept as pointers that are allocated from a git_pool, so that we may use git__tsort_r for sorting (which is better than qsort, given that the tree is likely mostly ordered already). Those tree_iterator_entry objects now keep direct pointers to the data they refer to instead of keeping indirect index values. This simplifies a lot of the data structure traversal code. This also adds bsearch to find the start item position for range- limited tree iterators, and is more explicit about using git_path_cmp instead of reimplementing it. The git_path_cmp changed a bit to make it easier for tree_iterators to use it (but it was barely being used previously, so not a big deal). This adds a git_pool_free_array function that efficiently frees a list of pool allocated pointers (which the tree_iterator keeps). Also, added new tests for the git_pool free list functionality that was not previously being tested (or used).
* | | Fix various build warningsRussell Belfer2013-03-143-3/+5
|/ / | | | | | | This fixes various build warnings on Mac and Windows (64-bit).
* | Fix workdir iterator bugsRussell Belfer2013-03-131-4/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two bugs with the workdir iterator depth check: first that the depth was not being decremented and second that empty directories were counting against the depth even though a frame was not being created for them. This also fixes a bug with the ENOTFOUND return code for workdir iterators when you attempt to advance_into an empty directory. Actually, that works correctly, but it was incorrectly being propogated into regular advance() calls in some circumstances. Added new tests for the above that create a huge hierarchy on the fly and try using the workdir iterator to traverse it.
* | Merge pull request #1408 from arrbee/refactor-iteratorsVicent Martí2013-03-1236-40/+829
|\ \ | | | | | | Refactor iterators
| * | Stabilize order for equiv tree iterator entriesRussell Belfer2013-03-111-9/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given a group of case-insensitively equivalent tree iterator entries, this ensures that the case-sensitively first trees will be used as the representative items. I.e. if you have conflicting entries "A/B/x", "a/b/x", and "A/b/x", this change ensures that the earliest entry "A/B/x" will be returned. The actual choice is not that important, but it is nice to have it stable and to have it been either the first or last item, as opposed to a random item from within the equivalent span.
| * | Fix tree iterator advance using wrong name compareRussell Belfer2013-03-111-0/+55
| | | | | | | | | | | | | | | | | | | | | Tree iterator advance was moving forward without taking the filemode of the entries into account, equating "a" and "a/". This makes the tree entry comparison code more easily reusable and fixes the problem.
| * | Fix tree iterator path for tree issue + cleanupsRussell Belfer2013-03-111-0/+16
| | | | | | | | | | | | | | | | | | | | | This fixes an off by one error for generating full paths for tree entries in tree iterators when INCLUDE_TREES is set. Also, contains a bunch of small code cleanups with a couple of small utility functions and macro changes to eliminate redundant code.
| * | Use correct case path in icase tree iteratorRussell Belfer2013-03-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If there are case-ambiguities in the path of a case insensitive tree iterator, it will now rewrite the entire path when it gives the path name to an entry, so a tree with "A/b/C/d.txt" and "a/B/c/E.txt" will give the true full paths (instead of case- folding them both to "A/B/C/d.txt" or "a/b/c/E.txt" or something like that.
| * | Add tests for case insensitive tree iteratorRussell Belfer2013-03-101-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a test case for ci tree iteration when there is a name conflict. This points out a behavior quirk in the current version that I'd like to fix - namely, all tree entries get mapped to one version of the case pattern in the ci code - i.e. even if you have A/1.txt and a/2.txt, both will be reported as a/1.txt and a/2.txt because we only copy the name of a file at a given frame once. It would be nice to fix this, but I'm worried about how complex that is if you get a/B/c/1.txt and A/b/C/2.txt. It may require a walk up the frames whenever you advance to the next item in a blended equivalence class.
| * | Make tree iterator handle icase equivalenceRussell Belfer2013-03-081-51/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a serious bug in the previous tree iterator implementation. If case insensitivity resulted in member elements being equivalent to one another, and those member elements were trees, then the children of the colliding elements would be processed in sequence instead of in a single flattened list. This meant that the tree iterator was not truly acting like a case-insensitive list. This completely reworks the tree iterator to manage lists with case insensitive equivalence classes and advance through the items in a unified manner in a single sorted frame. It is possible that at a future date we might want to update this to separate the case insensitive and case sensitive tree iterators so that the case sensitive one could be a minimal amount of code and the insensitive one would always know what it needed to do without checking flags. But there would be so much shared code between the two, that I'm not sure it that's a win. For now, this gets what we need. More tests are needed, though.
| * | Add INCLUDE_TREES, DONT_AUTOEXPAND iterator flagsRussell Belfer2013-03-062-19/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This standardizes iterator behavior across all three iterators (index, tree, and working directory). Previously the working directory iterator behaved differently from the other two. Each iterator can now operate in one of three modes: 1. *No tree results, auto expand trees* means that only non- tree items will be returned and when a tree/directory is encountered, we will automatically descend into it. 2. *Tree results, auto expand trees* means that results will be given for every item found, including trees, but you only need to call normal git_iterator_advance to yield every item (i.e. trees returned with pre-order iteration). 3. *Tree results, no auto expand* means that calling the normal git_iterator_advance when looking at a tree will not descend into the tree, but will skip over it to the next entry in the parent. Previously, behavior 1 was the only option for index and tree iterators, and behavior 3 was the only option for workdir. The main public API implications of this are that the `git_iterator_advance_into()` call is now valid for all iterators, not just working directory iterators, and all the existing uses of working directory iterators explicitly use the GIT_ITERATOR_DONT_AUTOEXPAND (for now). Interestingly, the majority of the implementation was in the index iterator, since there are no tree entries there and now have to fake them. The tree and working directory iterators only required small modifications.
| * | Make iterator APIs consistent with standardsRussell Belfer2013-03-0636-37/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The iterator APIs are not currently consistent with the parameter ordering of the rest of the codebase. This rearranges the order of parameters, simplifies the naming of a number of functions, and makes somewhat better use of macros internally to clean up the iterator code. This also expands the test coverage of iterator functionality, making sure that case sensitive range-limited iteration works correctly.
* | | handle small files in similarity metricsEdward Thomson2013-03-111-0/+33
| | |
* | | diff: allow asking for diffs with no contextCarlos Martín Nieto2013-03-091-0/+2
| |/ |/| | | | | | | | | | | | | | | Previously, 0 meant default. This is problematic, as asking for 0 context lines is a valid thing to do. Change GIT_DIFF_OPTIONS_INIT to default to three and stop treating 0 as a magic value. In case no options are provided, make sure the options in the diff object default to 3.
* | Merge pull request #1403 from ethomson/tracingVicent Martí2013-03-071-0/+86
|\ \ | | | | | | Optional tracing back to consumers
| * | optional tracingEdward Thomson2013-03-071-0/+86
| | |
* | | immutable references and a pluggable ref databaseEdward Thomson2013-03-0720-93/+730
|/ /
* | refs: explicitly catch leading slashesCarlos Martín Nieto2013-03-071-0/+6
|/ | | | | | | | | | It's somewhat common to try to write "/refs/tags/something". There is no easy way to catch it during the main body of the function, as there is no way to distinguish whether it's a leading slash or a double slash somewhere in the middle. Catch this at the beginning so we don't trigger the assert in is_all_caps_and_underscore().
* No longer need clar_main.cRussell Belfer2013-03-061-3453/+0
|
* added missing free for git_note in clar testsNico von Geyso2013-03-061-0/+2
|
* fixed minor issues with new note iteratorNico von Geyso2013-03-061-9/+8
| | | | | * fixed style issues * use new iterator functions for git_note_foreach()
* use git_note_iterator type instead of non-public git_iterator oneNico von Geyso2013-03-062-3/+3458
|
* basic note iterator implementationNico von Geyso2013-03-061-1/+66
| | | | | * git_note_iterator_new() - create a new note iterator * git_note_next() - retrieves the next item of the iterator
* remote push test fixEdward Thomson2013-03-051-1/+2
|
* Merge pull request #1369 from arrbee/repo-init-template-hooksVicent Martí2013-03-054-9/+148
|\ | | | | More tests (and fixes) for initializing repo from template
| * Make mode handling during init more like gitRussell Belfer2013-02-271-34/+39
| | | | | | | | | | | | | | | | | | | | | | When creating files, instead of actually using GIT_FILEMODE_BLOB and the other various constants that happen to correspond to mode values, apparently I should be just using 0666 and 0777, and relying on the umask to clear bits and make the value sane. This fixes the rules for copying a template directory and fixes the checks to match that new behavior. (Further changes to the checkout logic to follow separately.)
| * Fix portability issues on WindowsRussell Belfer2013-02-262-9/+32
| | | | | | | | | | | | The new tests were not taking core.filemode into account when testing file modes after repo initialization. Fixed that and some other Windows warnings that have crept in.
| * Fix initialization of repo directoriesRussell Belfer2013-02-263-8/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When PR #1359 removed the hooks from the test resources/template directory, it made me realize that the tests for git_repository_init_ext using templates must be pretty shabby because we could not have been testing if the hooks were getting created correctly. So, this started with me recreating a couple of hooks, including a sample and symlink, and adding tests that they got created correctly in the various circumstances, including with the SHARED modes, etc. Unfortunately this uncovered some issues with how directories and symlinks were copied and chmod'ed. Also, there was a FIXME in the code related to the chmod behavior as well. Going back over the directory creation logic for setting up a repository, I found it was a little difficult to read and could result in creating and/or chmod'ing directories that the user almost certainly didn't intend. So that let to this work which makes repo initialization much more careful (and hopefully easier to follow). It required a couple of extensions / changes to core fileops utilities, but I also think those are for the better, at least for git_futils_cp_r in terms of being careful about what actions it takes.
* | clear REUC on checkoutEdward Thomson2013-03-041-0/+85
| |