summaryrefslogtreecommitdiff
path: root/tests-clar/repo
Commit message (Collapse)AuthorAgeFilesLines
* iconv: Do not fake an API when iconv is not availableVicent Marti2013-11-011-1/+1
|
* More cleanups to remove WIN assumptionsRussell Belfer2013-10-031-14/+3
| | | | | This cleans up more of the test suite to check actual filesystem behavior instead of relying on Windows vs. Mac vs. Linux to test.
* Update repo init with fewer platform assumptionsRussell Belfer2013-10-031-44/+48
| | | | | | | | | | | | | | The repo init code was assuming Windows == no filemode, and Mac or Windows == no case sensitivity. Those assumptions are not consistently true depending on the mounted file system. This is a first step to removing those assumptions. It focuses on the repo init code and the tests of that code. There are still many other tests that are broken when those assumptions don't hold true, but this clears up one area of the code. Also, this moves the core.precomposeunicode logic to be closer to the current logic in core Git where it will be set to true on any filesystem where composed unicode is decomposed when read back.
* Add check if we need to precompose unicode on MacRussell Belfer2013-10-031-0/+10
| | | | | | | | | | | | This adds initialization of core.precomposeunicode to repo init on Mac. This is necessary because when a Mac accesses a repo on a VFAT or SAMBA file system, it will return directory entries in decomposed unicode even if the filesystem entry is precomposed. This also removes caching of a number of repo properties from the repo init pipeline because these are properties of the specific filesystem on which the repo is created, not of the system as a whole.
* Fix warnings on Windows 64-bit buildRussell Belfer2013-09-231-1/+1
|
* Add clar helper to create new commit from indexRussell Belfer2013-09-171-0/+5
| | | | | | | | There were a lot of places in the test code base that were creating a commit from the index on the current branch. This just adds a helper to handle that case pretty easily. There was only one test where this change ended up tweaking the test data, so pretty easy and mostly just a cleanup.
* No such thing as an orphan branchCarlos Martín Nieto2013-09-174-19/+19
| | | | | | | | | | | Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
* Better macro name for is-exec-bit-set testRussell Belfer2013-09-051-1/+1
|
* GIT_MODE_TYPE should exclude setgid bitsRussell Belfer2013-09-051-6/+2
| | | | | | | | | The GIT_MODE_TYPE macro was looking at all bits above the permissions, but it should really just look at the top bits so that it will give the right results for a setgid or setuid entry. Since we're now using these macros in the tests, this was causing a test failure on platforms that don't support setgid.
* Fix tests of file modesRussell Belfer2013-09-051-15/+18
| | | | | | | This fixes an issue checking file modes in the tests that initialize a repo from a template directory when a symlink is used in the template. Also, this updates some other places where we are examining file modes to use the new macros.
* Fix tests to use core.filemode correctlyRussell Belfer2013-09-041-13/+9
| | | | Some windows tests were failing
* _umask is function name on WindowsRussell Belfer2013-09-041-5/+5
|
* Make tests take umask into accountRussell Belfer2013-09-041-2/+13
| | | | | | | | It seems that libgit2 is correctly applying the umask when initializing a repository from a template and when creating new directories during checkout, but the test suite is not accounting for possible variations due to the umask. This updates that so that the test suite will work regardless of the umask.
* Improve isolation of new test from user environsRussell Belfer2013-08-161-0/+11
|
* New test that inits repo and make commitRussell Belfer2013-08-161-0/+49
|
* Add long-file-name branch to test repoBen Straub2013-08-071-1/+2
|
* Add BARE option to git_repository_open_extRussell Belfer2013-07-101-4/+61
| | | | | | | | | | | This adds a BARE option to git_repository_open_ext which allows a fast open path that still knows how to read gitlinks and to search for the actual .git directory from a subdirectory. `git_repository_open_bare` is still simpler and faster, but having a gitlink aware fast open is very useful for submodules where we want to quickly be able to peek at the HEAD and index data without doing any other meaningful repo operations.
* Add public API for pathspec matchingRussell Belfer2013-07-101-0/+385
| | | | | | | | | | | | | | | This adds a new public API for compiling pathspecs and matching them against the working directory, the index, or a tree from the repository. This also reworks the pathspec internals to allow the sharing of code between the existing internal usage of pathspec matching and the new external API. While this is working and the new API is ready for discussion, I think there is still an incorrect behavior in which patterns are always matched against the full path of an entry without taking the subdirectories into account (so "s*" will match "subdir/file" even though it wouldn't with core Git). Further enhancements are coming, but this was a good place to take a functional snapshot.
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-1/+1
| | | | | | | | | | | | | | | | | | This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
* Make iterators use GIT_ITEROVER & smart advanceRussell Belfer2013-05-311-10/+11
| | | | | | | | | | | | | | | 1. internal iterators now return GIT_ITEROVER when you go past the last item in the iteration. 2. git_iterator_advance will "advance" to the first item in the iteration if it is called immediately after creating the iterator, which allows a simpler idiom for basic iteration. 3. if git_iterator_advance encounters an error reading data (e.g. a missing tree or an unreadable file), it returns the error but also attempts to advance past the invalid data to prevent an infinite loop. Updated all tests and internal usage of iterators to account for these new behaviors.
* Merge pull request #1603 from ben/shallowVicent Martí2013-05-241-0/+33
|\ | | | | Shallow-clone detection
| * Improve test failure outputBen Straub2013-05-231-0/+33
| |
* | More tests of config with various absent filesRussell Belfer2013-05-231-2/+127
|/ | | | | Plus a bit of extra paranoia to ensure config object has valid contents.
* Fix git_repository_message docsRussell Belfer2013-05-091-1/+6
| | | | | | | | This clarifies the docs for git_repository_message and also adds to the tests to explicitly check NUL termination of data when the output buffer is smaller than the message size. There is a minor behavior change so that a non-NULL output buffer will always be NUL terminated (at length zero) if an error occurs.
* repo: unconditionally create a global config backendCarlos Martín Nieto2013-05-072-1/+76
| | | | | | | | | | | | | When a repository is initialised, we need to probe to see if there is a global config to load. If this is not the case, the user isn't able to write to the global config without creating the backend and adding it themselves, which is inconvenient and overly complex. Unconditionally create and add a backend for the global config file regardless of whether it exists as a convenience for users. To enable this, we allow creating backends to files that do not exist yet, changing the semantics somewhat, and making some tests invalid.
* Catch issue in config set with no config fileRussell Belfer2013-04-301-0/+35
| | | | | This prevents a segfault when setting a value in the config of a repository that doesn't have a config file.
* Make refcounting atomicCarlos Martín Nieto2013-04-222-8/+8
|
* Move some low-level repo fns to include/git2/sysRussell Belfer2013-04-211-0/+2
|
* Fix fs iterator test on case sensitive fsRussell Belfer2013-04-181-2/+2
|
* Fix uninitialized var warningsRussell Belfer2013-04-181-1/+1
|
* More filesystem iterator testsRussell Belfer2013-04-181-31/+103
| | | | | | Refactors the helper function that builds a directory hierarchy and then made use of it to try more variations on filesystem iterator tests.
* Add filesystem iterator variantRussell Belfer2013-04-181-0/+44
| | | | | | This adds a new variant iterator that is a raw filesystem iterator for scanning directories from a root. There is still more work to do to blend this with the working directory iterator.
* Add cl_repo_set_bool and cleanup testsRussell Belfer2013-03-222-8/+3
| | | | | | 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.
* 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).
* 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.
* 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-061-12/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-061-0/+210
| | | | | | | | | | | | 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.
* 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-261-8/+31
| | | | | | 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-261-8/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tests: fix indentation in repo/message.cScott J. Goldman2013-02-071-8/+8
|
* tests: fix indentation in repo/init.cScott J. Goldman2013-02-071-20/+20
|
* Now checks in the template test whether the description file hasSebastian Bauer2013-01-131-0/+11
| | | | | | | been properly copied. This is a minimal effort to test whether the template really has been used when creating an repo with external templates.
* Added flag GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE to ↵Sebastian Bauer2013-01-121-1/+1
| | | | | | | test_repo_init__extended_with_template(). Otherwise the template functionallity is not tested (as a TODO we also shall test that the specified template really got copied).