Commit graph

372 commits

Author SHA1 Message Date
Joey Hess
af6068525a
Fix a git-annex test failure when run on NFS due to NFS lock files preventing directory removal.
Should fix this:

    lock (v6 --force):                                    FAIL
      Exception: .git/annex/keys: removeDirectoryRecursive: unsatisfied constraints (Directory not empty)

Verified that the test case still catches the regression it's meant to.

This commit was supported by the NSF-funded DataLad project.
2017-08-14 15:11:42 -04:00
Joey Hess
2cecc8d2a3
Added GIT_ANNEX_VECTOR_CLOCK environment variable
Can be used to override the default timestamps used in log files in the
git-annex branch. This is a dangerous environment variable; use with
caution.

Note that this only affects writing to the logs on the git-annex branch.
It is not used for metadata in git commits (other env vars can be set for
that).

There are many other places where timestamps are still used, that don't
get committed to git, but do touch disk. Including regular timestamps
of files, and timestamps embedded in some files in .git/annex/, including
the last fsck timestamp and timestamps in transfer log files.

A good way to find such things in git-annex is to get for getPOSIXTime and
getCurrentTime, although some of the results are of course false positives
that never hit disk (unless git-annex gets swapped out..)

So this commit does NOT necessarily make git-annex comply with some HIPPA
privacy regulations; it's up to the user to determine if they can use it in
a way compliant with such regulations.

Benchmarking: It takes 0.00114 milliseconds to call getEnv
"GIT_ANNEX_VECTOR_CLOCK" when that env var is not set. So, 100 thousand log
files can be written with an added overhead of only 0.114 seconds. That
should be by far swamped by the actual overhead of writing the log files
and making the commit containing them.

This commit was supported by the NSF-funded DataLad project.
2017-08-14 14:19:58 -04:00
Joey Hess
da8e84efe9
fix failing quickcheck properties
QuickCheck 2.10 found a counterexample eg "\929184" broke the property.

As far as I can tell, Git.Filename is matching how git handles encoding
of strange high unicode characters in filenames for display. Git does
not display high unicode characters, and instead displays the C-style
escaped form of each byte. This is ambiguous, but since git is not
unicode aware, it doesn't need to roundtrip parse it.

So, making Git.FileName's roundtrip test only chars < 256 seems fine.

Utility.Format.format uses encode_c, in order to mimic git, so that's
ok.

Utility.Format.gen uses decode_c, but only so that stuff like "\n"
in the format string is handled. If the format string contains C-style
octal escapes, they will be converted to ascii characters, and not
combined into unicode characters, but that should not be a problem.
If the user wants unicode characters, they can include them in the
format string, without escaping them.

Finally, decode_c is used by Utility.Gpg.secretKeys, because gpg
--with-colons hex-escapes some characters in particular ':' and '\\'.
gpg passes unicode through, so this use of decode_c is not a problem.

This commit was sponsored by Henrik Riomar on Patreon.
2017-06-17 16:48:00 -04:00
Joey Hess
61b7af97ec
fix test suite breakage caused by GIT_ANNEX_USE_GIT_SSH 2017-04-07 16:56:04 -04:00
Joey Hess
df2639218a
improve git-annex-shell exit status propigation 2017-03-20 12:45:10 -04:00
Joey Hess
1484422e19
test move with ssh remote 2017-03-17 19:18:45 -04:00
Joey Hess
002513e194
test suite infra for testing mocked ssh remotes
This commit was supported by the NSF-funded DataLad project.
2017-03-17 19:14:41 -04:00
Joey Hess
9c4650358c
add KeyVariety type
Where before the "name" of a key and a backend was a string, this makes
it a concrete data type.

This is groundwork for allowing some varieties of keys to be disabled
in file2key, so git-annex won't use them at all.

Benchmarks ran in my big repo:

old git-annex info:

real	0m3.338s
user	0m3.124s
sys	0m0.244s

new git-annex info:

real	0m3.216s
user	0m3.024s
sys	0m0.220s

new git-annex find:

real	0m7.138s
user	0m6.924s
sys	0m0.252s

old git-annex find:

real	0m7.433s
user	0m7.240s
sys	0m0.232s

Surprising result; I'd have expected it to be slower since it now parses
all the key varieties. But, the parser is very simple and perhaps
sharing KeyVarieties uses less memory or something like that.

This commit was supported by the NSF-funded DataLad project.
2017-02-24 15:16:56 -04:00
Joey Hess
ca0daa8bb8
factor non-type stuff out of Key 2017-02-24 13:42:30 -04:00
Edward Betts
0750913136
correct spelling mistakes 2017-02-12 17:30:23 -04:00
Joey Hess
e7e36b6e72
import: Changed how --deduplicate, --skip-duplicates, and --clean-duplicates determine if a file is a duplicate
Before, only content known to be present somewhere was considered a
duplicate. Now, any content that has been annexed before will be considered
a duplicate, even if all annexed copies of the data have been lost.

