Commit graph

211 commits

Author SHA1 Message Date
Joey Hess
8484c0c197
Always use filesystem encoding for all file and handle reads and writes.
This is a big scary change. I have convinced myself it should be safe. I
hope!
2016-12-24 14:46:31 -04:00
Joey Hess
ee309d6941
lock: Fix edge cases where data loss could occur in v6 mode.
In the case where the pointer file is in place, and not the content
of the object, lock's  performNew was called with filemodified=True,
which caused it to try to repopulate the object from an unmodified
associated file, of which there were none. So, the content of the object
got thrown away incorrectly. This was the cause (although not the root
cause) of data loss in https://github.com/datalad/datalad/issues/1020

The same problem could also occur when the work tree file is modified,
but the object is not, and lock is called with --force. Added a test case
for this, since it's excercising the same code path and is easier to set up
than the problem above.

Note that this only occurred when the keys database did not have an inode
cache recorded for the annex object. Normally, the annex object would be in
there, but there are of course circumstances where the inode cache is out
of sync with reality, since it's only a cache.

Fixed by checking if the object is unmodified; if so we don't need to
try to repopulate it. This does add an additional checksum to the unlock
path, but it's already checksumming the worktree file in another case,
so it doesn't slow it down overall.

Further investigation found a similar problem occurred when smudge --clean
is called on a file and the inode cache is not populated. cleanOldKeys
deleted the unmodified old object file in this case. This was also
fixed by checking if the object is unmodified.

In general, use of getInodeCaches and sameInodeCache is potentially
dangerous if the inode cache has not gotten populated for some reason.
Better to use isUnmodified. I breifly auited other places that check the
inode cache, and did not see any immediate problems, but it would be easy
to miss this kind of problem.
2016-10-17 13:58:43 -04:00
Joey Hess
66ebf1a8f9
add test case for sync_in_adjusted_branch_deleted_recently_added_files
This commit was sponsored by Denis Dzyubenko on Patreon.
2016-10-11 14:22:49 -04:00
Joey Hess
aee5db0d47
squelch build warning on windows 2016-09-06 14:59:32 -04:00
Joey Hess
870873bdaa
Removed dependency on json library; all JSON is now handled by aeson.
I've eyeballed all --json commands, and the only difference should be
that some fields are re-ordered.
2016-07-26 19:15:34 -04:00
Joey Hess
0c713a94bd
uninit: Fix crash due to trying to write to deleted keys db.
Reversion introduced by v6 mode support, affects v5 too.

Also fix a similar crash when the webapp is used to delete a repository.
2016-07-12 14:18:35 -04:00
Joey Hess
b0682f2b5f
add test case for http://git-annex.branchable.com/bugs/Assistant_keeps_deleting_all_the_files_in_my_repo/ 2016-06-13 12:59:10 -04:00
Joey Hess
b66e517b28
reproduced 2016-06-13 12:38:11 -04:00
Joey Hess
0ea1969275
update test suite for lock/unlock with missing file content change in v6 2016-06-09 16:16:39 -04:00
Joey Hess
5ed3e6df3c
better failure diagnosis 2016-06-03 12:59:11 -04:00
Joey Hess
b9ce477fa2
plumb RemoteGitConfig through to decryptCipher 2016-05-23 17:33:32 -04:00
Joey Hess
80b86ff78d
fix recent test suite reversion
git annex adjust --force will overwrite any current adjusted branch.
I didn't document this because for the user, deleting the branch is just as
good.
2016-05-23 11:23:30 -04:00
Joey Hess
8f1525e35b
fix test suite breakage 2016-05-23 11:06:36 -04:00
Joey Hess
0273cd5005
adjusted branches need git 2.2.0 or newer
When git-annex is used with a git version older than 2.2.0, disable support for
adjusted branches, since GIT_COMMON_DIR is needed to update them and was first
added in that version of git.
2016-04-22 12:29:32 -04:00
Joey Hess
d13819b503
use a separate tmp dir for the test home 2016-04-20 15:27:59 -04:00
Joey Hess
1de54ac671
a couple of tests chdir in ways that need an absolute path in the overridden HOME 2016-04-20 15:09:46 -04:00
Joey Hess
c3fdaf764d
Isolate test suite from global git config settings. 2016-04-20 15:04:38 -04:00
Joey Hess
ded990be8f
add simple test for conflict resolution in adjusted branch
This is not really extensive enough, but a start..
2016-04-12 13:01:31 -04:00
Joey Hess
3120b63560
don't assume git-annex is in path when calling itself from test suite 2016-02-16 16:29:04 -04:00
Joey Hess
7db739f6c4
100% pass on FAT 2016-02-16 16:02:54 -04:00
Joey Hess
aa569500d5
fix numerous problem with test suite on crippled filesystems etc 2016-02-16 15:30:59 -04:00
Joey Hess
b46ba09343
avoid fromkey test when on crippled fs 2016-02-15 16:54:44 -04:00
Joey Hess
88718976c6
skip v6 locked tests on windows, not supported 2016-02-15 15:53:55 -04:00
Joey Hess
57a7ff68ca
test case for recent sync --content reversion 2016-01-26 17:33:16 -04:00
Joey Hess
737e45156e
remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
Joey Hess
8e958c3f4b
defer deletion of test repos until end, fixes sqlite crash
The crash turned out to be caused by the sqlite database being deleted out
from under sqlite before it was done with it. Since multiple git_annex
calls are done in the same process while running the test suite, the
DbHandle could linger until GCed, and the test repo, and thus sqlite
database be deleted before the workerThread was done.
2016-01-08 16:14:39 -04:00
Joey Hess
42619e2231
view: Avoid using cute unicode homomorphs for '/' and '\' and instead use ugly escaping, as the unicode method doesn't work on non-unicode supporting systems. 2016-01-08 12:45:32 -04:00
Joey Hess
98fb475726
fix broken test 2016-01-07 15:16:36 -04:00
Joey Hess
66f3fb1ce2
unused: deal with v6 unlocked file that is implicitly ingested by git diff etc 2016-01-06 22:11:21 -04:00
Joey Hess
03cb2c8ece
unused: Bug fix when a new file was added to the annex, and then removed (but not git rmed). git still has the add staged in this case, so the content should not be unused and was wrongly treated as such.
So, we need to look at both the file on disk to see if it's a annex link,
and the file in the index too. lookupFile doesn't look in the index if the file
is not present on disk.
2016-01-06 16:49:41 -04:00
Joey Hess
f263316c16
skip fix test in unlocked v6 pass
fix is not relevant for unlocked files
2016-01-06 16:16:19 -04:00
Joey Hess
3dc08f5d4f
fix test
have to change the content of unlocked file before committing

