tests/index


Log

Author Commit Date CI Message
Jacques Germishuys 87428c55 2015-11-20T20:48:51 Fix some warnings
Edward Thomson 5f32c506 2015-11-16T18:06:52 racy: make git_index_read_index handle raciness 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.
Edward Thomson c30051f0 2015-11-16T18:05:46 racy: ensure git_index_read_tree clears uptodate Ensure that `git_index_read_tree` clears the uptodate bit on files that it modifies.
Edward Thomson 956f4da8 2015-11-13T16:30:39 index: test for smudged entries on write only 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.
Edward Thomson d1101263 2015-11-13T15:32:48 index: don't detect raciness in uptodate entries 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.
Carlos Martín Nieto 75a0ccf5 2015-11-12T19:53:09 Merge pull request #3170 from CmdrMoozy/nsec_fix git_index_entry__init_from_stat: set nsec fields in entry stats
nulltoken 1314af8d 2014-08-26T13:51:37 Failing test for case sensitive conflicts in the index
Edward Thomson 6cc5023b 2015-11-03T11:27:31 index: test that add_bypath preserves symlinks 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.)
Edward Thomson 99a09f7f 2015-10-22T09:29:40 index: test that we round-trip nsecs 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.
Axel Rasmussen c7b17fb5 2015-10-01T18:01:32 Merge branch 'master' into nsec_fix_next
Edward Thomson 21515f22 2015-09-29T15:49:16 index: also try conflict mode when inserting 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.
Edward Thomson 10df661b 2015-09-29T14:16:51 index: test that add_bypath preserves mode
Carlos Martín Nieto 5c5df666 2015-09-27T23:32:20 Plug some leaks
Axel Rasmussen 0226f7dd 2015-08-29T13:59:20 diff/index: respect USE_NSEC for racily clean file detection
Edward Thomson ac2fba0e 2015-09-16T15:07:27 git_futils_mkdir_*: make a relative-to-base mkdir 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.
Carlos Martín Nieto 6d6020de 2015-09-08T18:34:51 Merge pull request #3353 from ethomson/wrongcase_add index: canonicalize directory case when adding
Edward Thomson 2964cbea 2015-09-08T11:50:08 Merge pull request #3381 from leoyanggit/index_directory_iterator New feature: add the ablility to iterate through a directory in index
Edward Thomson a32bc85e 2015-08-07T12:43:49 git_index_add: allow case changing renames 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.
Edward Thomson 280adb3f 2015-08-04T16:51:00 index: canonicalize directory case when adding 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`.
Edward Thomson 9fd4c9c8 2015-09-06T10:50:22 Merge pull request #3366 from libgit2/cmn/index-hashmap Use a hashmap for path-based lookups in the index
Leo Yang c097f717 2015-08-17T15:02:02 New API: git_index_find_prefix Find the first index entry matching a prefix.
Carlos Martín Nieto c232d6c3 2015-08-14T21:06:51 index: add tests around case switching We were missing tests for switching the case-sensitivity of an index in-memory and then looking up entries in it.
Edward Thomson bdec3363 2015-08-03T17:48:33 win32: ensure hidden files can be staged
Carlos Martín Nieto b426ac90 2015-08-01T19:52:25 index: test that an unregistered submodule gets staged 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.
Linquize 63e5b551 2015-07-29T00:08:37 index: add test for adding an old-style submodule to index
Carlos Martín Nieto 247d27c2 2015-07-11T19:41:03 index: allow add_bypath to update submodules Similarly to how git itself does it, allow the index update operation to stage a change in a submodule's HEAD.
Carlos Martín Nieto 0d98af09 2015-07-11T19:03:38 blob: fail to create a blob from a dir with EDIRECTORY This also affects `git_index_add_bypath()` by providing a better error message and a specific error code when a directory is passed.
Edward Thomson eb29292a 2015-06-30T14:25:51 index tests: add eol to avoid compiler warning
Edward Thomson 2cf33fee 2015-06-29T15:20:34 index test: include repository.h for decl
Carlos Martín Nieto 24fa21f3 2015-06-26T18:59:53 index, iterator, fetchhead: plug leaks
Carlos Martín Nieto 6e611f7c 2015-06-22T14:17:39 index: add a diff test for smudging a file which becomes empty Even though the file is empty and thus the size in the entry matches, we should be able to detect it as a difference.
Carlos Martín Nieto 27133caf 2015-06-20T17:20:07 tests: move racy tests to the index They fit there much better, even though we often check by diffing, it's about the behaviour of the index.
Carlos Martín Nieto 46c84c72 2015-06-19T21:56:42 index: user a better assertion when comparing sizes This will tell us which numbers we were trying to compare, rather than just telling us that they're different.
Pierre-Olivier Latour 9f3c18e2 2015-06-02T08:36:15 Fixed build warnings on Xcode 6.1
Edward Thomson 666ae188 2015-05-19T17:52:13 git_index_add_all: test that conflicts are handled When confronted with a conflict in the index, `git_index_add_all` should stage the working directory copy. If there is no file in the working directory, the conflict should simply be removed.
Edward Thomson 9f545b9d 2015-05-19T11:23:59 introduce `git_index_entry_is_conflict` It's not always obvious the mapping between stage level and conflict-ness. More importantly, this can lead otherwise sane people to write constructs like `if (!git_index_entry_stage(entry))`, which (while technically correct) is unreadable. Provide a nice method to help avoid such messy thinking.
Edward Thomson 2f1080ea 2015-05-19T11:17:07 conflict tests: use GIT_IDXENTRY_STAGE_SET
Edward Thomson d67f270e 2015-05-14T13:30:29 index: validate mode of new conflicts
Edward Thomson ecd60a56 2015-05-14T11:52:48 conflicts: when adding conflicts, remove staged When adding a conflict for some path, remove the staged entry. Otherwise, an illegal index (with both stage 0 and high-stage entries) would result.
Edward Thomson fa9a969d 2015-05-20T18:22:17 index_add_all: include untracked files in new subdirs
Carlos Martín Nieto 2b2dfe80 2015-05-12T12:07:33 index: include TYPECHANGE in the diff Without this option, we would not be able to catch exec bit changes.
Edward Thomson 35d39761 2015-03-18T00:25:18 index: introduce git_index_read_index
John Fultz d3282680 2015-04-20T23:41:04 Fix index-adding functions to know when to trust filemodes. The idea...sometimes, a filemode is user-specified via an explicit git_index_entry. In this case, believe the user, always. Sometimes, it is instead built up by statting the file system. In those cases, go with the existing logic we have to determine whether the file system supports all filemodes and symlinks, and make the best guess. On file systems which have full filemode and symlink support, this commit should make no difference. On others (most notably Windows), this will fix problems things like: * git_index_add and git_index_add_frombuffer() should be believed. * As a consequence, git_checkout_tree should make the filemodes in the index match the ones in the tree. * And diffs with GIT_DIFF_UPDATE_INDEX don't write the wrong filemodes. * And merges, and probably other downstream stuff now fixed, too. This makes my previous changes to checkout.c unnecessary, so they are now reverted. Also, added a test for index_entry permissions from git_index_add and git_index_add_frombuffer, both of which failed before these changes.
Carlos Martín Nieto 15f58174 2015-03-11T17:55:39 Merge commit 'refs/pull/2879/head' of ssh://github.com/libgit2/libgit2
Carlos Martín Nieto 23a17803 2015-01-07T14:16:50 reset: remove reflog message override This function is meant to simulate what git does in the reset command, so we should include the reflog message in that.
Carlos Martín Nieto 659cf202 2015-01-07T12:23:05 Remove the signature from ref-modifying functions The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
Damien PROFETA a275fbc0 2015-02-05T11:40:16 Add API to add a memory buffer to an index 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.
Edward Thomson 55798fd1 2015-01-17T20:49:04 git_indexwriter: lock then write the index Introduce `git_indexwriter`, to allow us to lock the index while performing additional operations, then complete the write (or abort, unlocking the index).
Edward Thomson 28428318 2014-12-18T12:41:59 index tests: test capitalization before mkdir
Carlos Martín Nieto c90ed5b5 2014-12-18T02:11:06 Plug leaks
Carlos Martín Nieto c679bf42 2014-12-18T02:07:36 Create miscapitialised dirs for case-sensitive filesystems We need these directories to exist so cl_git_mkfile() can create the files we ask it to.
Edward Thomson dce7b1a4 2014-12-16T19:24:04 treebuilder: take a repository for path validation Path validation may be influenced by `core.protectHFS` and `core.protectNTFS` configuration settings, thus treebuilders can take a repository to influence their configuration.
Vicent Marti 0d388adc 2014-11-25T00:58:03 index: Check for valid paths before creating an index entry
Will Stamper b874629b 2014-12-04T21:06:59 Spelling fixes
Edward Thomson cdd71711 2014-10-13T14:34:32 Clean up some memory leaks
Carlos Martín Nieto bb0757d5 2014-10-22T21:09:31 tree-cache: correct the entry_count calculation The entry_count field is the amount of index entries covered by a particular cache entry, that is how many files are there (recursively) under a particular directory. The current code that attemps to do this is severely defincient and is trying to count the amount of children, which always comes up to zero. We don't even need to recount, since we have the information during the cache creation. We can take that number and keep it, as we only ever invalidate or replace.
Carlos Martín Nieto 795d8e93 2014-09-29T08:03:22 index: make sure to write cached subtrees if parent is invalidated If e.g. the root tree is invalidated, we still want to write out its children, since those may still have valid cache entries.
Carlos Martín Nieto c2f8b215 2014-09-28T07:00:49 index: write out the tree cache extension Keeping the cache around after read-tree is only one part of the optimisation opportunities. In order to share the cache between program instances, we need to write the TREE extension to the index. Do so, taking the opportunity to rename 'entries' to 'entry_count' to match the name given in the format description. The included test is rather trivial, but works as a sanity check.
Carlos Martín Nieto ee4db1c1 2014-07-11T11:48:51 index: add tests for the tree cache These test that we invalidate at the right levels and that we remove the tree cache when clearing the index.
Sven Strickroth b8add6c4 2014-08-03T15:44:13 Allow to propagate checkout callbacks to git HARD reset Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson 0cee70eb 2014-07-01T14:09:01 Introduce cl_assert_equal_oid
Carlos Martín Nieto 69a1a691 2014-06-03T16:18:08 Plug a leak in the tests
Carlos Martín Nieto 052a2ffd 2014-05-22T16:01:02 index: check for valid filemodes on add
Russell Belfer 16798d08 2014-05-19T14:57:09 Make core.safecrlf work on LF-ending platforms If you enabled core.safecrlf on an LF-ending platform, we would error even for files with all LFs. We should only be warning on irreversible mappings, I think.
Russell Belfer c67fd4c9 2014-02-07T11:20:36 Some vector utility tweaks This is just laying some groundwork for internal index changes that I'm working on.
Ben Straub 6affd71f 2014-01-03T17:38:34 git_checkout_opts -> git_checkout_options
Ben Straub 0d8265c8 2014-02-22T09:25:41 Staticize file-local variables
Edward Thomson 9780020b 2014-02-09T13:37:39 Tests for crlf filtering into the repository
Russell Belfer 2d929194 2014-02-07T16:14:17 Merge pull request #2099 from libgit2/bs/more-reflog-stuff More reflogness
Russell Belfer 43709ca8 2014-02-04T10:33:30 Fix typo setting sorted flag when reloading index 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.
Russell Belfer 882c7742 2014-02-04T10:01:37 Convert pqueue to just be a git_vector 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.
Ben Straub 586be3b8 2014-02-03T15:05:55 Add reflog parameters to git_reset
Ben Straub 0d847a31 2014-02-03T14:08:40 Reset helpers: use revparse instead
Edward Thomson bae8bea0 2014-01-29T12:53:01 More index collision tests
Russell Belfer 95fbedcd 2014-01-28T16:22:37 Add test for blob/tree name collisions in index
Carlos Martín Nieto d541170c 2014-01-24T11:36:41 index: rename an entry's id to 'id' This was not converted when we converted the rest, so do it now.
Russell Belfer 8b22d862 2013-12-11T11:55:00 More improvements to callback return value tests This time actually checking return values in diff notify tests and actually testing callbacks for the index all-all/update-all/etc functions.
nulltoken 65f67857 2013-11-19T14:25:30 tests: Drop unrelated comment
nulltoken 3d523345 2013-11-19T13:15:47 tree-cache: Don't segfault upon corruption
Ben Straub 17820381 2013-11-14T14:05:52 Rename tests-clar to tests