Note that --clean-duplicates and --deduplicate still check numcopies,
so won't delete duplicate files unless there's an annexed copy.

This makes import use the same method as reinject --known.

The man page already said that duplicate meant "its content is either
present in the local repository already, or git-annex knows of another
repository that contains it, or it was present in the annex before but has
been removed now". So, this is really only bringing the implementation into
line with the man page.

This commit was sponsored by Jochen Bartl on Patreon.
2017-02-07 17:41:58 -04:00
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
Joey Hess
689bdae03a
reorg quickcheck to a separate module 2015-11-17 15:49:22 -04:00
Joey Hess
b0626230b7
fix use of hifalutin terminology 2015-11-16 14:37:31 -04:00
Joey Hess
9c5edd2975 add test cases for copy --auto
(Only --from for now, should add --to sometime but I'm on low sleep so this
is the mininal test to catch the reversion just fixed, bad me for doing it
backwards and incompletely.)
2015-10-06 17:35:29 -04:00
Joey Hess
0390efae8c support gpg.program
When gpg.program is configured, it's used to get the command to run for
gpg. Useful on systems that have only a gpg2 command or want to use it
instead of the gpg command.
2015-09-09 18:06:49 -04:00
Joey Hess
97962591d6 init: Fix reversion in detection of repo made with git clone --shared 2015-09-09 13:56:37 -04:00
Joey Hess
730cc3feb5 wire tasty's option parser into the main program option parser
This makes bash completion work for git-annex test, and is
generally cleaner.
2015-07-13 13:20:10 -04:00
Joey Hess
4018e5f6f1 better method for running tasty's optparse as a subcommand 2015-07-08 00:39:19 -04:00
Joey Hess
0a3541a8d5 refactor 2015-07-08 00:03:28 -04:00
Joey Hess
aea694ed3f Removed support for optparse-applicative versions older than 0.10.
Debian stable has 0.10.0.
2015-07-07 23:54:46 -04:00
Joey Hess
833cf5fff9 log: Fix reversion introduced in version 5.20150528 that broke this command. 2015-07-02 12:53:38 -04:00
Joey Hess
8e83485d9b disable debug output in test suite
Added during a dev session in Jan and kept accidentially.
2015-06-17 13:49:29 -04:00
Joey Hess
6e829939e9 add test case that all standard group preferred content expressions parse 2015-06-17 13:44:19 -04:00
Joey Hess
67b8e0b321 avoid using isLeft/isRight which are not available with older ghc versions 2015-06-06 21:13:55 -04:00
Joey Hess
764c9edc58 fairly complete tests for git-annex import 2015-06-03 14:39:47 -04:00
Joey Hess
b8f044660f two more breakages introduced when removing the Params constructor 2015-06-03 13:02:33 -04:00
Joey Hess
eb33569f9d remove Params constructor from Utility.SafeCommand
This removes a bit of complexity, and should make things faster
(avoids tokenizing Params string), and probably involve less garbage
collection.

In a few places, it was useful to use Params to avoid needing a list,
but that is easily avoided.

Problems noticed while doing this conversion:

	* Some uses of Params "oneword" which was entirely unnecessary
	  overhead.
	* A few places that built up a list of parameters with ++
	  and then used Params to split it!

Test suite passes.
2015-06-01 13:52:23 -04:00
Joey Hess
ec267aa1ea rejigger imports for clean build with ghc 7.10's AMP changes
The explict import Prelude after import Control.Applicative is a trick
to avoid a warning.
2015-05-10 16:20:30 -04:00
Joey Hess
d3cff7a320 add test for stable macs 2015-04-19 10:52:49 -04:00
Joey Hess
0def1f0b53 Fix fsck --from a git remote in a local directory, and from a directory special remote. This was a reversion caused by the relative path changes in 5.20150113.
The directory special remote was not affected in its normal configuration,
since annex-directory is an absolute path normally. But it could fail
when a relative path was used.

The git remote was affected even when an absolute path to it was used in
.git/config, since git-annex now converts all such paths to relative.
2015-04-18 13:36:12 -04:00
Joey Hess
f842888de3 test: Fix --list-tests
Seems list order matters, I don't know why, but have reported it on #tasty
2015-03-31 14:47:27 -04:00
Joey Hess
9b93278e8a metadata: Fix encoding problem that led to mojibake when storing metadata strings that contained both unicode characters and a space (or '!') character.
The fix is to stop using w82s, which does not properly reconstitute unicode
strings. Instrad, use utf8 bytestring to get the [Word8] to base64. This
passes unicode through perfectly, including any invalid filesystem encoded
characters.

