summaryrefslogtreecommitdiff
path: root/tests/index/tests.c
Commit message (Collapse)AuthorAgeFilesLines
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-2/+2
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* index: use new enum and structure namesEdward Thomson2018-12-011-6/+6
| | | | Use the new-style index names throughout our own codebase.
* index: introduce git_index_iteratorethomson/index_iteratorEdward Thomson2018-11-141-3/+90
| | | | | | Provide a public git_index_iterator API that is backed by an index snapshot. This allows consumers to provide a stable iteration even while manipulating the index during iteration.
* index: add failing test for writing an invalid tree from an unowned indexCarlos Martín Nieto2018-10-081-0/+24
| | | | | | | | | | When the index does not belong to any repository, we do not do any checks of the target id going in as we cannot verify that it exists. When we then write it out to a repository as a tree, we fail to perform the object existance and type-matching check that we do in other code-paths. This leads to being able to write trees which point to non-existent blobs even with strict object creation enabled.
* settings: optional unsaved index safetyEdward Thomson2018-06-291-1/+15
| | | | | | | | | | | | | | Add the `GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY` option, which will cause commands that reload the on-disk index to fail if the current `git_index` has changed that have not been saved. This will prevent users from - for example - adding a file to the index then calling a function like `git_checkout` and having that file be silently removed from the index since it was re-read from disk. Now calls that would re-read the index will fail if the index is "dirty", meaning changes have been made to it but have not been written. Users can either `git_index_read` to discard those changes explicitly, or `git_index_write` to write them.
* index: return a unique error code on dirty indexEdward Thomson2018-06-291-0/+22
| | | | | When the index is dirty, return GIT_EINDEXDIRTY so that consumers can identify the exact problem programatically.
* index: test dirty index bitEdward Thomson2018-06-291-0/+53
| | | | | | | | | | Test that any changes to the index will mark the index as dirty. Also ensure that when we initialize a new index, read the index contents from disk, or write the index contents to disk that we reset the dirty flag to zero. Further ensure that an unforced read with dirty contents (when the on-disk index has not changed) does _not_ reset the dirty flag as we have not updated the contents of our index and our unsaved contents remain intact.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-6/+6
|
* tests: index::tests: create sandboxed repo for lockingPatrick Steinhardt2017-06-231-1/+5
| | | | | | | | | | The test `index::tests::can_lock_index` operates on the "testrepo.git" repository located inside of our source tree. While this is okay for tests which do read-only operations on these resouces, this specific test tries to lock the index by creating a lock. This will obviously fail on out-of-tree builds with read-only source trees. Fix the issue by creating a sandbox first.
* git_futils_mkdir_*: make a relative-to-base mkdirEdward Thomson2015-09-171-1/+1
| | | | | | | | | | | | Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter assumes that we own everything beneath the base, as if it were being called with a base of the repository or working directory, and is tailored towards checkout and ensuring that there is no bogosity beneath the base that must be cleaned up. This is (at best) slow and (at worst) unsafe in the larger context of a filesystem where we do not own things and cannot do things like unlink symlinks that are in our way.
* Merge pull request #3381 from leoyanggit/index_directory_iteratorEdward Thomson2015-09-081-0/+21
|\ | | | | New feature: add the ablility to iterate through a directory in index
| * New API: git_index_find_prefixLeo Yang2015-09-041-0/+21
| | | | | | | | Find the first index entry matching a prefix.
* | index: add tests around case switchingCarlos Martín Nieto2015-08-141-0/+33
|/ | | | | We were missing tests for switching the case-sensitivity of an index in-memory and then looking up entries in it.
* index: user a better assertion when comparing sizesCarlos Martín Nieto2015-06-191-2/+2
| | | | | This will tell us which numbers we were trying to compare, rather than just telling us that they're different.
* Add API to add a memory buffer to an indexDamien PROFETA2015-02-251-0/+122
| | | | | | git_index_add_frombuffer enables now to store a memory buffer in the odb and to store an entry in the index directly if the index is attached to a repository.
* git_indexwriter: lock then write the indexEdward Thomson2015-02-141-0/+21
| | | | | | Introduce `git_indexwriter`, to allow us to lock the index while performing additional operations, then complete the write (or abort, unlocking the index).
* index tests: test capitalization before mkdirhf/master_patchEdward Thomson2014-12-181-2/+4
|
* Plug leaksCarlos Martín Nieto2014-12-181-0/+2
|
* Create miscapitialised dirs for case-sensitive filesystemsCarlos Martín Nieto2014-12-181-0/+4
| | | | | We need these directories to exist so cl_git_mkfile() can create the files we ask it to.
* treebuilder: take a repository for path validationEdward Thomson2014-12-171-0/+21
| | | | | | Path validation may be influenced by `core.protectHFS` and `core.protectNTFS` configuration settings, thus treebuilders can take a repository to influence their configuration.
* index: Check for valid paths before creating an index entryVicent Marti2014-12-161-8/+93
|
* Spelling fixesWill Stamper2014-12-041-1/+1
|
* Introduce cl_assert_equal_oidEdward Thomson2014-07-011-4/+4
|
* Some vector utility tweaksRussell Belfer2014-04-171-17/+3
| | | | | This is just laying some groundwork for internal index changes that I'm working on.
* Fix typo setting sorted flag when reloading indexRussell Belfer2014-02-041-0/+34
| | | | | | | This fixes a typo I made for setting the sorted flag on the index after a reload. That typo didn't actually cause any test failures so I'm also adding a test that explicitly checks that the index is correctly sorted after a reload when ignoring case and when not.
* Convert pqueue to just be a git_vectorRussell Belfer2014-02-041-4/+4
| | | | | | | | | | | | | This updates the git_pqueue to simply be a set of specialized init/insert/pop functions on a git_vector. To preserve the pqueue feature of having a fixed size heap, I converted the "sorted" field in git_vectors to a more general "flags" field so that pqueue could mix in it's own flag. This had a bunch of ramifications because a number of places were directly looking at the vector "sorted" field - I added a couple new git_vector helpers (is_sorted, set_sorted) so the specific representation of this information could be abstracted.
* index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-4/+4
| | | | This was not converted when we converted the rest, so do it now.
* tests: Drop unrelated commentnulltoken2013-11-191-1/+0
|
* tree-cache: Don't segfault upon corruptionnulltoken2013-11-191-0/+9
|
* Rename tests-clar to testsBen Straub2013-11-141-0/+537