summaryrefslogtreecommitdiff
path: root/tests/index
Commit message (Collapse)AuthorAgeFilesLines
* tests: index: do not re-allocate indexPatrick Steinhardt2016-08-291-2/+0
| | | | | | Plug a memory leak caused by re-allocating a `git_index` structure which has already been allocated by the test suite's initializer.
* index: support index v4David Turner2016-08-101-0/+41
| | | | | | | Support reading and writing index v4. Index v4 uses a very simple compression scheme for pathnames, but is otherwise similar to index v3. Signed-off-by: David Turner <dturner@twitter.com>
* odb: actually insert the empty blob in testsethomson/empty_blobEdward Thomson2016-08-051-31/+29
|
* index: include conflicts in `git_index_read_index`ethomson/read_index_conflictsEdward Thomson2016-06-293-8/+112
| | | | | | Ensure that we include conflicts when calling `git_index_read_index`, which will remove conflicts in the index that do not exist in the new target, and will add conflicts from the new target.
* test: ensure we can round-trip a written treeEdward Thomson2016-06-021-0/+23
| | | | | Read a tree into an index, write the index, then re-open the index and ensure that we are treesame to the original.
* round-trip trees through index_read_indexEdward Thomson2016-06-021-0/+32
| | | | | | | Read a tree into an index using `git_index_read_index` (by reading a tree into a new index, then reading that index into the current index), then write the index back out, ensuring that our new index is treesame to the tree that we read.
* tests: nsec: correctly free nsec_pathPatrick Steinhardt2016-03-111-2/+2
| | | | | | git_buf_clear does not free allocated memory associated with a git_buf. Use `git_buf_free` instead to correctly free its memory and plug the memory leak.
* index::racy: force racy entryEdward Thomson2016-03-081-19/+12
| | | | | Instead of hoping that we can get a racy entry by going real fast and praying real hard, just create a racy entry.
* index::nsec: don't expect shit filesystems to not suckEdward Thomson2016-03-071-9/+51
| | | | | | If the underlying filesystem doesn't support better than one second resolution, then don't expect that turning on `GIT_USE_NSEC` does anything magical to change that.
* turn on strict object validation by defaultEdward Thomson2016-02-281-18/+18
|
* tests: use legitimate object idsEdward Thomson2016-02-285-24/+30
| | | | | Use legitimate (existing) object IDs in tests so that we have the ability to turn on strict object validation when running tests.
* git_index_add: validate objects in index entries (optionally)Edward Thomson2016-02-281-0/+84
| | | | | When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate the index entries given to `git_index_add`.
* nsec: update staging test for GIT_USE_NSECSEdward Thomson2016-02-251-0/+9
| | | | | | | | The index::nsec::staging_maintains_other_nanos test was created to ensure that when we stage an entry when GIT_USE_NSECS is *unset* that we truncate the index entry and do not persist the (old, invalid) nanosec values. Ensure that when GIT_USE_NSECS is *set* that we do not do that, and actually write the correct nanosecond values.
* win32: introduce p_timeval that isn't stupidEdward Thomson2016-02-121-1/+1
| | | | | Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
* typos in commentsDmitriy Olshevskiy2015-12-211-1/+1
|
* tests: fix warning for nested struct initializationPatrick Steinhardt2015-11-301-1/+1
|
* Fix some warningsJacques Germishuys2015-11-201-1/+0
|
* racy: make git_index_read_index handle racinessEdward Thomson2015-11-161-0/+48
| | | | | | | | | | | Ensure that `git_index_read_index` clears the uptodate bit on files that it modifies. Further, do not propagate the cache from an on-disk index into another on-disk index. Although this should not be done, as `git_index_read_index` is used to bring an in-memory index into another index (that may or may not be on-disk), ensure that we do not accidentally bring in these bits when misused.
* racy: ensure git_index_read_tree clears uptodateEdward Thomson2015-11-161-0/+28
| | | | | Ensure that `git_index_read_tree` clears the uptodate bit on files that it modifies.
* index: test for smudged entries on write onlyEdward Thomson2015-11-161-7/+35
| | | | | | | | | | | | | | | | Test that entries are only smudged when we write the index: the entry smudging is to prevent us from updating an index in a way that it would be impossible to tell that an item was racy. Consider when we load an index: any entries that have the same (or newer) timestamp than the index itself are considered racy, and are subject to further scrutiny. If we *save* that index with the same entries that we loaded, then the index would now have a newer timestamp than the entries, and they would no longer be given that additional scrutiny, failing our racy detection! So test that we smudge those entries only on writing the new index, but that we can detect them (in diff) without having to write.
* index: don't detect raciness in uptodate entriesEdward Thomson2015-11-161-0/+77
| | | | | | | | | | | Keep track of entries that we believe are up-to-date, because we added the index entries since the index was loaded. This prevents us from unnecessarily examining files that we wrote during the cleanup of racy entries (when we smudge racily clean files that have a timestamp newer than or equal to the index's timestamp when we read it). Without keeping track of this, we would examine every file that we just checked out for raciness, since all their timestamps would be newer than the index's timestamp.
* Merge pull request #3170 from CmdrMoozy/nsec_fixCarlos Martín Nieto2015-11-121-8/+8
|\ | | | | git_index_entry__init_from_stat: set nsec fields in entry stats
| * Merge branch 'master' into nsec_fix_nextAxel Rasmussen2015-10-011-0/+5
| |\
| * | diff/index: respect USE_NSEC for racily clean file detectionAxel Rasmussen2015-09-181-8/+8
| | |
* | | Failing test for case sensitive conflicts in the indexnulltoken2015-11-121-0/+91
| | |
* | | index: test that add_bypath preserves symlinksEdward Thomson2015-11-031-0/+29
| | | | | | | | | | | | | | | | | | Test that on platforms without `core.symlinks`, we preserve symlinks in `git_index_add_bypath`. (Users should correct the actual index entry's mode to change a link to a regular file.)
* | | index: test that we round-trip nsecsEdward Thomson2015-10-221-0/+78
| | | | | | | | | | | | | | | | | | | | | Test that nanoseconds are round-tripped correctly when we read an index file that contains them. We should, however, ignore them because we don't understand them, and any new entries in the index should contain a `0` nsecs field, while existing preserving entries.
* | | index: also try conflict mode when insertingEdward Thomson2015-09-301-1/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we do not trust the on-disk mode, we use the mode of an existing index entry. This allows us to preserve executable bits on platforms that do not honor them on the filesystem. If there is no stage 0 index entry, also look at conflicts to attempt to answer this question: prefer the data from the 'ours' side, then the 'theirs' side before falling back to the common ancestor.
* | | index: test that add_bypath preserves modeEdward Thomson2015-09-291-0/+23
| |/ |/|
* | Plug some leaksCarlos Martín Nieto2015-09-271-0/+5
|/
* 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 #3353 from ethomson/wrongcase_addCarlos Martín Nieto2015-09-082-0/+199
|\ | | | | index: canonicalize directory case when adding
| * git_index_add: allow case changing renamesEdward Thomson2015-09-082-0/+51
| | | | | | | | | | | | | | | | | | | | | | On case insensitive platforms, allow `git_index_add` to provide a new path for an existing index entry. Previously, we would maintain the case in an index entry without the ability to change it (except by removing an entry and re-adding it.) Higher-level functions (like `git_index_add_bypath` and `git_index_add_frombuffers`) continue to keep the old path for easier usage.
| * index: canonicalize directory case when addingEdward Thomson2015-09-081-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On case insensitive systems, when given a user-provided path in the higher-level index addition functions (eg `git_index_add_bypath` / `git_index_add_frombuffer`), examine the index to try to match the given path to an existing directory. Various mechanisms can cause the on-disk representation of a folder to not match the representation in HEAD or the index - for example, a case changing rename of some file `a/file.txt` to `A/file.txt` will update the paths in the index, but not rename the folder on disk. If a user subsequently adds `a/other.txt`, then this should be stored in the index as `A/other.txt`.
* | 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.
* | Merge pull request #3366 from libgit2/cmn/index-hashmapEdward Thomson2015-09-062-0/+34
|\ \ | |/ |/| Use a hashmap for path-based lookups in the index
| * index: add tests around case switchingCarlos Martín Nieto2015-08-142-0/+34
| | | | | | | | | | We were missing tests for switching the case-sensitivity of an index in-memory and then looking up entries in it.
* | win32: ensure hidden files can be stagedEdward Thomson2015-08-032-0/+61
|/
* index: test that an unregistered submodule gets stagedCarlos Martín Nieto2015-08-011-1/+7
| | | | | | When we pass the path of a repository to `_bypath()`, we should behave like git and stage it as a `_COMMIT` regardless of whether it is registered a a submodule.
* index: add test for adding an old-style submodule to indexLinquize2015-08-011-0/+7
|
* index: allow add_bypath to update submodulescmn/index-add-submoduleCarlos Martín Nieto2015-07-121-0/+12
| | | | | Similarly to how git itself does it, allow the index update operation to stage a change in a submodule's HEAD.
* blob: fail to create a blob from a dir with EDIRECTORYCarlos Martín Nieto2015-07-121-0/+23
| | | | | This also affects `git_index_add_bypath()` by providing a better error message and a specific error code when a directory is passed.
* index tests: add eol to avoid compiler warningEdward Thomson2015-06-301-1/+1
|
* index test: include repository.h for declEdward Thomson2015-06-291-0/+1
|
* index, iterator, fetchhead: plug leaksleaksCarlos Martín Nieto2015-06-261-1/+4
|
* index: add a diff test for smudging a file which becomes emptyCarlos Martín Nieto2015-06-221-0/+43
| | | | | Even though the file is empty and thus the size in the entry matches, we should be able to detect it as a difference.
* tests: move racy tests to the indexCarlos Martín Nieto2015-06-221-0/+100
| | | | | They fit there much better, even though we often check by diffing, it's about the behaviour of the index.
* 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.
* Fixed build warnings on Xcode 6.1Pierre-Olivier Latour2015-06-021-3/+2
|