Note that toB64 / fromB64 are also used for creds and cipher
embedding. It would be unfortunate if this change broke those uses.

For cipher embedding, note that ciphers can contain arbitrary bytes (should
really be using ByteString.Char8 there). Testing indicated it's not safe to
use the new fromB64 there; I think that characters were incorrectly
combined.

For credpair embedding, the username or password could contain unicode.
Before, that unicode would fail to round-trip through the b64.
So, I guess this is not going to break any embedded creds that worked
before.

This bug may have affected some creds before, and if so,
this change will not fix old ones, but should fix new ones at least.
2015-03-04 12:54:30 -04:00
Joey Hess
c1f6ac8fac dropdrive drops the leading slash, so need fil:/// 2015-02-11 12:22:43 -04:00
Joey Hess
dbf307e4b8 fix file:// url generation on windows in test 2015-02-11 12:21:33 -04:00
Joey Hess
8fe7d6c0a7 test case for addurl file:// 2015-02-10 15:20:07 -04:00
Joey Hess
3e78b83875 Windows: Fix bug in dropping an annexed file, which caused a symlink to be staged that contained backslashes. 2015-02-09 15:37:26 -04:00
Joey Hess
d554362d0b add a test case for switching to direct mode and back to indirect 2015-02-09 13:41:29 -04:00
Joey Hess
b0575c621f implement annex.tune.branchhash1
I hope this doesn't impact speed much -- it does have to pull out a value
from Annex state every time it accesses the branch now.

The test case I dropped has never caught any problems that I can remember,
and would have been rather difficult to convert.
2015-01-28 17:17:26 -04:00
Joey Hess
afc5153157 update my email address and homepage url 2015-01-21 12:50:09 -04:00
Joey Hess
f4de021a54 convert parentDir to be based on takeDirectory, but fixed for trailing / 2015-01-09 14:26:52 -04:00
Joey Hess
3bab5dfb1d revert parentDir change
Reverts 965e106f24

Unfortunately, this caused breakage on Windows, and possibly elsewhere,
because parentDir and takeDirectory do not behave the same when there is a
trailing directory separator.
2015-01-09 13:11:56 -04:00
Joey Hess
858d776352 Merge branch 'master' into relativepaths
Conflicts:
	Locations.hs
	debian/changelog
2015-01-06 19:00:01 -04:00
Joey Hess
965e106f24 made parentDir return a Maybe FilePath; removed most uses of it
parentDir is less safe than takeDirectory, especially when working
with relative FilePaths. It's really only useful in loops that
want to terminate at /

This commit was sponsored by Audric SCHILTKNECHT.
2015-01-06 18:55:56 -04:00
Joey Hess
cd865c3b8f Switch to using relative paths to the git repository.
This allows the git repository to be moved while git-annex is running in
it, with fewer problems.

On Windows, this avoids some of the problems with the absurdly small
MAX_PATH of 260 bytes. In particular, git-annex repositories should
work in deeper/longer directory structures than before. See
http://git-annex.branchable.com/bugs/__34__git-annex:_direct:_1_failed__34___on_Windows/

There are several possible ways this change could break git-annex:

1. If it changes its working directory while it's running, that would
   be Bad News. Good news everyone! git-annex never does so. It would also
   break thread safety, so all such things were stomped out long ago.

2. parentDir "." -> "" which is not a valid path. I had to fix one
   instace of this, and I should probably wipe all calls to parentDir out
   of the git-annex code base; it was never a good idea.

3. Things like relPathDirToFile require absolute input paths,
   and code assumes that the git repo path is absolute and passes it to it
   as-is. In the case of relPathDirToFile, I converted it to not make
   this assumption.

Currently, the test suite has 16 failures.
2015-01-06 16:19:41 -04:00
Joey Hess
e26e26fb32 regression test for fd55563b02 2015-01-02 13:59:25 -04:00
Joey Hess
498babb958 fix windows build 2014-12-30 17:02:51 -04:00
Joey Hess
531df54d6c remove testenv threading from test suite
Simplify the test suite now that I have a way to setEnv on Windows by not
threading an environement through it.

Incidentially this fixed a failure on Windows, observed when running the
test suite in cygwin terminal, where there is apparently an env var named
"", and it tried to set that when propigating the environment, which failed.

But mostly, it makes the code a lot less horrible.