otherwise git commit will fail in v6 mode when the file was already
unlocked, because no changes have been made
2016-01-06 16:14:51 -04:00
Joey Hess
55c162c400
fix test
file is locked here, so use right test.
2016-01-06 16:12:00 -04:00
Joey Hess
0c1cc7789f
fix test failure locking an unlocked not present file
In v5, that was not possible, but it is in v6, and so the test was failing.

Investigating, it turns out that locking was copying the pointer file
content to the annex object despite the content not being present. So,
add a check to prevent that.
2016-01-06 16:01:52 -04:00
Joey Hess
d667a68b7e
test: Added --keep-failures option. 2016-01-06 13:44:12 -04:00
Joey Hess
f3d6f9acb5
fix some tests of v6 unlocked files 2016-01-05 17:19:30 -04:00
Joey Hess
5b7fea0c31
remporarily disable v6 unlocked test pass while it's failing 2016-01-01 15:22:11 -04:00
Joey Hess
f36f24197a
scan for unlocked files on init/upgrade of v6 repo 2016-01-01 15:09:42 -04:00
Joey Hess
4eab4bdb01
started working on testing v6 unlocked files
Many failures.
2016-01-01 14:04:43 -04:00
Joey Hess
4be2b57606
add test: conflict resolution (mixed locked and unlocked file) 2015-12-30 16:36:39 -04:00
Joey Hess
0b8bba8031
test suite 100% pass in v6, finally!
Set annex.largefiles when adding the conflicting non-annexed file,
otherwise it would be added as an annexed file.
2015-12-30 15:12:45 -04:00
Joey Hess
829ae91009
fix failing git-annex unused test case in v6
WorkTree.lookupFile was finding a key for a file that's deleted from the
work tree, which is different than the v5 behavior (though perhaps the same
as the direct mode behavior). Fix by checking that the work tree file exists
before catting its key.

Hopefully this won't slow down much, probably the catKey is much more expensive.
I can't see any way to optimise this, except perhaps to make Command.Unused
check if work tree files exist before/after calling lookupFile. But,
it seems better to make lookupFile really only find keys for worktree files;
that's what it's intended to do.
2015-12-30 14:23:31 -04:00
Joey Hess
6c1cf8267d
set annex.largefiles earlier in test suite
The ingitfile was having git run it through the clean filter in some cases.
2015-12-30 13:29:00 -04:00
Joey Hess
0475411f2f
move check for if direct mode is supported to the right place
Need to run that check inside a annex repo.
2015-12-29 17:48:25 -04:00
Joey Hess
4808800f2d
fix build on windows 2015-12-28 12:57:42 -04:00
Joey Hess
d8cb05c4af
temporarily disable v6 repos tests (still 4 failures) 2015-12-24 19:24:40 -04:00
Joey Hess
a0498b47de
test suite down to only 4 fails with v6 2015-12-16 16:56:27 -04:00
Joey Hess
1e016611de
pass --version to init when needed 2015-12-16 13:14:18 -04:00
Joey Hess
7800125783
starting to work on test suite for v6 2015-12-15 17:19:26 -04:00
Joey Hess
cdd27b8920
reorg 2015-12-15 15:34:28 -04:00