|
6ee7d37a
|
2017-05-10T12:51:06
|
|
tests: index::tests: create sandboxed repo for locking
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.
|
|
8fe33538
|
2017-05-19T12:45:48
|
|
tests: index::version: verify we write compressed index entries
While we do have a test which checks whether a written index of version
4 has the correct version set, we do not check whether this actually
enables path compression for index entries. This commit adds a new test
by adding a number of index entries with equal path prefixes to the
index and subsequently flushing that to disk. With suffix compression
enabled by index version 4, only the last few bytes of these paths will
actually have to be written to the index, saving a lot of disk space.
For the test, differences are about an order of magnitude, allowing us
to easily verify without taking a deeper look at actual on-disk
contents.
|
|
82368b1b
|
2017-05-12T10:04:42
|
|
tests: index::version: add test to read index version v4
While we have a simple test to determine whether we can write an index
of version 4, we never verified that we are able to read this kind of
index (and in fact, we were not able to do so). Add a new repository
which has an index of version 4. This repository is then read from a new
test.
|
|
fea0c81e
|
2017-05-12T09:09:07
|
|
tests: index::version: move up cleanup function
The init and cleanup functions for test suites are usually prepended to
our actual tests. The index::version test suite does not adhere to this
stile. Fix this.
|
|
92d3ea4e
|
2017-05-19T13:04:32
|
|
tests: index::version: improve write test for index v4
The current write test does not trigger some edge-cases in the index
version 4 path compression code. Rewrite the test to start off the an
empty standard repository, creating index entries with interesting paths
itself. This allows for more fine-grained control over checked paths.
Furthermore, we now also verify that entry paths are actually
reconstructed correctly.
|
|
86e88534
|
2016-08-29T13:09:58
|
|
tests: index: do not re-allocate index
Plug a memory leak caused by re-allocating a `git_index`
structure which has already been allocated by the test suite's
initializer.
|
|
5625d86b
|
2016-05-17T15:40:32
|
|
index: support index v4
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>
|
|
9bc8c80f
|
2016-08-05T20:34:19
|
|
odb: actually insert the empty blob in tests
|
|
6249d960
|
2016-06-29T17:55:44
|
|
index: include conflicts in `git_index_read_index`
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.
|
|
91fbf9d8
|
2016-06-01T22:31:16
|
|
test: ensure we can round-trip a written tree
Read a tree into an index, write the index, then re-open the index and
ensure that we are treesame to the original.
|
|
5baa20b8
|
2016-06-01T14:52:25
|
|
round-trip trees through index_read_index
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.
|
|
e756877d
|
2016-03-11T09:07:29
|
|
tests: nsec: correctly free nsec_path
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.
|
|
53fb823b
|
2016-03-07T17:37:17
|
|
index::racy: force racy entry
Instead of hoping that we can get a racy entry by going real fast
and praying real hard, just create a racy entry.
|
|
565c4199
|
2016-03-07T17:04:32
|
|
index::nsec: don't expect shit filesystems to not suck
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.
|
|
f2dddf52
|
2016-02-28T15:51:38
|
|
turn on strict object validation by default
|
|
4afe536b
|
2016-02-28T16:02:49
|
|
tests: use legitimate object ids
Use legitimate (existing) object IDs in tests so that we have the
ability to turn on strict object validation when running tests.
|
|
6ddf533a
|
2016-02-23T18:29:16
|
|
git_index_add: validate objects in index entries (optionally)
When `GIT_OPT_ENABLE_STRICT_OBJECT_CREATION` is turned on, validate
the index entries given to `git_index_add`.
|
|
a4c55069
|
2016-02-25T11:31:18
|
|
nsec: update staging test for GIT_USE_NSECS
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.
|
|
35439f59
|
2016-02-11T12:24:21
|
|
win32: introduce p_timeval that isn't stupid
Windows defines `timeval` with `long`, which we cannot
sanely cope with. Instead, use a custom timeval struct.
|
|
91f0d186
|
2015-12-21T20:49:14
|
|
typos in comments
|
|
a7bd157e
|
2015-11-30T17:40:49
|
|
tests: fix warning for nested struct initialization
|
|
87428c55
|
2015-11-20T20:48:51
|
|
Fix some warnings
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
1314af8d
|
2014-08-26T13:51:37
|
|
Failing test for case sensitive conflicts in the index
|
|
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.)
|
|
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.
|
|
c7b17fb5
|
2015-10-01T18:01:32
|
|
Merge branch 'master' into nsec_fix_next
|
|
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.
|
|
10df661b
|
2015-09-29T14:16:51
|
|
index: test that add_bypath preserves mode
|
|
5c5df666
|
2015-09-27T23:32:20
|
|
Plug some leaks
|
|
0226f7dd
|
2015-08-29T13:59:20
|
|
diff/index: respect USE_NSEC for racily clean file detection
|
|
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.
|
|
6d6020de
|
2015-09-08T18:34:51
|
|
Merge pull request #3353 from ethomson/wrongcase_add
index: canonicalize directory case when adding
|
|
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
|
|
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.
|
|
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`.
|
|
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
|
|
c097f717
|
2015-08-17T15:02:02
|
|
New API: git_index_find_prefix
Find the first index entry matching a prefix.
|
|
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.
|
|
bdec3363
|
2015-08-03T17:48:33
|
|
win32: ensure hidden files can be staged
|
|
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.
|
|
63e5b551
|
2015-07-29T00:08:37
|
|
index: add test for adding an old-style submodule to index
|
|
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.
|
|
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.
|
|
eb29292a
|
2015-06-30T14:25:51
|
|
index tests: add eol to avoid compiler warning
|
|
2cf33fee
|
2015-06-29T15:20:34
|
|
index test: include repository.h for decl
|
|
24fa21f3
|
2015-06-26T18:59:53
|
|
index, iterator, fetchhead: plug leaks
|
|
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.
|
|
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.
|
|
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.
|
|
9f3c18e2
|
2015-06-02T08:36:15
|
|
Fixed build warnings on Xcode 6.1
|
|
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.
|
|
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.
|
|
2f1080ea
|
2015-05-19T11:17:07
|
|
conflict tests: use GIT_IDXENTRY_STAGE_SET
|
|
d67f270e
|
2015-05-14T13:30:29
|
|
index: validate mode of new conflicts
|
|
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.
|
|
fa9a969d
|
2015-05-20T18:22:17
|
|
index_add_all: include untracked files in new subdirs
|
|
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.
|
|
35d39761
|
2015-03-18T00:25:18
|
|
index: introduce git_index_read_index
|
|
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.
|
|
15f58174
|
2015-03-11T17:55:39
|
|
Merge commit 'refs/pull/2879/head' of ssh://github.com/libgit2/libgit2
|
|
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.
|
|
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.
|
|
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.
|
|
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).
|
|
28428318
|
2014-12-18T12:41:59
|
|
index tests: test capitalization before mkdir
|
|
c90ed5b5
|
2014-12-18T02:11:06
|
|
Plug leaks
|
|
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.
|
|
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.
|
|
0d388adc
|
2014-11-25T00:58:03
|
|
index: Check for valid paths before creating an index entry
|
|
b874629b
|
2014-12-04T21:06:59
|
|
Spelling fixes
|
|
cdd71711
|
2014-10-13T14:34:32
|
|
Clean up some memory leaks
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
b8add6c4
|
2014-08-03T15:44:13
|
|
Allow to propagate checkout callbacks to git HARD reset
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
0cee70eb
|
2014-07-01T14:09:01
|
|
Introduce cl_assert_equal_oid
|
|
69a1a691
|
2014-06-03T16:18:08
|
|
Plug a leak in the tests
|
|
052a2ffd
|
2014-05-22T16:01:02
|
|
index: check for valid filemodes on add
|
|
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.
|
|
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.
|
|
6affd71f
|
2014-01-03T17:38:34
|
|
git_checkout_opts -> git_checkout_options
|
|
0d8265c8
|
2014-02-22T09:25:41
|
|
Staticize file-local variables
|
|
9780020b
|
2014-02-09T13:37:39
|
|
Tests for crlf filtering into the repository
|
|
2d929194
|
2014-02-07T16:14:17
|
|
Merge pull request #2099 from libgit2/bs/more-reflog-stuff
More reflogness
|
|
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.
|
|
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.
|
|
586be3b8
|
2014-02-03T15:05:55
|
|
Add reflog parameters to git_reset
|
|
0d847a31
|
2014-02-03T14:08:40
|
|
Reset helpers: use revparse instead
|
|
bae8bea0
|
2014-01-29T12:53:01
|
|
More index collision tests
|
|
95fbedcd
|
2014-01-28T16:22:37
|
|
Add test for blob/tree name collisions in index
|
|
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.
|
|
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.
|
|
65f67857
|
2013-11-19T14:25:30
|
|
tests: Drop unrelated comment
|
|
3d523345
|
2013-11-19T13:15:47
|
|
tree-cache: Don't segfault upon corruption
|