This commit was sponsored by Rémi Vanicat.
2014-12-30 16:58:02 -04:00
Joey Hess
6308d5434b enable rsync special remote test on windows 2014-12-30 14:24:48 -04:00
Joey Hess
c9a3e80d32 fixed all remaining build warnings on Windows 2014-12-29 17:30:20 -04:00
Joey Hess
adc5ca70a8 pre-commit: Block partial commit of unlocked annexed file, since that left a typechange staged in index
I had hoped that the git devs could change git's handling of partial
commits to not use a false index file, but seems not.

So, this relies on some git internals to detect that case. The test suite
has a test case added to catch it if changes to git break it.

This commit was sponsored by Paul Tagliamonte.
2014-11-10 15:36:24 -04:00
Joey Hess
e83dfe37e0 fix windows build 2014-10-16 15:54:02 -04:00
Joey Hess
1e59df083d Use haskell setenv library to clean up several ugly workarounds for inability to manipulate the environment on windows.
Didn't know that this library existed!

This includes making git-annex not re-exec itself on start on windows, and
making the test suite on Windows run tests without forking.
2014-10-15 20:33:52 -04:00
Joey Hess
b61c6bc2ff hlint 2014-10-09 15:46:05 -04:00
Joey Hess
9fd95d9025 indent with tabs not spaces
Found these with:
git grep "^  " $(find -type  f -name \*.hs) |grep -v ':  where'

Unfortunately there is some inline hamlet that cannot use tabs for
indentation.

Also, Assistant/WebApp/Bootstrap3.hs is a copy of a module and so I'm
leaving it as-is.
2014-10-09 15:09:26 -04:00
Joey Hess
7b50b3c057 fix some mixed space+tab indentation
This fixes all instances of " \t" in the code base. Most common case
seems to be after a "where" line; probably vim copied the two space layout
of that line.

Done as a background task while listening to episode 2 of the Type Theory
podcast.
2014-10-09 15:09:11 -04:00
Joey Hess
ffd8b90c55 fix indentation 2014-09-18 22:37:34 -04:00
Joey Hess
90d172365d fix display of git-annex test command name in usage
This needs optparse-applicative 0.10. Dropped support for 0.9 and older,
but kept 0.9.1 working since autobuilders and debian testing still use it.
(The display is not perfect with 0.9.1.)
2014-09-17 13:46:01 -04:00
Joey Hess
70b2160d32 Fix build with optparse-applicative 0.10. Closes: #761484
This also works with 0.9, and probably 0.8.
2014-09-14 12:30:37 -04:00
Joey Hess
c784ef4586 unify exception handling into Utility.Exception
Removed old extensible-exceptions, only needed for very old ghc.

Made webdav use Utility.Exception, to work after some changes in DAV's
exception handling.

Removed Annex.Exception. Mostly this was trivial, but note that
tryAnnex is replaced with tryNonAsync and catchAnnex replaced with
catchNonAsync. In theory that could be a behavior change, since the former
caught all exceptions, and the latter don't catch async exceptions.

However, in practice, nothing in the Annex monad uses async exceptions.
Grepping for throwTo and killThread only find stuff in the assistant,
which does not seem related.

Command.Add.undo is changed to accept a SomeException, and things
that use it for rollback now catch non-async exceptions, rather than
only IOExceptions.
2014-08-07 22:03:29 -04:00
Joey Hess
781833b16f update for change in bup remote removal 2014-08-06 13:45:05 -04:00
Joey Hess
61a35de433 Deal with change in git 2.0 that made indirect mode merge conflict resolution leave behind old files.
I think this is a git behavior change, but have not checked to be sure.
Conflict cruft used to look like $foo~HEAD, but now just $foo is left
behind as conflict cruft.

With test case.
2014-07-11 16:56:19 -04:00
Joey Hess
c5f132e3e7 uninit: Avoid failing final removal in some direct mode repositories due to file modes.
Specifically .map files.
2014-07-11 14:52:53 -04:00
Joey Hess
541f5ada14 add regression test case for ba42b67c70
better late than never
2014-07-10 13:34:53 -04:00
Joey Hess
d41849bc23
support commit.gpgsign
Support users who have set commit.gpgsign, by disabling gpg signatures for
git-annex branch commits and commits made by the assistant.

The thinking here is that a user sets commit.gpgsign intending the commits
that they manually initiate to be gpg signed. But not commits made in the
background, whether by a deamon or implicitly to the git-annex branch.
gpg signing those would be at best a waste of CPU and at worst would fail,
or flood the user with gpg passphrase prompts, or put their signature on
changes they did not directly do.

See Debian bug #753720.

Also makes all commits done by git-annex go through a few central control
points, to make such changes easier in future.

Also disables commit.gpgsign in the test suite.

This commit was sponsored by Antoine Boegli.
2014-07-04 11:53:51 -04:00
Joey Hess
a44fd2c019 export CreateProcess fields from Utility.Process
update code to avoid cwd and env redefinition warnings
2014-06-10 19:20:14 -04:00
Joey Hess
e880d0d22c replace (Key, Backend) with Key
Only fsck and reinject and the test suite used the Backend, and they can
look it up as needed from the Key. This simplifies the code and also speeds
it up.

There is a small behavior change here. Before, all commands would warn when
acting on an annexed file with an unknown backend. Now, only fsck and
reinject show that warning.
2014-04-17 18:03:39 -04:00
Joey Hess
8c15face0e add new test 2014-04-12 14:19:56 -04:00
Joey Hess
32d491a2cd
fix build with new optparse-applicative release 2014-03-20 11:59:27 -04:00
Joey Hess
1052eeface Windows: Fix some filename encoding bugs.
http://git-annex.branchable.com/bugs/Unicode_file_names_ignored_on_Windows/

Not a complete fix yet.
2014-03-19 15:57:56 -04:00
Joey Hess
431d805a96 factored out a generic MapLog from uuid-based logs
UUIDBased is just a MapLog with a UUID for the field.
2014-03-15 13:45:25 -04:00
Joey Hess
785f69afb0
more conflict resolution tests 2014-03-04 23:12:15 -04:00
Joey Hess
14d1e878ab sync: Automatically resolve merge conflict between and annexed file and a regular git file.
This is a new feature, it was not handled before, since it's a bit of an
edge case. However, it can be handled exactly the same as a file/dir
conflict, just leave the non-annexed item alone.

While implementing this, the core resolveMerge' function got a lot simpler
and clearer. Note especially that where before there was an asymetric call to
stagefromdirectmergedir, now graftin is called symmetrically in both cases.

And, in order to add that `graftin us`, the current branch needed to be
known (if there is no current branch, there cannot be a merge conflict).
This led to some cleanups of how autoMergeFrom behaved when there is no
current branch.

This commit was sponsored by Philippe Gauthier.
2014-03-04 19:35:55 -04:00
Joey Hess
1fcc5bef66 add test case for merge conflict resolution between annexed and in-git file 2014-03-04 17:44:08 -04:00
Joey Hess
b08ec2752b added test for conflict resolution with a file that is both deleted and modified 2014-03-04 17:12:26 -04:00
Joey Hess
c1c4f0cdf6
fix test case to convert slashes for DOS 2014-03-04 15:06:40 -04:00
Joey Hess
0afa7ae261 much improved test and real fix for FAT symlink loss on conflicted merge
I think that 751f496c11 didn't quite manage
to actually fix the bug, although I have not checked since its "fix" got
redone.

The test suite now actually checks the file staged in git is a symlink,
rather than relying on the bug casing a later sync failure. This seems a
more reliable way to detect it, and probably avoids a heisenbug in the test
suite.
2014-03-04 14:31:26 -04:00
Joey Hess
b4d6b79618 improved test for FAT symlink regressions
The test case that was supposed to cover this did not.. It is for some
other bug, which is apparently a bit of a heisenbug.
2014-03-04 13:36:42 -04:00
Joey Hess
38cd30752c fix environment propigation in windows test suite
Let through HOME, etc when running git-annex from test suite.
2014-03-04 03:01:31 -04:00
Joey Hess
19475fd0ab add test cases for the new direct mode merge bug 2014-03-04 01:41:00 -04:00
Joey Hess
cc0a576ab0 change directory encoding in ViewedFile such that the original directory can be extracted from it 2014-02-22 14:54:53 -04:00
Joey Hess
67fd06af76 add git annex view command
(And a vpop command, which is still a bit buggy.)

Still need to do vadd and vrm, though this also adds their documentation.

Currently not very happy with the view log data serialization. I had to
lose the TDFA regexps temporarily, so I can have Read/Show instances of
View. I expect the view log format will change in some incompatable way
later, probably adding last known refs for the parent branch to View
or something like that.

Anyway, it basically works, although it's a bit slow looking up the
metadata. The actual git branch construction is about as fast as it can be
using the current git plumbing.

This commit was sponsored by Peter Hogg.
2014-02-18 18:22:20 -04:00
Joey Hess
613f8f02e3
add another quickcheck property, and several edge cases handled 2014-02-16 21:00:12 -04:00
Joey Hess
9633c67842 filter branches (incomplete)
Promosing work toward metadata driven filter branches. A few methods
to construct them are stubbed out; all the data types and pure code
seems good.

This commit was sponsored by Walter Somerville.
2014-02-16 17:39:54 -04:00
Joey Hess
a05ac13e92 fix metadata log simplifier and additional quickcheck tests 2014-02-12 22:27:55 -04:00
Joey Hess
1b79d18a40 data types and serialization for metadata
A very haskell commit! Just data types, instances to serialize the metadata
to a nice format, and QuickCheck tests.

This commit was sponsored by Andreas Leha.
2014-02-12 17:57:32 -04:00
Joey Hess
40cec65ace more hlint 2014-02-11 10:48:52 -04:00
Joey Hess
e8b9c96e4e
use nukefile rather than shelling to rm 2014-02-10 18:29:15 -04:00
Joey Hess
ae2bc90a1d eliminating absNormPath
git-annex has been using MissingH's `abdNormPath` forever, but that's
unmaintained and possibly buggy, and doesn't work on Windows. I've been
wanting to get rid of it for some time, and finally did today, writing a
`simplifyPath` that does the things git-annex needs and will work with all
the Windows filename craziness, and takes advantage of the more modern
System.FilePath to be quite a simple peice of code. A QuickCheck test found
no important divergences from absNormPath. A good first step to making
git-annex not depend on MissingH at all.

And it fixed some weird behaviors on Windows like
`git annex add ..\subdir\file` not working.

Note that absNormPathUnix has been left alone for now.
2014-02-07 17:15:18 -04:00
Joey Hess
dc3b7effd2 add regression test for symlink calculation
Note: Test reordered because running git-annex sync early broke the
environment for some other tests.
2014-02-06 20:57:58 -04:00
Joey Hess
751f496c11 add test case & fix conflict resolution bug on Windows & FAT
Fix bug in automatic merge conflict resolution code when used
on a filesystem not supporting symlinks, which resulted in it losing
track of the symlink bit of annexed files.

This was the underlying bug that was causing another test to fail,
which got worked around in 1c997fd08c.
I've chosen to keep 2 separate test cases since the old test case only
detected the problem accidentially.

Test suite passes on FAT & in windows, as well as on proper unix systems.

This commit was sponsored by Ellis Whitehead.
2014-02-04 17:24:12 -04:00
Joey Hess
88003c446b narrowing test case 2014-02-04 15:27:49 -04:00
Joey Hess
8e81a7e906 add test case for windows sync push failure
This adds a test for a failure mode seemingly specific to Windows
that was removed in 1c997fd08c, and puts it
in its own test case.
2014-02-04 14:50:28 -04:00
Joey Hess
5d7777cbe2 set up git email config in clone repos too when running test
This fixes the problem of the environment variables apparently not being
seen on Windows. I could probably remove the setting of the env vars from
Test.hs now as this covers it better.

Note that outside the test suite, git-annex on windows seems to manage to
configure the repo so commits work on its own.
2014-02-04 14:31:52 -04:00
Joey Hess
617c63a213 fix broken test
1c997fd08c broke the mixed conflict
resolution test. Since origin is no longer involved, both sides have to
sync after pairing. (The sync before pairing is just to get a commit.)
2014-02-03 14:32:07 -04:00
Joey Hess
c91bbc9494 fix reversion on repo deletion
A broken symlink would cause the mode setting to fail.
2014-02-03 14:20:39 -04:00
Joey Hess
ec417b108d improve failure message 2014-02-03 12:23:05 -04:00
Joey Hess
1c997fd08c fix test suite to pass on windows
On windows, the sync of the second cloned repo to origin failed, because
synced/master was a non-fast-forward. This may be a bug of its own, but
it's not the issue that this test was intended to test, so disconnect
the repos from origin before syncing.
2014-02-03 12:12:50 -04:00
Joey Hess
ecd9b6731e try harder to delete test dir on windows 2014-02-03 11:45:31 -04:00
Joey Hess
29bb04aa0d Windows: Fix deletion of repositories by test suite and webapp.
On Windows, a file that is not writable cannot be deleted even if in a
directory with write perms. So git object files were not getting deleted
when removing a git repository.
2014-02-03 11:19:41 -04:00
Joey Hess
1669e80e85 Windows: Avoid using unix-compat's rename, which refuses to rename directories.
Opened a bug about this: https://github.com/jystic/unix-compat/issues/10
2014-01-29 15:19:03 -04:00
Joey Hess
998d76ae04 Revert "temporarily revert tasty-rerun support for this release"
This reverts commit 8fcf041159.
2014-01-27 14:22:44 -04:00
Joey Hess
8fcf041159 temporarily revert tasty-rerun support for this release
revert c340d9506c

tasty-rerun is stuck in NEW in debian
2014-01-27 13:58:43 -04:00
Joey Hess
74b101d1dd reorg 2014-01-26 16:36:31 -04:00
Joey Hess
86ffeb73d1 reorganize some files and imports 2014-01-26 16:25:55 -04:00
Joey Hess
c340d9506c tasty-rerun! make rerest runs much much faster than running whole test suite 2014-01-24 12:21:30 -04:00
Joey Hess
ae3cd632bd add timestamps to unused log files
This will be used in expiring old unused objects. The timestamp is when it
was first noticed it was unused.

Backwards compatability: It supports reading old format unused log files.
The old version of git-annex will ignore lines in log files written by the
new version, so the worst interop problem would be git annex dropunused not
knowing some numbers that git-annex unused reported.
2014-01-22 15:33:02 -04:00
Joey Hess
e38a21a768 tests should now all run independently, without needing any prior tests to have run
Should be ready now for tasty-rerun.
2014-01-21 14:26:13 -04:00
Joey Hess
4a4e2f9a6c use tasty resources 2014-01-21 14:04:50 -04:00
Joey Hess
d1bf61464f expose tasty test suite's option parser 2014-01-21 00:08:43 -04:00
Joey Hess
d66535f065 global numcopies setting
* numcopies: New command, sets global numcopies value that is seen by all
  clones of a repository.
* The annex.numcopies git config setting is deprecated. Once the numcopies
  command is used to set the global number of copies, any annex.numcopies
  git configs will be ignored.
* assistant: Make the prefs page set the global numcopies.

This global numcopies setting is needed to let preferred content
expressions operate on numcopies.

It's also convenient, because typically if you want git-annex to preserve N
copies of files in a repo, you want it to do that no matter which repo it's
running in. Making it global avoids needing to warn the user about gotchas
involving inconsistent annex.numcopies settings.
(See changes to doc/numcopies.mdwn.)

Added a new variety of git-annex branch log file, that holds only 1 value.
Will probably be useful for other stuff later.

This commit was sponsored by Nicolas Pouillard.
2014-01-20 16:47:56 -04:00
Joey Hess
7e311a00d0 Fix typo in test suite. 2013-12-24 14:02:02 -04:00
Joey Hess
cee4c9a11d Fix test suite to cover lock --force change. 2013-12-15 13:33:09 -04:00
Joey Hess
bc0517fc86 test direct mode first (it breaks more often) 2013-11-26 17:05:13 -04:00
Joey Hess
7323770d8a run each quickcheck test 1000, rather than 100 times
I've had one or two fails sent to me involving cases QuickCheck didh't
easily find, and tasty makes this easy.
2013-11-15 17:04:40 -04:00
Joey Hess
27fb2b6126 add test case for b0f85b3e22 2013-11-15 15:42:31 -04:00
Joey Hess
238fa05545 tasty fully working 2013-11-14 20:09:47 -04:00
Joey Hess
cf93636df8 finished converting test suite for tasty
Also merged in Test.hs from master.
2013-11-14 17:03:49 -04:00
Joey Hess
8189738b13 test suite partially converted to use tasty test framework
This is a win. Will need to wait for tasty getting into Debian,
and do a trivial conversion of the remainder of the hunit tests.
2013-08-06 00:12:06 -04:00
Joey Hess
fc96861084 enable 2 more tests on Windows 2013-08-04 13:54:05 -04:00
Joey Hess
38022f4f49 Windows: Fixed permissions problem that prevented removing files from directory special remote.
Directory special remotes now fully usable.
2013-08-04 13:43:48 -04:00
Joey Hess
6a97896b47 missed some __WINDOWS__ defines 2013-08-04 13:07:55 -04:00
Joey Hess
f59a2f8e82 regression test for 7b0970b340 2013-07-30 17:04:05 -04:00
Joey Hess
147a9f8882 Improve test suite on Windows; now tests git annex sync. 2013-07-30 17:03:32 -04:00
Joey Hess
6ac595f8b5 update test suite for dropunused behavior change 2013-07-30 14:17:09 -04:00
Joey Hess
f353f13c9d Support unannex and uninit in direct mode.
In direct mode, it's best to whenever possible not move direct mode files
out of the way, and so I made unannex avoid touching the direct mode file at
all.

That actually turns out to be easy, because in direct mode, unlike indirect
mode, the pre-commit hook won't get confused if the unannexed file later
gets added back by git add. So there's no need to commit the unannex right
away; it can be staged for the user to commit later. This also means that
unannex in direct mode is a lot faster than in indirect mode!

Another subtle bit is the bookkeeping that is done when unannexing a direct
mode file. The inode cache needs to be removed so that when uninit runs
getKeysPresent, it doesn't see the cache and think the key is still
present and crash when it's not.

This commit is sponsored by Douglas Butts. Thanks!
2013-07-22 17:28:53 -04:00
Joey Hess
8661dba587 adjust test suite for changed dropunused behavior with bogus numbers 2013-07-09 14:46:20 -04:00
Joey Hess
bab49ac7c6 few final bits for fully working test suite on windows 2013-06-18 16:37:54 -04:00
Joey Hess
8b3427c52e Windows: The test suite now passes on Windows (a few broken parts are disabled).
Better to have a working test suite that doesn't test a few things
than no working test suite.

Most of the disabled stuff is because for some reason "git annex sync"
doesn't work when run inside the test suite. Looks like PATH problems.

The directory and rsync special remotes seem broken on Windows, or
maybe the tests are. Pretty sure the hook special remote test is broken.
2013-06-18 16:16:25 -04:00
Joey Hess
55f971de3c disable a test that windows git doesn't support 2013-06-18 15:21:13 -04:00
Joey Hess
4e28e84baf more slash fixes 2013-06-18 15:15:00 -04:00
Joey Hess
8063d68b02 couple path separator fixes 2013-06-18 14:08:35 -04:00
Joey Hess
6ac3d33445 allow test temp dir removal to fail (working around some problem on Windows) 2013-06-18 13:41:33 -04:00
Joey Hess
09edbd5df2 some basic tests of preferred content expressions and standard groups 2013-05-25 13:51:36 -04:00
Joey Hess
f8e940eb8e Fix bug in parsing of parens in some preferred content expressions. This fixes the behavior of the manual mode group.
The current manual mode preferred content expression is:

"present and (((exclude=*/archive/* and exclude=archive/*) or (not (copies=archive:1 or copies=smallarchive:1))) or (not copies=semitrusted+:1))"

The old matcher misparsed this, to basically:

OR (present and (...)) (not copies=semitrusted+:1))

The paren handling and indeed the whole conversion from tokens to the
matcher was just wrong. The new way may not be the cleverest, but I think
it is correct, and you can see how it pattern matches structurally against
the expressions when parsing them.

That expression is now parsed to:

MAnd (MOp <function>)
  (MOr (MOr (MAnd (MOp <function>) (MOp <function>)) (MNot (MOr (MOp <function>) (MOp <function>))))
    (MNot (MOp <function>)))

Which appears correct, and behaves correct in testing.

Also threw in a simplifier, so the final generated Matcher has less
unnecessary clutter in it. Mostly so that I could more easily read &
confirm them.

Also, added a simple test of the Matcher to the test suite.

There is a small chance of badly formed preferred content expressions
behaving differently than before due to this rewrite.
2013-05-24 21:46:33 -04:00
Joey Hess
46eb1ea1e7 add a test case for merge conflict automatic resolution 2013-05-20 16:28:22 -04:00
Joey Hess
475e705643 run the test suite twice, once in direct mode
On a filesystem that only supports direct mode, it will test
direct mode twice, but oh well.
2013-05-20 14:09:50 -04:00
Joey Hess
19715b9cff fix windows build 2013-05-19 21:07:47 -04:00
Joey Hess
d5ba9cb728 Allow building with gpg2. 2013-05-19 17:59:58 -04:00
Joey Hess
de3853375e better message 2013-05-17 16:52:50 -04:00
Joey Hess
142bd163a2 ssh warnings 2013-05-17 16:51:46 -04:00
Joey Hess
7f6a82df67 can't test gpg on Windows yet 2013-05-17 16:49:34 -04:00
Joey Hess
b26e20fa59 use posixcompat 2013-05-17 16:47:25 -04:00
Joey Hess
8779ad1be9 try building test suite on windows 2013-05-17 16:45:44 -04:00
Joey Hess
ba0c165704 fsck behavior varies in direct mode when the file is modified 2013-05-17 15:20:21 -04:00
Joey Hess
a5dc269cd7 disable unused test in direct mode
This test is actually pointing at a problem, with
getKeysPresent in direct mode. When a file is git rm -f'd,
this removes its content, but it's still listed by getKeysPresent.

However, unused is fairly useless in direct mode, and the test
needs to be updated to handle other differences, so disable it for now
2013-05-17 15:16:28 -04:00
Joey Hess
bc2dcee514 disable stuff that is not supported in direct mode
Also fixed a git rm that failed due to seeing modified file content
in direct mode.
2013-05-17 15:00:33 -04:00
Joey Hess
26923b5d64 fix test 2013-05-15 22:10:49 -04:00
Joey Hess
c3e19d65e4 cleanup 2013-05-15 19:58:40 -04:00
Joey Hess
ecca55ae85 more fixes for test suite in direct mode
Still quite a few failures.
2013-05-15 19:33:27 -04:00
Joey Hess
ee942c876f a few fixes for the test suite in direct mode
Still far from working.
2013-05-15 17:44:30 -04:00