2011-01-07 00:09:49 +00:00
|
|
|
{- git-annex test suite
|
|
|
|
-
|
2023-02-20 18:31:24 +00:00
|
|
|
- Copyright 2010-2023 Joey Hess <id@joeyh.name>
|
2011-01-07 00:09:49 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2011-01-07 00:09:49 +00:00
|
|
|
-}
|
|
|
|
|
2013-05-17 20:45:44 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2013-02-27 19:35:07 +00:00
|
|
|
module Test where
|
|
|
|
|
2016-01-06 17:44:12 +00:00
|
|
|
import Types.Test
|
2018-10-25 21:23:53 +00:00
|
|
|
import Types.RepoVersion
|
2022-03-16 18:42:07 +00:00
|
|
|
import Types.Concurrency
|
2018-02-18 15:48:48 +00:00
|
|
|
import Test.Framework
|
2015-07-13 17:19:20 +00:00
|
|
|
|
2013-08-06 04:12:06 +00:00
|
|
|
import Test.Tasty
|
|
|
|
import Test.Tasty.HUnit
|
|
|
|
import Test.Tasty.QuickCheck
|
2022-09-22 19:58:45 +00:00
|
|
|
import Options.Applicative.Types
|
|
|
|
import Options.Applicative (switch, long, short, help, internal, maybeReader, option, metavar)
|
2011-04-25 19:28:41 +00:00
|
|
|
|
2011-01-12 05:58:23 +00:00
|
|
|
import qualified Data.Map as M
|
2016-07-26 23:15:34 +00:00
|
|
|
import qualified Data.ByteString.Lazy.UTF8 as BU8
|
2020-04-30 16:59:20 +00:00
|
|
|
import Control.Concurrent.STM hiding (check)
|
2010-11-02 21:08:16 +00:00
|
|
|
|
2011-10-04 02:24:57 +00:00
|
|
|
import Common
|
2017-03-17 23:13:52 +00:00
|
|
|
import CmdLine.GitAnnex.Options
|
2023-03-01 19:55:58 +00:00
|
|
|
import qualified Utility.RawFilePath as R
|
2011-08-22 20:14:12 +00:00
|
|
|
|
2020-11-10 00:07:31 +00:00
|
|
|
import qualified Utility.ShellEscape
|
2011-01-11 19:43:29 +00:00
|
|
|
import qualified Annex
|
2023-04-12 21:18:29 +00:00
|
|
|
import qualified Git.Quote
|
2014-02-07 00:33:30 +00:00
|
|
|
import qualified Git.Types
|
2014-03-04 18:31:26 +00:00
|
|
|
import qualified Git.Ref
|
|
|
|
import qualified Git.LsTree
|
2014-03-04 19:06:40 +00:00
|
|
|
import qualified Git.FilePath
|
2016-01-20 20:36:33 +00:00
|
|
|
import qualified Annex.Locations
|
2017-10-24 16:24:06 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2017-08-17 16:26:14 +00:00
|
|
|
import qualified Types.GitConfig
|
2017-10-24 16:24:06 +00:00
|
|
|
#endif
|
2012-12-20 03:43:15 +00:00
|
|
|
import qualified Types.TrustLevel
|
2011-01-26 01:49:04 +00:00
|
|
|
import qualified Types
|
2014-03-15 17:44:31 +00:00
|
|
|
import qualified Logs.MapLog
|
2011-10-15 20:21:08 +00:00
|
|
|
import qualified Logs.Trust
|
|
|
|
import qualified Logs.Remote
|
2012-05-06 00:11:08 +00:00
|
|
|
import qualified Logs.Unused
|
2012-12-19 20:15:39 +00:00
|
|
|
import qualified Logs.Transfer
|
2012-12-20 02:14:12 +00:00
|
|
|
import qualified Logs.Presence
|
2019-02-21 16:22:50 +00:00
|
|
|
import qualified Logs.ContentIdentifier
|
2015-06-17 17:49:29 +00:00
|
|
|
import qualified Logs.PreferredContent
|
2014-02-12 21:54:28 +00:00
|
|
|
import qualified Types.MetaData
|
2011-03-27 20:58:28 +00:00
|
|
|
import qualified Remote
|
2017-02-24 17:42:30 +00:00
|
|
|
import qualified Key
|
2013-05-15 21:44:30 +00:00
|
|
|
import qualified Config
|
2013-03-13 20:16:01 +00:00
|
|
|
import qualified Config.Cost
|
2011-04-21 20:56:24 +00:00
|
|
|
import qualified Crypto
|
2017-08-14 19:11:42 +00:00
|
|
|
import qualified Database.Keys
|
2015-12-15 19:34:28 +00:00
|
|
|
import qualified Annex.WorkTree
|
2014-02-07 00:33:30 +00:00
|
|
|
import qualified Annex.CatFile
|
2017-08-14 17:55:38 +00:00
|
|
|
import qualified Annex.VectorClock
|
2021-11-22 17:28:20 +00:00
|
|
|
import qualified Annex.VariantFile
|
2014-02-16 21:39:54 +00:00
|
|
|
import qualified Annex.View
|
2014-02-22 18:54:53 +00:00
|
|
|
import qualified Annex.View.ViewedFile
|
2014-02-18 21:38:23 +00:00
|
|
|
import qualified Logs.View
|
2020-04-29 19:48:09 +00:00
|
|
|
import qualified Command.TestRemote
|
2020-11-10 00:07:31 +00:00
|
|
|
import qualified Utility.Path.Tests
|
2011-09-28 19:17:45 +00:00
|
|
|
import qualified Utility.FileMode
|
2017-12-14 16:46:57 +00:00
|
|
|
import qualified BuildInfo
|
2011-12-23 00:14:35 +00:00
|
|
|
import qualified Utility.Format
|
2012-09-08 03:23:52 +00:00
|
|
|
import qualified Utility.Verifiable
|
2012-10-11 17:45:09 +00:00
|
|
|
import qualified Utility.Process
|
2012-10-16 02:22:40 +00:00
|
|
|
import qualified Utility.Misc
|
2013-02-14 20:17:40 +00:00
|
|
|
import qualified Utility.InodeCache
|
2013-05-25 01:33:54 +00:00
|
|
|
import qualified Utility.Matcher
|
2013-11-14 21:03:49 +00:00
|
|
|
import qualified Utility.Hash
|
|
|
|
import qualified Utility.Scheduled
|
2015-11-17 19:49:22 +00:00
|
|
|
import qualified Utility.Scheduled.QuickCheck
|
2013-11-14 21:03:49 +00:00
|
|
|
import qualified Utility.HumanTime
|
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 15:16:03 +00:00
|
|
|
import qualified Utility.Base64
|
2017-12-31 20:08:31 +00:00
|
|
|
import qualified Utility.Tmp.Dir
|
2016-12-24 18:46:31 +00:00
|
|
|
import qualified Utility.FileSystemEncoding
|
Fix mangling of --json output of utf-8 characters when not running in a utf-8 locale
As long as all code imports Utility.Aeson rather than Data.Aeson,
and no Strings that may contain utf-8 characters are used for eg, object
keys via T.pack, this is guaranteed to fix the problem everywhere that
git-annex generates json.
It's kind of annoying to need to wrap ToJSON with a ToJSON', especially
since every data type that has a ToJSON instance has to be ported over.
However, that only took 50 lines of code, which is worth it to ensure full
coverage. I initially tried an alternative approach of a newtype FileEncoded,
which had to be used everywhere a String was fed into aeson, and chasing
down all the sites would have been far too hard. Did consider creating an
intentionally overlapping instance ToJSON String, and letting ghc fail
to build anything that passed in a String, but am not sure that wouldn't
pollute some library that git-annex depends on that happens to use ToJSON
String internally.
This commit was supported by the NSF-funded DataLad project.
2018-04-16 19:42:45 +00:00
|
|
|
import qualified Utility.Aeson
|
2019-11-14 18:02:09 +00:00
|
|
|
import qualified Utility.CopyFile
|
2022-07-05 20:22:41 +00:00
|
|
|
import qualified Utility.MoveFile
|
2020-07-02 16:18:42 +00:00
|
|
|
import qualified Types.Remote
|
2014-10-16 19:54:02 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2013-11-14 21:03:49 +00:00
|
|
|
import qualified Remote.Helper.Encryptable
|
|
|
|
import qualified Types.Crypto
|
|
|
|
import qualified Utility.Gpg
|
2013-05-17 20:51:46 +00:00
|
|
|
#endif
|
2010-11-02 20:49:35 +00:00
|
|
|
|
2016-01-06 17:44:12 +00:00
|
|
|
optParser :: Parser TestOptions
|
|
|
|
optParser = TestOptions
|
2022-11-28 19:12:53 +00:00
|
|
|
<$> snd (tastyParser (tests 1 False True (TestOptions mempty False False Nothing mempty False mempty)))
|
2016-01-06 17:44:12 +00:00
|
|
|
<*> switch
|
|
|
|
( long "keep-failures"
|
|
|
|
<> help "preserve repositories on test failure"
|
2017-03-17 23:13:52 +00:00
|
|
|
)
|
|
|
|
<*> switch
|
|
|
|
( long "fakessh"
|
|
|
|
<> internal
|
|
|
|
)
|
2022-03-16 18:42:07 +00:00
|
|
|
<*> optional (option (maybeReader parseConcurrency)
|
|
|
|
( long "jobs"
|
|
|
|
<> short 'J'
|
|
|
|
<> help "number of concurrent jobs"
|
|
|
|
))
|
2022-09-22 19:58:45 +00:00
|
|
|
<*> many (option (maybeReader parseconfigvalue)
|
|
|
|
( long "test-git-config"
|
|
|
|
<> help "run tests with a git config set"
|
|
|
|
<> metavar "NAME=VALUE"
|
|
|
|
))
|
2022-11-28 19:12:53 +00:00
|
|
|
<*> switch
|
|
|
|
( long "test-debug"
|
|
|
|
<> help "show debug messages for commands run by test suite"
|
|
|
|
)
|
2017-03-17 23:13:52 +00:00
|
|
|
<*> cmdParams "non-options are for internal use only"
|
2022-09-22 19:58:45 +00:00
|
|
|
where
|
|
|
|
parseconfigvalue s = case break (== '=') s of
|
|
|
|
(_, []) -> Nothing
|
|
|
|
(k, v) -> Just
|
|
|
|
( Git.Types.ConfigKey (encodeBS k)
|
|
|
|
, Git.Types.ConfigValue (encodeBS (drop 1 v))
|
|
|
|
)
|
2015-07-13 17:19:20 +00:00
|
|
|
|
2018-11-19 16:39:16 +00:00
|
|
|
runner :: TestOptions -> IO ()
|
2022-03-14 19:24:37 +00:00
|
|
|
runner opts = parallelTestRunner opts tests
|
2013-08-06 04:12:06 +00:00
|
|
|
|
allow tests to be split for more granularity
Unit tests are the main bulk of runtime, so splitting them into 2 or 3
parts should help.
For now, the number of parts is still 1, because on my 4 core laptop,
2 was a little bit slower, and 3 slower yet. However, this probably does
vary based on the number of cores, so needs to be revisited, and perhaps
made dynamic.
Since each test mode gets split into the specified number of parts,
plus property and remote tests, 2 gives 8 parts, and 3 gives 11 parts.
Load went to maybe 18, so there was probably contention slowing things
down.
So probably it needs to start N workers with some parts, and when a
worker finishes, run it with the next part, until all parts are
processed.
Sponsored-by: Dartmouth College's Datalad project
2022-03-14 21:23:52 +00:00
|
|
|
tests :: Int -> Bool -> Bool -> TestOptions -> [TestTree]
|
|
|
|
tests n crippledfilesystem adjustedbranchok opts =
|
2022-03-14 19:24:37 +00:00
|
|
|
properties
|
2022-03-16 16:53:08 +00:00
|
|
|
: withTestMode remotetestmode testRemotes
|
|
|
|
: concatMap mkrepotests testmodes
|
2015-12-15 21:19:26 +00:00
|
|
|
where
|
2016-02-16 19:30:59 +00:00
|
|
|
testmodes = catMaybes
|
2022-10-12 20:13:30 +00:00
|
|
|
[ canadjust ("v10 adjusted unlocked branch", (testMode opts (RepoVersion 10)) { adjustedUnlockedBranch = True })
|
|
|
|
, unlesscrippled ("v10 unlocked", (testMode opts (RepoVersion 10)) { unlockedFiles = True })
|
|
|
|
, unlesscrippled ("v10 locked", testMode opts (RepoVersion 10))
|
2015-12-28 16:57:42 +00:00
|
|
|
]
|
2020-04-30 16:59:20 +00:00
|
|
|
remotetestmode = testMode opts (RepoVersion 8)
|
2016-02-16 20:02:54 +00:00
|
|
|
unlesscrippled v
|
|
|
|
| crippledfilesystem = Nothing
|
|
|
|
| otherwise = Just v
|
2019-08-15 17:54:05 +00:00
|
|
|
canadjust v
|
|
|
|
| adjustedbranchok = Just v
|
|
|
|
| otherwise = Nothing
|
2022-03-16 16:53:08 +00:00
|
|
|
mkrepotests (d, te) = map
|
|
|
|
(\uts -> withTestMode te uts)
|
|
|
|
(repoTests d n)
|
2015-07-08 04:03:28 +00:00
|
|
|
|
2013-08-06 04:12:06 +00:00
|
|
|
properties :: TestTree
|
2020-03-02 18:25:45 +00:00
|
|
|
properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck" $
|
2023-04-12 21:18:29 +00:00
|
|
|
[ testProperty "prop_quote_unquote_roundtrip" Git.Quote.prop_quote_unquote_roundtrip
|
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 20:17:09 +00:00
|
|
|
, testProperty "prop_encode_c_decode_c_roundtrip" Utility.Format.prop_encode_c_decode_c_roundtrip
|
2017-02-24 17:42:30 +00:00
|
|
|
, testProperty "prop_isomorphic_key_encode" Key.prop_isomorphic_key_encode
|
2020-11-10 00:07:31 +00:00
|
|
|
, testProperty "prop_isomorphic_shellEscape" Utility.ShellEscape.prop_isomorphic_shellEscape
|
|
|
|
, testProperty "prop_isomorphic_shellEscape_multiword" Utility.ShellEscape.prop_isomorphic_shellEscape_multiword
|
2015-11-16 18:37:31 +00:00
|
|
|
, testProperty "prop_isomorphic_configEscape" Logs.Remote.prop_isomorphic_configEscape
|
2013-08-06 04:12:06 +00:00
|
|
|
, testProperty "prop_parse_show_Config" Logs.Remote.prop_parse_show_Config
|
2020-11-10 00:07:31 +00:00
|
|
|
, testProperty "prop_upFrom_basics" Utility.Path.Tests.prop_upFrom_basics
|
|
|
|
, testProperty "prop_relPathDirToFileAbs_basics" Utility.Path.Tests.prop_relPathDirToFileAbs_basics
|
|
|
|
, testProperty "prop_relPathDirToFileAbs_regressionTest" Utility.Path.Tests.prop_relPathDirToFileAbs_regressionTest
|
2021-10-26 18:58:44 +00:00
|
|
|
, testProperty "prop_dirContains_regressionTest" Utility.Path.Tests.prop_dirContains_regressionTest
|
2013-08-06 04:12:06 +00:00
|
|
|
, testProperty "prop_cost_sane" Config.Cost.prop_cost_sane
|
|
|
|
, testProperty "prop_matcher_sane" Utility.Matcher.prop_matcher_sane
|
|
|
|
, testProperty "prop_HmacSha1WithCipher_sane" Crypto.prop_HmacSha1WithCipher_sane
|
2017-08-14 17:55:38 +00:00
|
|
|
, testProperty "prop_VectorClock_sane" Annex.VectorClock.prop_VectorClock_sane
|
2014-03-15 17:44:31 +00:00
|
|
|
, testProperty "prop_addMapLog_sane" Logs.MapLog.prop_addMapLog_sane
|
2013-08-06 04:12:06 +00:00
|
|
|
, testProperty "prop_verifiable_sane" Utility.Verifiable.prop_verifiable_sane
|
|
|
|
, testProperty "prop_segment_regressionTest" Utility.Misc.prop_segment_regressionTest
|
|
|
|
, testProperty "prop_read_write_transferinfo" Logs.Transfer.prop_read_write_transferinfo
|
|
|
|
, testProperty "prop_read_show_inodecache" Utility.InodeCache.prop_read_show_inodecache
|
2019-02-21 16:22:50 +00:00
|
|
|
, testProperty "prop_parse_build_presence_log" Logs.Presence.prop_parse_build_presence_log
|
|
|
|
, testProperty "prop_parse_build_contentidentifier_log" Logs.ContentIdentifier.prop_parse_build_contentidentifier_log
|
2013-08-06 04:12:06 +00:00
|
|
|
, testProperty "prop_read_show_TrustLevel" Types.TrustLevel.prop_read_show_TrustLevel
|
convert old uuid-based log parsers to attoparsec
This preserves the workaround for the old bug that caused NoUUID items
to be stored in the log, prefixing log lines with " ". It's now handled
implicitly, by using takeWhile1 (/= ' ') to get the uuid.
There is a behavior change from the old parser, which split the value
into words and then recombined it. That meant that "foo bar" and "foo\tbar"
came out as "foo bar". That behavior was not documented, and seems
surprising; it meant that after a git-annex describe here "foo bar",
you wouldn't get that same string back out when git-annex displayed repo
descriptions.
Otoh, some other parsers relied on the old behavior, and the attoparsec
rewrites had to deal with the issue themselves...
For group.log, there are some edge cases around the user providing a
group name with a leading or trailing space. The old parser would ignore
such excess whitespace. The new parser does too, because the alternative
is to refuse to parse something like " group1 group2 " due to excess
whitespace, which would be even more confusing behavior.
The only git-annex branch log file that is not converted to attoparsec
and bytestring-builder now is transitions.log.
2019-01-10 18:39:36 +00:00
|
|
|
, testProperty "prop_parse_build_TrustLevelLog" Logs.Trust.prop_parse_build_TrustLevelLog
|
2015-11-17 19:49:22 +00:00
|
|
|
, testProperty "prop_schedule_roundtrips" Utility.Scheduled.QuickCheck.prop_schedule_roundtrips
|
2014-04-12 18:19:56 +00:00
|
|
|
, testProperty "prop_past_sane" Utility.Scheduled.prop_past_sane
|
2013-11-14 21:03:49 +00:00
|
|
|
, testProperty "prop_duration_roundtrips" Utility.HumanTime.prop_duration_roundtrips
|
2014-02-13 02:27:55 +00:00
|
|
|
, testProperty "prop_metadata_sane" Types.MetaData.prop_metadata_sane
|
2014-02-12 21:54:28 +00:00
|
|
|
, testProperty "prop_metadata_serialize" Types.MetaData.prop_metadata_serialize
|
2014-02-18 21:38:23 +00:00
|
|
|
, testProperty "prop_branchView_legal" Logs.View.prop_branchView_legal
|
2016-01-08 16:45:32 +00:00
|
|
|
, testProperty "prop_viewPath_roundtrips" Annex.View.prop_viewPath_roundtrips
|
2014-02-17 01:00:12 +00:00
|
|
|
, testProperty "prop_view_roundtrips" Annex.View.prop_view_roundtrips
|
2014-02-22 18:54:53 +00:00
|
|
|
, testProperty "prop_viewedFile_rountrips" Annex.View.ViewedFile.prop_viewedFile_roundtrips
|
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 15:16:03 +00:00
|
|
|
, testProperty "prop_b64_roundtrips" Utility.Base64.prop_b64_roundtrips
|
2015-06-17 17:44:19 +00:00
|
|
|
, testProperty "prop_standardGroups_parse" Logs.PreferredContent.prop_standardGroups_parse
|
2020-03-02 18:25:45 +00:00
|
|
|
] ++ map (uncurry testProperty) combos
|
|
|
|
where
|
|
|
|
combos = concat
|
|
|
|
[ Utility.Hash.props_hashes_stable
|
|
|
|
, Utility.Hash.props_macs_stable
|
|
|
|
]
|
2010-11-02 21:08:16 +00:00
|
|
|
|
2020-04-30 17:49:22 +00:00
|
|
|
testRemotes :: TestTree
|
2021-04-23 04:38:18 +00:00
|
|
|
testRemotes = testGroup "Remote Tests" $
|
|
|
|
-- These tests are failing in really strange ways on Windows,
|
|
|
|
-- apparently not due to an actual problem with the remotes being
|
|
|
|
-- tested, so are disabled there.
|
|
|
|
#ifdef mingw32_HOST_OS
|
|
|
|
filter (\_ -> False)
|
|
|
|
#endif
|
2021-01-11 17:05:27 +00:00
|
|
|
[ testGitRemote
|
|
|
|
, testDirectoryRemote
|
2020-04-30 17:49:22 +00:00
|
|
|
]
|
|
|
|
|
2021-01-11 17:05:27 +00:00
|
|
|
testGitRemote :: TestTree
|
2021-01-11 17:31:36 +00:00
|
|
|
testGitRemote = testRemote False "git" $ \remotename -> do
|
2021-01-11 17:05:27 +00:00
|
|
|
git "clone" [".", "remotedir"] "git clone"
|
|
|
|
git "remote" ["add", remotename, "remotedir"] "git remote add"
|
|
|
|
|
|
|
|
testDirectoryRemote :: TestTree
|
2021-01-11 17:31:36 +00:00
|
|
|
testDirectoryRemote = testRemote True "directory" $ \remotename -> do
|
2021-01-11 17:05:27 +00:00
|
|
|
createDirectory "remotedir"
|
|
|
|
git_annex "initremote"
|
|
|
|
[ remotename
|
|
|
|
, "type=directory"
|
|
|
|
, "--quiet"
|
|
|
|
, "directory=remotedir"
|
|
|
|
, "encryption=none"
|
|
|
|
] "init"
|
2022-03-14 16:30:27 +00:00
|
|
|
|
2021-01-11 17:31:36 +00:00
|
|
|
testRemote :: Bool -> String -> (String -> IO ()) -> TestTree
|
|
|
|
testRemote testvariants remotetype setupremote =
|
2020-04-30 17:49:22 +00:00
|
|
|
withResource newEmptyTMVarIO (const noop) $ \getv ->
|
2021-01-11 17:05:27 +00:00
|
|
|
testGroup ("testremote type " ++ remotetype) $ concat
|
2020-04-30 17:49:22 +00:00
|
|
|
[ [testCase "init" (prep getv)]
|
|
|
|
, go getv
|
|
|
|
]
|
2020-04-29 19:48:09 +00:00
|
|
|
where
|
|
|
|
reponame = "test repo"
|
2020-04-30 17:49:22 +00:00
|
|
|
remotename = "testremote"
|
2020-04-29 19:48:09 +00:00
|
|
|
basesz = 1024 * 1024
|
2020-04-30 16:59:20 +00:00
|
|
|
keysizes = Command.TestRemote.keySizes basesz False
|
2020-04-29 19:48:09 +00:00
|
|
|
prep getv = do
|
|
|
|
d <- newmainrepodir
|
|
|
|
setmainrepodir d
|
|
|
|
innewrepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "init" [reponame, "--quiet"] "init"
|
2021-01-11 17:05:27 +00:00
|
|
|
setupremote remotename
|
2023-04-10 17:38:14 +00:00
|
|
|
r <- annexeval $ either giveup return
|
2020-04-30 17:49:22 +00:00
|
|
|
=<< Remote.byName' remotename
|
2020-06-22 18:25:49 +00:00
|
|
|
cache <- Command.TestRemote.newRemoteVariantCache
|
2020-04-30 16:59:20 +00:00
|
|
|
unavailr <- annexeval $ Types.Remote.mkUnavailable r
|
2020-06-22 18:25:49 +00:00
|
|
|
exportr <- annexeval $ Command.TestRemote.exportTreeVariant cache r
|
2020-04-30 16:59:20 +00:00
|
|
|
ks <- annexeval $ mapM Command.TestRemote.randKey keysizes
|
2020-04-29 19:48:09 +00:00
|
|
|
v <- getv
|
2020-06-22 18:25:49 +00:00
|
|
|
cv <- annexeval cache
|
2020-04-29 19:48:09 +00:00
|
|
|
liftIO $ atomically $ putTMVar v
|
2020-06-22 18:25:49 +00:00
|
|
|
(r, (unavailr, (exportr, (ks, cv))))
|
2020-04-30 16:59:20 +00:00
|
|
|
go getv = Command.TestRemote.mkTestTrees runannex mkrs mkunavailr mkexportr mkks
|
2020-04-29 19:48:09 +00:00
|
|
|
where
|
|
|
|
runannex = inmainrepo . annexeval
|
2021-01-11 17:31:36 +00:00
|
|
|
mkrs = if testvariants
|
|
|
|
then Command.TestRemote.remoteVariants cache mkr basesz False
|
|
|
|
else [fmap (fmap Just) mkr]
|
2020-04-30 17:49:22 +00:00
|
|
|
mkr = descas (remotetype ++ " remote") (fst <$> v)
|
2020-04-30 16:59:20 +00:00
|
|
|
mkunavailr = fst . snd <$> v
|
2020-04-30 17:13:08 +00:00
|
|
|
mkexportr = fst . snd . snd <$> v
|
2020-04-30 16:59:20 +00:00
|
|
|
mkks = map (\(sz, n) -> desckeysize sz (getk n))
|
|
|
|
(zip keysizes [0..])
|
2020-06-22 18:25:49 +00:00
|
|
|
getk n = fmap (!! n) (fst . snd . snd . snd <$> v)
|
|
|
|
cache = snd . snd . snd . snd <$> v
|
2020-04-30 16:59:20 +00:00
|
|
|
v = liftIO $ atomically . readTMVar =<< getv
|
|
|
|
descas = Command.TestRemote.Described
|
|
|
|
desckeysize sz = descas ("key size " ++ show sz)
|
2020-04-29 19:48:09 +00:00
|
|
|
|
2014-01-21 18:24:30 +00:00
|
|
|
{- These tests set up the test environment, but also test some basic parts
|
2022-03-16 16:53:08 +00:00
|
|
|
- of git-annex. They are always run before the repoTests. -}
|
2014-12-30 20:58:02 +00:00
|
|
|
initTests :: TestTree
|
2022-05-23 18:12:24 +00:00
|
|
|
initTests = testGroup initTestsName
|
2014-12-30 20:58:02 +00:00
|
|
|
[ testCase "init" test_init
|
|
|
|
, testCase "add" test_add
|
2014-01-21 18:24:30 +00:00
|
|
|
]
|
2014-12-30 20:58:02 +00:00
|
|
|
|
2022-03-16 16:53:08 +00:00
|
|
|
repoTests :: String -> Int -> [TestTree]
|
|
|
|
repoTests note numparts = map mk $ sep
|
2016-01-01 17:59:57 +00:00
|
|
|
[ testCase "add dup" test_add_dup
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "add extras" test_add_extras
|
2022-07-05 20:22:41 +00:00
|
|
|
, testCase "add moved link" test_add_moved
|
2021-12-30 17:16:57 +00:00
|
|
|
, testCase "readonly remote" test_readonly_remote
|
fix reversion in skipping deleted files
And add a test case for that.
This certianly loses some of the 2x performance improvement in file
seeking that seekFilteredKeys led to, because now it has to stat the
worktree files again. Without benchmarking, I expect there will still be
a sizable improvement, and also the git-annex branch precaching that
seekFilteredKeys can do will still be a win of its approach.
Also worth noting that lookupKey, when the file DNE, check if it's in an
adjusted branch with hidden files, and if so, finds the key for the
file anyway. That was intended to make git-annex sync --content be able
to process those files, but a side effect was that, when a file was
deleted but the deletion not yet staged, git-annex commands used to
still list it. That was actually a bug. This commit fixes that bug too.
(git-annex sync --content on such a branch does not use seekFilteredKeys
so was not affected by the reversion or by this behavior change)
This commit was sponsored by Jake Vosloo on Patreon.
2020-07-20 00:33:10 +00:00
|
|
|
, testCase "ignore deleted files" test_ignore_deleted_files
|
2020-07-13 16:53:09 +00:00
|
|
|
, testCase "metadata" test_metadata
|
2019-03-06 20:49:33 +00:00
|
|
|
, testCase "export_import" test_export_import
|
2019-05-06 18:24:42 +00:00
|
|
|
, testCase "export_import_subdir" test_export_import_subdir
|
2015-09-09 17:56:37 +00:00
|
|
|
, testCase "shared clone" test_shared_clone
|
2015-07-02 16:53:38 +00:00
|
|
|
, testCase "log" test_log
|
2020-11-02 19:06:55 +00:00
|
|
|
, testCase "view" test_view
|
2020-10-27 17:39:58 +00:00
|
|
|
, testCase "magic" test_magic
|
2015-06-03 18:39:47 +00:00
|
|
|
, testCase "import" test_import
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "reinject" test_reinject
|
|
|
|
, testCase "unannex (no copy)" test_unannex_nocopy
|
|
|
|
, testCase "unannex (with copy)" test_unannex_withcopy
|
|
|
|
, testCase "drop (no remote)" test_drop_noremote
|
|
|
|
, testCase "drop (with remote)" test_drop_withremote
|
|
|
|
, testCase "drop (untrusted remote)" test_drop_untrustedremote
|
|
|
|
, testCase "get" test_get
|
2017-03-17 23:18:45 +00:00
|
|
|
, testCase "get (ssh remote)" test_get_ssh_remote
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "move" test_move
|
2017-03-17 23:18:45 +00:00
|
|
|
, testCase "move (ssh remote)" test_move_ssh_remote
|
2020-11-13 17:49:12 +00:00
|
|
|
, testCase "move (numcopies)" test_move_numcopies
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "copy" test_copy
|
|
|
|
, testCase "lock" test_lock
|
2019-08-30 17:54:57 +00:00
|
|
|
, testCase "lock --force" test_lock_force
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "edit (no pre-commit)" test_edit
|
|
|
|
, testCase "edit (pre-commit)" test_edit_precommit
|
|
|
|
, testCase "partial commit" test_partial_commit
|
|
|
|
, testCase "fix" test_fix
|
|
|
|
, testCase "trust" test_trust
|
|
|
|
, testCase "fsck (basics)" test_fsck_basic
|
|
|
|
, testCase "fsck (bare)" test_fsck_bare
|
|
|
|
, testCase "fsck (local untrusted)" test_fsck_localuntrusted
|
|
|
|
, testCase "fsck (remote untrusted)" test_fsck_remoteuntrusted
|
2015-04-18 17:36:12 +00:00
|
|
|
, testCase "fsck --from remote" test_fsck_fromremote
|
2021-05-10 18:19:24 +00:00
|
|
|
, testCase "conversion git to annexed" test_conversion_git_to_annexed
|
|
|
|
, testCase "conversion annexed to git" test_conversion_annexed_to_git
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "migrate" test_migrate
|
|
|
|
, testCase "migrate (via gitattributes)" test_migrate_via_gitattributes
|
|
|
|
, testCase "unused" test_unused
|
|
|
|
, testCase "describe" test_describe
|
|
|
|
, testCase "find" test_find
|
|
|
|
, testCase "merge" test_merge
|
|
|
|
, testCase "info" test_info
|
|
|
|
, testCase "version" test_version
|
|
|
|
, testCase "sync" test_sync
|
2019-11-14 18:02:09 +00:00
|
|
|
, testCase "concurrent get of dup key regression" test_concurrent_get_of_dup_key_regression
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "union merge regression" test_union_merge_regression
|
2016-06-13 16:56:31 +00:00
|
|
|
, testCase "adjusted branch merge regression" test_adjusted_branch_merge_regression
|
2016-10-11 18:22:49 +00:00
|
|
|
, testCase "adjusted branch subtree regression" test_adjusted_branch_subtree_regression
|
2022-02-07 18:58:15 +00:00
|
|
|
, testCase "transition propagation" test_transition_propagation_reversion
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "conflict resolution" test_conflict_resolution
|
2016-04-12 17:01:31 +00:00
|
|
|
, testCase "conflict resolution (adjusted branch)" test_conflict_resolution_adjusted_branch
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "conflict resolution movein regression" test_conflict_resolution_movein_regression
|
|
|
|
, testCase "conflict resolution (mixed directory and file)" test_mixed_conflict_resolution
|
|
|
|
, testCase "conflict resolution symlink bit" test_conflict_resolution_symlink_bit
|
|
|
|
, testCase "conflict resolution (uncommitted local file)" test_uncommitted_conflict_resolution
|
|
|
|
, testCase "conflict resolution (removed file)" test_remove_conflict_resolution
|
|
|
|
, testCase "conflict resolution (nonannexed file)" test_nonannexed_file_conflict_resolution
|
|
|
|
, testCase "conflict resolution (nonannexed symlink)" test_nonannexed_symlink_conflict_resolution
|
2015-12-30 20:36:39 +00:00
|
|
|
, testCase "conflict resolution (mixed locked and unlocked file)" test_mixed_lock_conflict_resolution
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "map" test_map
|
|
|
|
, testCase "uninit" test_uninit
|
|
|
|
, testCase "uninit (in git-annex branch)" test_uninit_inbranch
|
|
|
|
, testCase "upgrade" test_upgrade
|
|
|
|
, testCase "whereis" test_whereis
|
|
|
|
, testCase "hook remote" test_hook_remote
|
|
|
|
, testCase "directory remote" test_directory_remote
|
|
|
|
, testCase "rsync remote" test_rsync_remote
|
|
|
|
, testCase "bup remote" test_bup_remote
|
2021-09-03 16:40:23 +00:00
|
|
|
, testCase "borg remote" test_borg_remote
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "crypto" test_crypto
|
|
|
|
, testCase "preferred content" test_preferred_content
|
2021-05-25 14:57:06 +00:00
|
|
|
, testCase "required_content" test_required_content
|
2014-12-30 20:58:02 +00:00
|
|
|
, testCase "add subdirs" test_add_subdirs
|
2015-02-10 19:20:07 +00:00
|
|
|
, testCase "addurl" test_addurl
|
2011-01-07 00:09:49 +00:00
|
|
|
]
|
allow tests to be split for more granularity
Unit tests are the main bulk of runtime, so splitting them into 2 or 3
parts should help.
For now, the number of parts is still 1, because on my 4 core laptop,
2 was a little bit slower, and 3 slower yet. However, this probably does
vary based on the number of cores, so needs to be revisited, and perhaps
made dynamic.
Since each test mode gets split into the specified number of parts,
plus property and remote tests, 2 gives 8 parts, and 3 gives 11 parts.
Load went to maybe 18, so there was probably contention slowing things
down.
So probably it needs to start N workers with some parts, and when a
worker finishes, run it with the next part, until all parts are
processed.
Sponsored-by: Dartmouth College's Datalad project
2022-03-14 21:23:52 +00:00
|
|
|
where
|
2022-03-16 16:53:08 +00:00
|
|
|
mk l = testGroup groupname (initTests : map adddep l)
|
2022-05-23 18:12:24 +00:00
|
|
|
adddep = Test.Tasty.after AllSucceed (groupname ++ "." ++ initTestsName)
|
2022-03-16 16:53:08 +00:00
|
|
|
groupname = "Repo Tests " ++ note
|
2022-11-07 18:44:51 +00:00
|
|
|
sep l =
|
|
|
|
-- Avoid separating into parts that contain less than
|
|
|
|
-- 5 tests each. Since the tests depend on the
|
|
|
|
-- initTests, this avoids spending too much work running
|
|
|
|
-- the initTests once per part.
|
|
|
|
let numparts' = if length l `div` numparts > 5
|
|
|
|
then numparts
|
|
|
|
else length l `div` 5
|
|
|
|
in sep' (replicate numparts' []) l
|
allow tests to be split for more granularity
Unit tests are the main bulk of runtime, so splitting them into 2 or 3
parts should help.
For now, the number of parts is still 1, because on my 4 core laptop,
2 was a little bit slower, and 3 slower yet. However, this probably does
vary based on the number of cores, so needs to be revisited, and perhaps
made dynamic.
Since each test mode gets split into the specified number of parts,
plus property and remote tests, 2 gives 8 parts, and 3 gives 11 parts.
Load went to maybe 18, so there was probably contention slowing things
down.
So probably it needs to start N workers with some parts, and when a
worker finishes, run it with the next part, until all parts are
processed.
Sponsored-by: Dartmouth College's Datalad project
2022-03-14 21:23:52 +00:00
|
|
|
sep' (p:ps) (l:ls) = sep' (ps++[l:p]) ls
|
|
|
|
sep' ps [] = ps
|
|
|
|
sep' [] _ = []
|
2011-01-07 00:09:49 +00:00
|
|
|
|
2020-04-29 19:48:09 +00:00
|
|
|
-- this test case creates the main repo
|
2014-12-30 20:58:02 +00:00
|
|
|
test_init :: Assertion
|
|
|
|
test_init = innewrepo $ do
|
2015-12-16 17:14:18 +00:00
|
|
|
ver <- annexVersion <$> getTestMode
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "init" [reponame, "--version", show (fromRepoVersion ver)] "init"
|
2015-12-15 21:19:26 +00:00
|
|
|
setupTestMode
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
reponame = "test repo"
|
2011-01-07 00:09:49 +00:00
|
|
|
|
2013-08-06 04:12:06 +00:00
|
|
|
-- this test case runs in the main repo, to set up a basic
|
|
|
|
-- annexed file that later tests will use
|
2014-12-30 20:58:02 +00:00
|
|
|
test_add :: Assertion
|
|
|
|
test_add = inmainrepo $ do
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent annexedfile $ content annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex annexedfile "add"
|
2013-08-06 04:12:06 +00:00
|
|
|
annexed_present annexedfile
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent sha1annexedfile $ content sha1annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [sha1annexedfile, "--backend=SHA1"] "add with SHA1"
|
2016-01-01 17:59:57 +00:00
|
|
|
whenM (unlockedFiles <$> getTestMode) $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unlock" [sha1annexedfile] "unlock"
|
2013-08-06 04:12:06 +00:00
|
|
|
annexed_present sha1annexedfile
|
|
|
|
checkbackend sha1annexedfile backendSHA1
|
2019-08-26 19:07:10 +00:00
|
|
|
writecontent ingitfile $ content ingitfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git "add" [ingitfile] "git add"
|
|
|
|
git "commit" ["-q", "-m", "commit"] "git commit"
|
|
|
|
git_annex "add" [ingitfile] "add ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
2013-08-06 04:12:06 +00:00
|
|
|
|
2016-01-01 17:59:57 +00:00
|
|
|
test_add_dup :: Assertion
|
|
|
|
test_add_dup = intmpclonerepo $ do
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent annexedfiledup $ content annexedfiledup
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex annexedfiledup "add of second file with same content failed"
|
2016-01-01 17:59:57 +00:00
|
|
|
annexed_present annexedfiledup
|
|
|
|
annexed_present annexedfile
|
2013-08-06 04:12:06 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_add_extras :: Assertion
|
|
|
|
test_add_extras = intmpclonerepo $ do
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent wormannexedfile $ content wormannexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [wormannexedfile, "--backend=WORM"] "add with WORM"
|
2016-01-01 17:59:57 +00:00
|
|
|
whenM (unlockedFiles <$> getTestMode) $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unlock" [wormannexedfile] "unlock"
|
2014-01-21 18:24:30 +00:00
|
|
|
annexed_present wormannexedfile
|
|
|
|
checkbackend wormannexedfile backendWORM
|
|
|
|
|
2022-07-05 20:22:41 +00:00
|
|
|
test_add_moved :: Assertion
|
|
|
|
test_add_moved = intmpclonerepo $ do
|
|
|
|
git_annex "get" [annexedfile] "get failed"
|
|
|
|
annexed_present annexedfile
|
|
|
|
createDirectory subdir
|
|
|
|
Utility.MoveFile.moveFile (toRawFilePath annexedfile) (toRawFilePath subfile)
|
|
|
|
git_annex "add" [subdir] "add of moved annexed file"
|
2022-08-19 16:49:17 +00:00
|
|
|
git "mv" [sha1annexedfile, sha1annexedfile ++ ".renamed"] "git mv"
|
|
|
|
git_annex "add" [] "add does not fail on deleted file after move"
|
2022-07-05 20:22:41 +00:00
|
|
|
where
|
|
|
|
subdir = "subdir"
|
|
|
|
subfile = subdir </> "file"
|
|
|
|
|
2021-12-30 17:16:57 +00:00
|
|
|
test_readonly_remote :: Assertion
|
|
|
|
test_readonly_remote =
|
2021-09-01 14:42:50 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2021-08-30 20:39:02 +00:00
|
|
|
withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
|
|
|
pair r1 r2
|
|
|
|
indir r1 $ do
|
|
|
|
git_annex "get" [annexedfile] "get failed in first repo"
|
2021-12-30 17:16:57 +00:00
|
|
|
make_readonly r1
|
2021-08-30 20:39:02 +00:00
|
|
|
indir r2 $ do
|
|
|
|
git_annex "sync" ["r1", "--no-push"] "sync with readonly repo"
|
|
|
|
git_annex "get" [annexedfile, "--from", "r1"] "get from readonly repo"
|
|
|
|
git "remote" ["rm", "origin"] "remote rm"
|
|
|
|
git_annex "drop" [annexedfile] "drop vs readonly repo"
|
2021-09-01 14:42:50 +00:00
|
|
|
#else
|
|
|
|
-- This test does not work on Windows, and it doesn't make sense to
|
|
|
|
-- try to support this on Windows anyway.
|
|
|
|
return ()
|
|
|
|
#endif
|
2021-08-30 20:39:02 +00:00
|
|
|
|
fix reversion in skipping deleted files
And add a test case for that.
This certianly loses some of the 2x performance improvement in file
seeking that seekFilteredKeys led to, because now it has to stat the
worktree files again. Without benchmarking, I expect there will still be
a sizable improvement, and also the git-annex branch precaching that
seekFilteredKeys can do will still be a win of its approach.
Also worth noting that lookupKey, when the file DNE, check if it's in an
adjusted branch with hidden files, and if so, finds the key for the
file anyway. That was intended to make git-annex sync --content be able
to process those files, but a side effect was that, when a file was
deleted but the deletion not yet staged, git-annex commands used to
still list it. That was actually a bug. This commit fixes that bug too.
(git-annex sync --content on such a branch does not use seekFilteredKeys
so was not affected by the reversion or by this behavior change)
This commit was sponsored by Jake Vosloo on Patreon.
2020-07-20 00:33:10 +00:00
|
|
|
test_ignore_deleted_files :: Assertion
|
|
|
|
test_ignore_deleted_files = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
fix reversion in skipping deleted files
And add a test case for that.
This certianly loses some of the 2x performance improvement in file
seeking that seekFilteredKeys led to, because now it has to stat the
worktree files again. Without benchmarking, I expect there will still be
a sizable improvement, and also the git-annex branch precaching that
seekFilteredKeys can do will still be a win of its approach.
Also worth noting that lookupKey, when the file DNE, check if it's in an
adjusted branch with hidden files, and if so, finds the key for the
file anyway. That was intended to make git-annex sync --content be able
to process those files, but a side effect was that, when a file was
deleted but the deletion not yet staged, git-annex commands used to
still list it. That was actually a bug. This commit fixes that bug too.
(git-annex sync --content on such a branch does not use seekFilteredKeys
so was not affected by the reversion or by this behavior change)
This commit was sponsored by Jake Vosloo on Patreon.
2020-07-20 00:33:10 +00:00
|
|
|
git_annex_expectoutput "find" [] [annexedfile]
|
2020-11-24 16:38:12 +00:00
|
|
|
removeWhenExistsWith R.removeLink (toRawFilePath annexedfile)
|
fix reversion in skipping deleted files
And add a test case for that.
This certianly loses some of the 2x performance improvement in file
seeking that seekFilteredKeys led to, because now it has to stat the
worktree files again. Without benchmarking, I expect there will still be
a sizable improvement, and also the git-annex branch precaching that
seekFilteredKeys can do will still be a win of its approach.
Also worth noting that lookupKey, when the file DNE, check if it's in an
adjusted branch with hidden files, and if so, finds the key for the
file anyway. That was intended to make git-annex sync --content be able
to process those files, but a side effect was that, when a file was
deleted but the deletion not yet staged, git-annex commands used to
still list it. That was actually a bug. This commit fixes that bug too.
(git-annex sync --content on such a branch does not use seekFilteredKeys
so was not affected by the reversion or by this behavior change)
This commit was sponsored by Jake Vosloo on Patreon.
2020-07-20 00:33:10 +00:00
|
|
|
-- A file that has been deleted, but the deletion not staged,
|
|
|
|
-- is a special case; make sure git-annex skips these.
|
|
|
|
git_annex_expectoutput "find" [] []
|
|
|
|
|
2020-07-13 16:53:09 +00:00
|
|
|
test_metadata :: Assertion
|
|
|
|
test_metadata = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "metadata" ["-s", "foo=bar", annexedfile] "set metadata"
|
2020-07-13 16:53:09 +00:00
|
|
|
git_annex_expectoutput "find" ["--metadata", "foo=bar"] [annexedfile]
|
|
|
|
git_annex_expectoutput "find" ["--metadata", "foo=other"] []
|
2021-12-30 17:16:57 +00:00
|
|
|
readonly_query $ do
|
|
|
|
git_annex_expectoutput "find" ["--metadata", "foo=bar"] [annexedfile]
|
|
|
|
git_annex_expectoutput "find" ["--metadata", "foo=other"] []
|
2020-07-13 16:53:09 +00:00
|
|
|
writecontent annexedfiledup $ content annexedfiledup
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex annexedfiledup "add of second file with same content failed"
|
2020-07-13 16:53:09 +00:00
|
|
|
annexed_present annexedfiledup
|
|
|
|
git_annex_expectoutput "find" ["--metadata", "foo=bar"]
|
|
|
|
[annexedfile, annexedfiledup]
|
|
|
|
git_annex_shouldfail "metadata" ["--remove", "foo", "."]
|
2020-11-24 21:17:09 +00:00
|
|
|
"removing metadata from dir with multiple files not allowed"
|
2020-07-13 16:53:09 +00:00
|
|
|
git_annex "metadata" ["--remove", "foo", annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
"removing metadata"
|
2020-07-13 16:53:09 +00:00
|
|
|
git_annex_expectoutput "find" ["--metadata", "foo=bar"] []
|
|
|
|
git_annex "metadata" ["--force", "-s", "foo=bar", "."]
|
2020-11-24 21:17:09 +00:00
|
|
|
"recursively set metadata force"
|
2020-07-13 16:53:09 +00:00
|
|
|
|
2015-09-09 17:56:37 +00:00
|
|
|
test_shared_clone :: Assertion
|
|
|
|
test_shared_clone = intmpsharedclonerepo $ do
|
|
|
|
v <- catchMaybeIO $ Utility.Process.readProcess "git"
|
|
|
|
[ "config"
|
|
|
|
, "--bool"
|
|
|
|
, "--get"
|
|
|
|
, "annex.hardlink"
|
|
|
|
]
|
|
|
|
v == Just "true\n"
|
|
|
|
@? "shared clone of repo did not get annex.hardlink set"
|
|
|
|
|
2015-07-02 16:53:38 +00:00
|
|
|
test_log :: Assertion
|
|
|
|
test_log = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "log" [annexedfile] "log"
|
2015-07-02 16:53:38 +00:00
|
|
|
|
2020-11-02 19:06:55 +00:00
|
|
|
test_view :: Assertion
|
|
|
|
test_view = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "metadata" ["-s", "test=test1", annexedfile] "metadata"
|
|
|
|
git_annex "metadata" ["-s", "test=test2", sha1annexedfile] "metadata"
|
|
|
|
git_annex "view" ["test=test1"] "entering view"
|
2020-11-02 19:06:55 +00:00
|
|
|
checkexists annexedfile
|
|
|
|
checkdoesnotexist sha1annexedfile
|
|
|
|
|
2020-10-27 17:39:58 +00:00
|
|
|
test_magic :: Assertion
|
|
|
|
test_magic = intmpclonerepo $ do
|
|
|
|
#ifdef WITH_MAGICMIME
|
2020-11-24 18:07:46 +00:00
|
|
|
git "config" ["annex.largefiles", "mimeencoding=binary"]
|
2020-11-24 21:17:09 +00:00
|
|
|
"git config annex.largefiles"
|
2020-10-27 17:39:58 +00:00
|
|
|
writeFile "binary" "\127"
|
|
|
|
writeFile "text" "test\n"
|
|
|
|
git_annex "add" ["binary", "text"]
|
2020-11-24 21:17:09 +00:00
|
|
|
"git-annex add with mimeencoding in largefiles"
|
2020-10-27 17:39:58 +00:00
|
|
|
git_annex "sync" []
|
2020-11-24 21:17:09 +00:00
|
|
|
"git-annex sync"
|
2020-10-27 17:39:58 +00:00
|
|
|
(isJust <$> annexeval (Annex.CatFile.catKeyFile (encodeBS "binary")))
|
|
|
|
@? "binary file not added to annex despite mimeencoding config"
|
|
|
|
(isNothing <$> annexeval (Annex.CatFile.catKeyFile (encodeBS "text")))
|
|
|
|
@? "non-binary file got added to annex despite mimeencoding config"
|
|
|
|
#else
|
|
|
|
return ()
|
|
|
|
#endif
|
|
|
|
|
2015-06-03 18:39:47 +00:00
|
|
|
test_import :: Assertion
|
2017-12-31 20:08:31 +00:00
|
|
|
test_import = intmpclonerepo $ Utility.Tmp.Dir.withTmpDir "importtest" $ \importdir -> do
|
2015-06-03 18:39:47 +00:00
|
|
|
(toimport1, importf1, imported1) <- mktoimport importdir "import1"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" [toimport1] "import"
|
2016-02-16 19:30:59 +00:00
|
|
|
annexed_present_imported imported1
|
2015-06-03 18:39:47 +00:00
|
|
|
checkdoesnotexist importf1
|
|
|
|
|
|
|
|
(toimport2, importf2, imported2) <- mktoimport importdir "import2"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" [toimport2] "import of duplicate"
|
2016-02-16 19:30:59 +00:00
|
|
|
annexed_present_imported imported2
|
2015-06-03 18:39:47 +00:00
|
|
|
checkdoesnotexist importf2
|
|
|
|
|
|
|
|
(toimport3, importf3, imported3) <- mktoimport importdir "import3"
|
|
|
|
git_annex "import" ["--skip-duplicates", toimport3]
|
2020-11-24 21:17:09 +00:00
|
|
|
"import of duplicate with --skip-duplicates"
|
2015-06-03 18:39:47 +00:00
|
|
|
checkdoesnotexist imported3
|
|
|
|
checkexists importf3
|
|
|
|
git_annex "import" ["--clean-duplicates", toimport3]
|
2020-11-24 21:17:09 +00:00
|
|
|
"import of duplicate with --clean-duplicates"
|
2015-06-03 18:39:47 +00:00
|
|
|
checkdoesnotexist imported3
|
|
|
|
checkdoesnotexist importf3
|
|
|
|
|
|
|
|
(toimport4, importf4, imported4) <- mktoimport importdir "import4"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" ["--deduplicate", toimport4] "import --deduplicate"
|
2015-06-03 18:39:47 +00:00
|
|
|
checkdoesnotexist imported4
|
|
|
|
checkdoesnotexist importf4
|
|
|
|
|
|
|
|
(toimport5, importf5, imported5) <- mktoimport importdir "import5"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" ["--duplicate", toimport5] "import --duplicate"
|
2016-02-16 19:30:59 +00:00
|
|
|
annexed_present_imported imported5
|
2015-06-03 18:39:47 +00:00
|
|
|
checkexists importf5
|
|
|
|
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" ["--force", imported1, imported2, imported5] "drop"
|
2016-02-16 19:30:59 +00:00
|
|
|
annexed_notpresent_imported imported2
|
2015-06-03 18:39:47 +00:00
|
|
|
(toimportdup, importfdup, importeddup) <- mktoimport importdir "importdup"
|
2018-10-30 14:49:39 +00:00
|
|
|
git_annex_shouldfail "import" ["--clean-duplicates", toimportdup]
|
2020-11-24 21:17:09 +00:00
|
|
|
"import of missing duplicate with --clean-duplicates not allowed"
|
2015-06-03 18:39:47 +00:00
|
|
|
checkdoesnotexist importeddup
|
|
|
|
checkexists importfdup
|
|
|
|
where
|
|
|
|
mktoimport importdir subdir = do
|
|
|
|
createDirectory (importdir </> subdir)
|
|
|
|
let importf = subdir </> "f"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent (importdir </> importf) (content importf)
|
2015-06-03 18:39:47 +00:00
|
|
|
return (importdir </> subdir, importdir </> importf, importf)
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_reinject :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_reinject = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" ["--force", sha1annexedfile] "drop"
|
2016-01-05 21:19:30 +00:00
|
|
|
annexed_notpresent sha1annexedfile
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent tmp $ content sha1annexedfile
|
2019-01-14 17:03:35 +00:00
|
|
|
key <- Key.serializeKey <$> getKey backendSHA1 tmp
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "reinject" [tmp, sha1annexedfile] "reinject"
|
2016-01-05 21:19:30 +00:00
|
|
|
annexed_present sha1annexedfile
|
2021-05-03 17:37:30 +00:00
|
|
|
git_annex "fromkey" [key, sha1annexedfiledup] "fromkey for dup"
|
|
|
|
whenM (unlockedFiles <$> getTestMode) $
|
|
|
|
git_annex "unlock" [sha1annexedfiledup] "unlock"
|
|
|
|
annexed_present sha1annexedfiledup
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
tmp = "tmpfile"
|
2011-01-11 23:59:11 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_unannex_nocopy :: Assertion
|
|
|
|
test_unannex_nocopy = intmpclonerepo $ do
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unannex" [annexedfile] "unannex with no copy"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_notpresent annexedfile
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_unannex_withcopy :: Assertion
|
|
|
|
test_unannex_withcopy = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unannex" [annexedfile, sha1annexedfile] "unannex"
|
2013-11-14 21:03:49 +00:00
|
|
|
unannexed annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unannex" [ingitfile] "unannex ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
2011-01-07 01:39:26 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_drop_noremote :: Assertion
|
|
|
|
test_drop_noremote = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
|
|
|
git "remote" ["rm", "origin"] "git remote rm origin"
|
|
|
|
git_annex_shouldfail "drop" [annexedfile] "drop with no known copy of file not allowed"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" ["--force", annexedfile] "drop --force"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile] "drop of dropped file"
|
|
|
|
git_annex "drop" [ingitfile] "drop ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_drop_withremote :: Assertion
|
|
|
|
test_drop_withremote = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "numcopies" ["2"] "numcopies config"
|
|
|
|
git_annex_shouldfail "drop" [annexedfile] "drop with numcopies not satisfied is not allowed"
|
|
|
|
git_annex "numcopies" ["1"] "numcopies config"
|
|
|
|
git_annex "drop" [annexedfile] "drop when origin has copy"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_notpresent annexedfile
|
2015-02-09 19:24:33 +00:00
|
|
|
-- make sure that the correct symlink is staged for the file
|
|
|
|
-- after drop
|
|
|
|
git_annex_expectoutput "status" [] []
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_drop_untrustedremote :: Assertion
|
|
|
|
test_drop_untrustedremote = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "untrust" ["origin"] "untrust of origin"
|
|
|
|
git_annex "get" [annexedfile] "get"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "drop" [annexedfile] "drop with only an untrusted copy of the file should fail"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_get :: Assertion
|
2017-03-17 23:13:52 +00:00
|
|
|
test_get = test_get' intmpclonerepo
|
|
|
|
|
|
|
|
test_get_ssh_remote :: Assertion
|
2019-08-08 18:58:40 +00:00
|
|
|
test_get_ssh_remote =
|
|
|
|
#ifndef mingw32_HOST_OS
|
|
|
|
test_get' (with_ssh_origin intmpclonerepo)
|
|
|
|
#else
|
|
|
|
noop
|
|
|
|
#endif
|
2017-03-17 23:13:52 +00:00
|
|
|
|
|
|
|
test_get' :: (Assertion -> Assertion) -> Assertion
|
|
|
|
test_get' setup = setup $ do
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file already here"
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2019-08-26 19:07:10 +00:00
|
|
|
inmainrepo $ unannexed ingitfile
|
|
|
|
unannexed ingitfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [ingitfile] "get ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
inmainrepo $ unannexed ingitfile
|
|
|
|
unannexed ingitfile
|
2011-01-07 05:02:06 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_move :: Assertion
|
2017-03-17 23:18:45 +00:00
|
|
|
test_move = test_move' intmpclonerepo
|
|
|
|
|
|
|
|
test_move_ssh_remote :: Assertion
|
2019-08-08 18:58:40 +00:00
|
|
|
test_move_ssh_remote =
|
|
|
|
#ifndef mingw32_HOST_OS
|
|
|
|
test_move' (with_ssh_origin intmpclonerepo)
|
|
|
|
#else
|
|
|
|
noop
|
|
|
|
#endif
|
2017-03-17 23:18:45 +00:00
|
|
|
|
|
|
|
test_move' :: (Assertion -> Assertion) -> Assertion
|
|
|
|
test_move' setup = setup $ do
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_notpresent annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--from", "origin", annexedfile] "move --from of file"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--from", "origin", annexedfile] "move --from of file already here"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--to", "origin", annexedfile] "move --to of file"
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--to", "origin", annexedfile] "move --to of file already there"
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_notpresent annexedfile
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
|
|
|
inmainrepo $ unannexed ingitfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--to", "origin", ingitfile] "move of ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
|
|
|
inmainrepo $ unannexed ingitfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--from", "origin", ingitfile] "move of ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
|
|
|
inmainrepo $ unannexed ingitfile
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2020-11-13 17:49:12 +00:00
|
|
|
test_move_numcopies :: Assertion
|
|
|
|
test_move_numcopies = intmpclonerepo $ do
|
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "numcopies" ["2"] "setting numcopies"
|
|
|
|
git_annex "move" ["--from", "origin", annexedfile] "move of file --from remote with numcopies unsatisfied but not made worse"
|
2020-11-13 17:49:12 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
inmainrepo $ annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--to", "origin", annexedfile] "move of file --to remote with numcopies unsatisfied but not made worse"
|
2020-11-13 17:49:12 +00:00
|
|
|
annexed_notpresent annexedfile
|
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2023-03-13 22:55:18 +00:00
|
|
|
git_annex_shouldfail "move" ["--from", "origin", annexedfile] "move of file --from remote that violates numcopies setting not allowed"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "move" ["--to", "origin", annexedfile] "move of file --to remote that violates numcopies setting not allowed"
|
2020-11-13 17:49:12 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_copy :: Assertion
|
|
|
|
test_copy = intmpclonerepo $ do
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_notpresent annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--from", "origin", annexedfile] "copy --from of file"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--from", "origin", annexedfile] "copy --from of file already here"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--to", "origin", annexedfile] "copy --to of file already there"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" ["--to", "origin", annexedfile] "move --to of file already there"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_notpresent annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
inmainrepo $ annexed_present annexedfile
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
|
|
|
inmainrepo $ unannexed ingitfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--to", "origin", ingitfile] "copy of ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
unannexed ingitfile
|
|
|
|
inmainrepo $ unannexed ingitfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--from", "origin", ingitfile] "copy of ingitfile should be no-op"
|
2019-08-26 19:07:10 +00:00
|
|
|
checkregularfile ingitfile
|
|
|
|
checkcontent ingitfile
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_preferred_content :: Assertion
|
|
|
|
test_preferred_content = intmpclonerepo $ do
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
2015-10-06 21:35:29 +00:00
|
|
|
-- get/copy --auto looks only at numcopies when preferred content is not
|
2013-05-25 17:51:36 +00:00
|
|
|
-- set, and with 1 copy existing, does not get the file.
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" ["--auto", annexedfile] "get --auto of file with default preferred content"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--from", "origin", "--auto", annexedfile] "copy --auto --from of file with default preferred content"
|
2015-10-06 21:35:29 +00:00
|
|
|
annexed_notpresent annexedfile
|
2013-05-25 17:51:36 +00:00
|
|
|
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "wanted" [".", "standard"] "set expression to standard"
|
|
|
|
git_annex "group" [".", "client"] "set group to standard"
|
|
|
|
git_annex "get" ["--auto", annexedfile] "get --auto of file for client"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile] "drop of file"
|
|
|
|
git_annex "copy" ["--from", "origin", "--auto", annexedfile] "copy --auto --from of file for client"
|
2015-10-06 21:35:29 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "ungroup" [".", "client"] "ungroup"
|
2013-05-25 17:51:36 +00:00
|
|
|
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "wanted" [".", "standard"] "set expression to standard"
|
|
|
|
git_annex "group" [".", "manual"] "set group to manual"
|
2013-05-25 17:51:36 +00:00
|
|
|
-- drop --auto with manual leaves the file where it is
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" ["--auto", annexedfile] "drop --auto of file with manual preferred content"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile] "drop of file"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
2015-10-06 21:35:29 +00:00
|
|
|
-- copy/get --auto with manual does not get the file
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" ["--auto", annexedfile] "get --auto of file with manual preferred content"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" ["--from", "origin", "--auto", annexedfile] "copy --auto --from of file with manual preferred content"
|
2015-10-06 21:35:29 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "ungroup" [".", "client"] "ungroup"
|
2013-05-25 17:51:36 +00:00
|
|
|
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "wanted" [".", "exclude=*"] "set expression to exclude=*"
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" ["--auto", annexedfile] "drop --auto of file with exclude=*"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" ["--auto", annexedfile] "get --auto of file with exclude=*"
|
2013-05-25 17:51:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
|
|
|
|
2021-05-25 14:57:06 +00:00
|
|
|
test_required_content :: Assertion
|
|
|
|
test_required_content = intmpclonerepo $ do
|
|
|
|
git_annex "get" [annexedfile] "get"
|
|
|
|
annexed_present annexedfile
|
|
|
|
git_annex "required" [".", "include=" ++ annexedfile] "annexedfile required"
|
|
|
|
|
|
|
|
git_annex_shouldfail "drop" [annexedfile] "drop of required content should fail"
|
|
|
|
annexed_present annexedfile
|
|
|
|
|
|
|
|
git_annex "drop" ["--auto", annexedfile] "drop --auto of required content skips it"
|
|
|
|
annexed_present annexedfile
|
|
|
|
|
|
|
|
writecontent annexedfiledup $ content annexedfiledup
|
|
|
|
add_annex annexedfiledup "add of second file with same content failed"
|
|
|
|
annexed_present annexedfiledup
|
|
|
|
annexed_present annexedfile
|
|
|
|
|
|
|
|
git_annex_shouldfail "drop" [annexedfiledup] "drop of file sharing required content should fail"
|
|
|
|
annexed_present annexedfiledup
|
|
|
|
annexed_present annexedfile
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_lock :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_lock = intmpclonerepo $ do
|
2011-01-14 03:46:02 +00:00
|
|
|
annexed_notpresent annexedfile
|
|
|
|
|
2015-01-02 17:59:25 +00:00
|
|
|
-- regression test: unlock of newly added, not committed file
|
2019-08-30 17:54:57 +00:00
|
|
|
-- should not fail.
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent "newfile" "foo"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["newfile"] "add new file"
|
|
|
|
git_annex "unlock" ["newfile"] "unlock on newly added, never committed file"
|
2015-01-02 17:59:25 +00:00
|
|
|
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unlock" [annexedfile] "unlock"
|
2011-01-07 18:06:32 +00:00
|
|
|
unannexed annexedfile
|
|
|
|
-- write different content, to verify that lock
|
|
|
|
-- throws it away
|
|
|
|
changecontent annexedfile
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent annexedfile $ content annexedfile ++ "foo"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "lock" [annexedfile] "lock without --force should not be allowed"
|
|
|
|
git_annex "lock" ["--force", annexedfile] "lock --force"
|
2019-08-30 17:54:57 +00:00
|
|
|
-- The original content of an unlocked file is not always
|
2015-12-16 20:56:27 +00:00
|
|
|
-- preserved after modification, so re-get it.
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file after lock --force"
|
2016-01-06 20:12:00 +00:00
|
|
|
annexed_present_locked annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unlock" [annexedfile] "unlock"
|
2011-01-07 18:06:32 +00:00
|
|
|
unannexed annexedfile
|
|
|
|
changecontent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git "add" [annexedfile] "add of modified file"
|
2019-08-30 17:54:57 +00:00
|
|
|
runchecks [checkregularfile, checkwritable] annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
c <- readFile annexedfile
|
2011-07-15 07:12:05 +00:00
|
|
|
assertEqual "content of modified file" c (changedcontent annexedfile)
|
2020-11-24 18:07:46 +00:00
|
|
|
git_annex_shouldfail "drop" [annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
"drop with no known copy of modified file should not be allowed"
|
2011-01-07 18:06:32 +00:00
|
|
|
|
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 16:56:26 +00:00
|
|
|
-- Regression test: lock --force when work tree file
|
|
|
|
-- was modified lost the (unmodified) annex object.
|
|
|
|
-- (Only occurred when the keys database was out of sync.)
|
2019-08-30 17:54:57 +00:00
|
|
|
test_lock_force :: Assertion
|
|
|
|
test_lock_force = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "upgrade" [] "upgrade"
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
|
|
|
git_annex "unlock" [annexedfile] "unlock"
|
2019-08-30 17:54:57 +00:00
|
|
|
annexeval $ do
|
2020-07-10 18:17:35 +00:00
|
|
|
Just k <- Annex.WorkTree.lookupKey (toRawFilePath annexedfile)
|
2019-08-30 17:54:57 +00:00
|
|
|
Database.Keys.removeInodeCaches k
|
|
|
|
Database.Keys.closeDb
|
2020-11-04 18:20:37 +00:00
|
|
|
liftIO . removeWhenExistsWith R.removeLink
|
2022-08-11 20:57:44 +00:00
|
|
|
=<< Annex.calcRepo' Annex.Locations.gitAnnexKeysDbIndexCache
|
2019-08-30 17:54:57 +00:00
|
|
|
writecontent annexedfile "test_lock_force content"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "lock" [annexedfile] "lock of modified file should not be allowed"
|
|
|
|
git_annex "lock" ["--force", annexedfile] "lock --force of modified file"
|
2019-08-30 17:54:57 +00:00
|
|
|
annexed_present_locked annexedfile
|
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 16:56:26 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_edit :: Assertion
|
2013-11-14 21:03:49 +00:00
|
|
|
test_edit = test_edit' False
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_edit_precommit :: Assertion
|
2013-11-14 21:03:49 +00:00
|
|
|
test_edit_precommit = test_edit' True
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_edit' :: Bool -> Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_edit' precommit = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2012-11-11 04:51:07 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "edit" [annexedfile] "edit"
|
2012-11-11 04:51:07 +00:00
|
|
|
unannexed annexedfile
|
|
|
|
changecontent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git "add" [annexedfile] "git add of edited file"
|
2012-11-11 04:51:07 +00:00
|
|
|
if precommit
|
2020-11-24 21:17:09 +00:00
|
|
|
then git_annex "pre-commit" [] "pre-commit"
|
|
|
|
else git "commit" ["-q", "-m", "contentchanged"] "git commit of edited file"
|
2019-08-30 17:54:57 +00:00
|
|
|
runchecks [checkregularfile, checkwritable] annexedfile
|
2012-11-11 04:51:07 +00:00
|
|
|
c <- readFile annexedfile
|
|
|
|
assertEqual "content of modified file" c (changedcontent annexedfile)
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "drop" [annexedfile] "drop no known copy of modified file should not be allowed"
|
2011-01-07 18:06:32 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_partial_commit :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_partial_commit = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2014-11-10 19:36:24 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unlock" [annexedfile] "unlock"
|
2016-01-06 20:14:51 +00:00
|
|
|
changecontent annexedfile
|
2020-11-24 18:07:46 +00:00
|
|
|
git "commit" ["-q", "-m", "test", annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
"partial commit of unlocked file should be allowed"
|
2014-11-10 19:36:24 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_fix :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_fix = intmpclonerepo $ unlessM (hasUnlockedFiles <$> getTestMode) $ do
|
2011-01-07 18:08:43 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fix" [annexedfile] "fix of not present"
|
2011-01-07 18:08:43 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2011-01-07 18:06:32 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fix" [annexedfile] "fix of present file"
|
2011-01-07 18:08:43 +00:00
|
|
|
annexed_present annexedfile
|
2011-01-07 18:06:32 +00:00
|
|
|
createDirectory subdir
|
2020-11-24 21:17:09 +00:00
|
|
|
git "mv" [annexedfile, subdir] "git mv"
|
|
|
|
git_annex "fix" [newfile] "fix of moved file"
|
2011-01-07 18:06:32 +00:00
|
|
|
runchecks [checklink, checkunwritable] newfile
|
|
|
|
c <- readFile newfile
|
2011-07-15 07:12:05 +00:00
|
|
|
assertEqual "content of moved file" c (content annexedfile)
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
subdir = "s"
|
|
|
|
newfile = subdir ++ "/" ++ annexedfile
|
2011-01-07 01:39:26 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_trust :: Assertion
|
|
|
|
test_trust = intmpclonerepo $ do
|
2021-01-11 17:14:58 +00:00
|
|
|
git_annex "trust" ["--force", repo] "trust"
|
2011-10-15 20:21:08 +00:00
|
|
|
trustcheck Logs.Trust.Trusted "trusted 1"
|
2021-01-11 17:14:58 +00:00
|
|
|
git_annex "trust" ["--force", repo] "trust of trusted"
|
2011-10-15 20:21:08 +00:00
|
|
|
trustcheck Logs.Trust.Trusted "trusted 2"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "untrust" [repo] "untrust"
|
2011-10-15 20:21:08 +00:00
|
|
|
trustcheck Logs.Trust.UnTrusted "untrusted 1"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "untrust" [repo] "untrust of untrusted"
|
2011-10-15 20:21:08 +00:00
|
|
|
trustcheck Logs.Trust.UnTrusted "untrusted 2"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "dead" [repo] "dead"
|
2011-12-20 20:26:39 +00:00
|
|
|
trustcheck Logs.Trust.DeadTrusted "deadtrusted 1"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "dead" [repo] "dead of dead"
|
2011-12-20 20:26:39 +00:00
|
|
|
trustcheck Logs.Trust.DeadTrusted "deadtrusted 2"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "semitrust" [repo] "semitrust"
|
2011-10-15 20:21:08 +00:00
|
|
|
trustcheck Logs.Trust.SemiTrusted "semitrusted 1"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "semitrust" [repo] "semitrust of semitrusted"
|
2011-10-15 20:21:08 +00:00
|
|
|
trustcheck Logs.Trust.SemiTrusted "semitrusted 2"
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
repo = "origin"
|
|
|
|
trustcheck expected msg = do
|
|
|
|
present <- annexeval $ do
|
|
|
|
l <- Logs.Trust.trustGet expected
|
|
|
|
u <- Remote.nameToUUID repo
|
|
|
|
return $ u `elem` l
|
|
|
|
assertBool msg present
|
2011-01-11 22:50:18 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_fsck_basic :: Assertion
|
|
|
|
test_fsck_basic = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fsck" [] "fsck"
|
|
|
|
git_annex "numcopies" ["2"] "numcopies config"
|
2014-12-30 20:58:02 +00:00
|
|
|
fsck_should_fail "numcopies unsatisfied"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "numcopies" ["1"] "numcopies config"
|
2013-11-15 00:09:47 +00:00
|
|
|
corrupt annexedfile
|
|
|
|
corrupt sha1annexedfile
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
corrupt f = do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [f] "get of file"
|
2020-11-06 18:10:58 +00:00
|
|
|
Utility.FileMode.allowWrite (toRawFilePath f)
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent f (changedcontent f)
|
2019-08-26 19:07:10 +00:00
|
|
|
ifM (hasUnlockedFiles <$> getTestMode)
|
2020-11-24 21:17:09 +00:00
|
|
|
( git_annex "fsck" []"fsck on unlocked file with changed file content"
|
|
|
|
, git_annex_shouldfail "fsck" [] "fsck with corrupted file content should error"
|
2013-05-17 19:20:21 +00:00
|
|
|
)
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fsck" [] "second fsck, after first fsck should have fixed problem"
|
2014-12-30 20:58:02 +00:00
|
|
|
|
|
|
|
test_fsck_bare :: Assertion
|
|
|
|
test_fsck_bare = intmpbareclonerepo $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fsck" [] "fsck"
|
2014-12-30 20:58:02 +00:00
|
|
|
|
|
|
|
test_fsck_localuntrusted :: Assertion
|
|
|
|
test_fsck_localuntrusted = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
|
|
|
git_annex "untrust" ["origin"] "untrust of origin repo"
|
|
|
|
git_annex "untrust" ["."] "untrust of current repo"
|
2014-12-30 20:58:02 +00:00
|
|
|
fsck_should_fail "content only available in untrusted (current) repository"
|
2021-01-11 17:14:58 +00:00
|
|
|
git_annex "trust" ["--force", "."] "trust of current repo"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fsck" [annexedfile] "fsck on file present in trusted repo"
|
2014-12-30 20:58:02 +00:00
|
|
|
|
|
|
|
test_fsck_remoteuntrusted :: Assertion
|
|
|
|
test_fsck_remoteuntrusted = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "numcopies" ["2"] "numcopies config"
|
|
|
|
git_annex "get" [annexedfile] "get"
|
|
|
|
git_annex "get" [sha1annexedfile] "get"
|
|
|
|
git_annex "fsck" [] "fsck with numcopies=2 and 2 copies"
|
|
|
|
git_annex "untrust" ["origin"] "untrust of origin"
|
2014-12-30 20:58:02 +00:00
|
|
|
fsck_should_fail "content not replicated to enough non-untrusted repositories"
|
|
|
|
|
2015-04-18 17:36:12 +00:00
|
|
|
test_fsck_fromremote :: Assertion
|
|
|
|
test_fsck_fromremote = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "fsck" ["--from", "origin"] "fsck --from origin"
|
2015-04-18 17:36:12 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
fsck_should_fail :: String -> Assertion
|
2018-10-30 14:49:39 +00:00
|
|
|
fsck_should_fail m = git_annex_shouldfail "fsck" []
|
2020-11-24 21:17:09 +00:00
|
|
|
("fsck should not succeed with " ++ m)
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2021-05-10 18:19:24 +00:00
|
|
|
-- Make sure that the "converting git to annexed" recipe in
|
|
|
|
-- doc/tips/largefiles.mdwn continues to work.
|
|
|
|
test_conversion_git_to_annexed :: Assertion
|
|
|
|
test_conversion_git_to_annexed = intmpclonerepo $ do
|
|
|
|
git "rm" ["--cached", ingitfile] "git rm --cached"
|
|
|
|
git_annex "add" ["--force-large", ingitfile] "add --force-large"
|
|
|
|
git "commit" ["-q", "-m", "commit", ingitfile] "git commit"
|
|
|
|
whenM (unlockedFiles <$> getTestMode) $
|
|
|
|
git_annex "unlock" [ingitfile] "unlock"
|
|
|
|
annexed_present ingitfile
|
|
|
|
|
|
|
|
-- Make sure that the "converting annexed to git" recipe in
|
|
|
|
-- doc/tips/largefiles.mdwn continues to work.
|
|
|
|
test_conversion_annexed_to_git :: Assertion
|
|
|
|
test_conversion_annexed_to_git = intmpclonerepo $ do
|
|
|
|
git_annex "get" [annexedfile] "get"
|
|
|
|
git_annex "unlock" [annexedfile] "unlock"
|
|
|
|
git "rm" ["--cached", annexedfile] "git rm --cached"
|
|
|
|
git_annex "add" ["--force-small", annexedfile] "add --force-small"
|
|
|
|
git "commit" ["-q", "-m", "commit", annexedfile] "git commit"
|
|
|
|
unannexed_in_git annexedfile
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_migrate :: Assertion
|
2013-11-14 21:03:49 +00:00
|
|
|
test_migrate = test_migrate' False
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_migrate_via_gitattributes :: Assertion
|
2013-11-14 21:03:49 +00:00
|
|
|
test_migrate_via_gitattributes = test_migrate' True
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_migrate' :: Bool -> Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_migrate' usegitattributes = intmpclonerepo $ do
|
2012-11-11 04:51:07 +00:00
|
|
|
annexed_notpresent annexedfile
|
|
|
|
annexed_notpresent sha1annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "migrate" [annexedfile] "migrate of not present"
|
|
|
|
git_annex "migrate" [sha1annexedfile] "migrate of not present"
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
|
|
|
git_annex "get" [sha1annexedfile] "get of file"
|
2012-11-11 04:51:07 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
annexed_present sha1annexedfile
|
|
|
|
if usegitattributes
|
|
|
|
then do
|
2014-02-11 05:35:11 +00:00
|
|
|
writeFile ".gitattributes" "* annex.backend=SHA1"
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex "migrate" [sha1annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
"migrate sha1annexedfile"
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex "migrate" [annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
"migrate annexedfile"
|
2012-11-11 04:51:07 +00:00
|
|
|
else do
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex "migrate" [sha1annexedfile, "--backend", "SHA1"]
|
2020-11-24 21:17:09 +00:00
|
|
|
"migrate sha1annexedfile"
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex "migrate" [annexedfile, "--backend", "SHA1"]
|
2020-11-24 21:17:09 +00:00
|
|
|
"migrate annexedfile"
|
2012-11-11 04:51:07 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
annexed_present sha1annexedfile
|
|
|
|
checkbackend annexedfile backendSHA1
|
|
|
|
checkbackend sha1annexedfile backendSHA1
|
|
|
|
|
|
|
|
-- check that reversing a migration works
|
2014-02-11 05:35:11 +00:00
|
|
|
writeFile ".gitattributes" "* annex.backend=SHA256"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "migrate" [sha1annexedfile] "migrate sha1annexedfile"
|
|
|
|
git_annex "migrate" [annexedfile] "migrate annexedfile"
|
2012-11-11 04:51:07 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
annexed_present sha1annexedfile
|
|
|
|
checkbackend annexedfile backendSHA256
|
|
|
|
checkbackend sha1annexedfile backendSHA256
|
2011-01-12 01:11:32 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_unused :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_unused = intmpclonerepo $ do
|
2015-12-30 17:29:00 +00:00
|
|
|
checkunused [] "in new clone"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
|
|
|
git_annex "get" [sha1annexedfile] "get of file"
|
2016-01-07 02:11:21 +00:00
|
|
|
annexedfilekey <- getKey backendSHA256E annexedfile
|
|
|
|
sha1annexedfilekey <- getKey backendSHA1 sha1annexedfile
|
2012-09-21 04:49:48 +00:00
|
|
|
checkunused [] "after get"
|
2020-11-24 21:17:09 +00:00
|
|
|
git "rm" ["-fq", annexedfile] "git rm"
|
2012-09-21 04:49:48 +00:00
|
|
|
checkunused [] "after rm"
|
2019-08-09 15:06:54 +00:00
|
|
|
-- commit the rm, and when on an adjusted branch, sync it back to
|
|
|
|
-- the master branch
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" ["--no-push", "--no-pull"] "git-annex sync"
|
2012-09-21 04:49:48 +00:00
|
|
|
checkunused [] "after commit"
|
2011-09-28 21:48:11 +00:00
|
|
|
-- unused checks origin/master; once it's gone it is really unused
|
2020-11-24 21:17:09 +00:00
|
|
|
git "remote" ["rm", "origin"] "git remote rm origin"
|
2012-09-21 04:49:48 +00:00
|
|
|
checkunused [annexedfilekey] "after origin branches are gone"
|
2020-11-24 21:17:09 +00:00
|
|
|
git "rm" ["-fq", sha1annexedfile] "git rm"
|
|
|
|
git_annex "sync" ["--no-push", "--no-pull"] "git-annex sync"
|
2012-09-21 04:49:48 +00:00
|
|
|
checkunused [annexedfilekey, sha1annexedfilekey] "after rm sha1annexedfile"
|
2011-01-12 05:58:23 +00:00
|
|
|
|
|
|
|
-- good opportunity to test dropkey also
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "dropkey" ["--force", Key.serializeKey annexedfilekey] "dropkey"
|
2019-01-14 17:03:35 +00:00
|
|
|
checkunused [sha1annexedfilekey] ("after dropkey --force " ++ Key.serializeKey annexedfilekey)
|
2011-01-12 05:58:23 +00:00
|
|
|
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "dropunused" ["1"] "dropunused should not be allowed without --force"
|
|
|
|
git_annex "dropunused" ["--force", "1"] "dropunused"
|
2012-09-21 04:49:48 +00:00
|
|
|
checkunused [] "after dropunused"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "dropunused" ["--force", "10", "501"] "dropunused on bogus numbers"
|
2011-01-12 05:58:23 +00:00
|
|
|
|
2016-02-16 20:02:54 +00:00
|
|
|
-- Unused used to miss renamed symlinks that were not staged
|
|
|
|
-- and pointed at annexed content, and think that content was unused.
|
|
|
|
-- This is only relevant when using locked files; if the file is
|
|
|
|
-- unlocked, the work tree file has the content, and there's no way
|
|
|
|
-- to associate it with the key.
|
2019-08-09 15:06:54 +00:00
|
|
|
unlessM (hasUnlockedFiles <$> getTestMode) $ do
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent "unusedfile" "unusedcontent"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["unusedfile"] "add of unusedfile"
|
2016-02-16 20:02:54 +00:00
|
|
|
unusedfilekey <- getKey backendSHA256E "unusedfile"
|
|
|
|
renameFile "unusedfile" "unusedunstagedfile"
|
2020-11-24 21:17:09 +00:00
|
|
|
git "rm" ["-qf", "unusedfile"] "git rm"
|
2016-02-16 20:02:54 +00:00
|
|
|
checkunused [] "with unstaged link"
|
|
|
|
removeFile "unusedunstagedfile"
|
|
|
|
checkunused [unusedfilekey] "with renamed link deleted"
|
2013-11-14 21:03:49 +00:00
|
|
|
|
|
|
|
-- unused used to miss symlinks that were deleted or modified
|
2016-01-06 20:30:49 +00:00
|
|
|
-- manually
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent "unusedfile" "unusedcontent"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["unusedfile"] "add of unusedfile"
|
|
|
|
git "add" ["unusedfile"] "git add"
|
2016-01-07 02:11:21 +00:00
|
|
|
unusedfilekey' <- getKey backendSHA256E "unusedfile"
|
2013-11-14 21:03:49 +00:00
|
|
|
checkunused [] "with staged deleted link"
|
2020-11-24 21:17:09 +00:00
|
|
|
git "rm" ["-qf", "unusedfile"] "git rm"
|
2013-11-14 21:03:49 +00:00
|
|
|
checkunused [unusedfilekey'] "with staged link deleted"
|
|
|
|
|
2016-01-06 20:30:49 +00:00
|
|
|
-- unused used to false positive on symlinks that were
|
|
|
|
-- deleted or modified manually, but not staged as such
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent "unusedfile" "unusedcontent"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["unusedfile"] "add of unusedfile"
|
|
|
|
git "add" ["unusedfile"] "git add"
|
2016-01-06 20:30:49 +00:00
|
|
|
checkunused [] "with staged file"
|
2013-11-14 21:03:49 +00:00
|
|
|
removeFile "unusedfile"
|
2016-01-06 20:30:49 +00:00
|
|
|
checkunused [] "with staged deleted file"
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2016-01-07 02:11:21 +00:00
|
|
|
-- When an unlocked file is modified, git diff will cause git-annex
|
|
|
|
-- to add its content to the repository. Make sure that's not
|
|
|
|
-- found as unused.
|
2019-08-09 15:06:54 +00:00
|
|
|
whenM (hasUnlockedFiles <$> getTestMode) $ do
|
2016-01-07 02:11:21 +00:00
|
|
|
let f = "unlockedfile"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent f "unlockedcontent1"
|
2020-11-24 21:17:09 +00:00
|
|
|
git "add" ["unlockedfile"] "git add"
|
2016-01-07 02:11:21 +00:00
|
|
|
checkunused [] "with unlocked file before modification"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent f "unlockedcontent2"
|
2016-01-07 02:11:21 +00:00
|
|
|
checkunused [] "with unlocked file after modification"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_shouldfail "diff" ["--quiet", f] "git diff should exit nonzero when unlocked file is modified"
|
2016-01-07 02:11:21 +00:00
|
|
|
-- still nothing unused because one version is in the index
|
|
|
|
-- and the other is in the work tree
|
|
|
|
checkunused [] "with unlocked file after git diff"
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
checkunused expectedkeys desc = do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unused" [] "unused"
|
2020-11-04 18:20:37 +00:00
|
|
|
unusedmap <- annexeval $ Logs.Unused.readUnusedMap mempty
|
2012-11-11 04:51:07 +00:00
|
|
|
let unusedkeys = M.elems unusedmap
|
|
|
|
assertEqual ("unused keys differ " ++ desc)
|
|
|
|
(sort expectedkeys) (sort unusedkeys)
|
2011-01-12 05:58:23 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_describe :: Assertion
|
|
|
|
test_describe = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "describe" [".", "this repo"] "describe 1"
|
|
|
|
git_annex "describe" ["origin", "origin repo"] "describe 2"
|
2011-12-20 20:26:39 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_find :: Assertion
|
|
|
|
test_find = intmpclonerepo $ do
|
2011-12-20 20:26:39 +00:00
|
|
|
annexed_notpresent annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" [] []
|
2021-12-30 17:16:57 +00:00
|
|
|
readonly_query $ git_annex_expectoutput "find" [] []
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
2011-12-21 06:32:40 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
annexed_notpresent sha1annexedfile
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" [] [annexedfile]
|
2021-12-30 17:16:57 +00:00
|
|
|
readonly_query $ git_annex_expectoutput "find" [] [annexedfile]
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" ["--exclude", annexedfile, "--and", "--exclude", sha1annexedfile] []
|
|
|
|
git_annex_expectoutput "find" ["--include", annexedfile] [annexedfile]
|
|
|
|
git_annex_expectoutput "find" ["--not", "--in", "origin"] []
|
|
|
|
git_annex_expectoutput "find" ["--copies", "1", "--and", "--not", "--copies", "2"] [sha1annexedfile]
|
|
|
|
git_annex_expectoutput "find" ["--inbackend", "SHA1"] [sha1annexedfile]
|
|
|
|
git_annex_expectoutput "find" ["--inbackend", "WORM"] []
|
2011-12-20 20:26:39 +00:00
|
|
|
|
2013-02-26 17:49:22 +00:00
|
|
|
{- --include=* should match files in subdirectories too,
|
|
|
|
- and --exclude=* should exclude them. -}
|
|
|
|
createDirectory "dir"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent "dir/subfile" "subfile"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["dir"] "add of subdir"
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" ["--include", "*", "--exclude", annexedfile, "--exclude", sha1annexedfile] ["dir/subfile"]
|
|
|
|
git_annex_expectoutput "find" ["--exclude", "*"] []
|
2013-02-26 17:49:22 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_merge :: Assertion
|
|
|
|
test_merge = intmpclonerepo $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "merge" [] "merge"
|
2011-12-20 20:26:39 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_info :: Assertion
|
|
|
|
test_info = intmpclonerepo $ do
|
2021-12-30 17:16:57 +00:00
|
|
|
isjson
|
|
|
|
readonly_query isjson
|
2023-02-20 18:31:24 +00:00
|
|
|
-- When presented with an input that it does not support,
|
2023-03-14 02:39:16 +00:00
|
|
|
-- info does not stop but processes subsequent inputs too.
|
2023-02-20 18:31:24 +00:00
|
|
|
git_annex'' (const True)
|
|
|
|
(sha1annexedfile `isInfixOf`)
|
|
|
|
"info"
|
|
|
|
[annexedfile, "dnefile", sha1annexedfile] Nothing "info"
|
2021-12-30 17:16:57 +00:00
|
|
|
where
|
|
|
|
isjson = do
|
|
|
|
json <- BU8.fromString <$> git_annex_output "info" ["--json"]
|
|
|
|
case Utility.Aeson.eitherDecode json :: Either String Utility.Aeson.Value of
|
|
|
|
Right _ -> return ()
|
|
|
|
Left e -> assertFailure e
|
2011-12-20 20:26:39 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_version :: Assertion
|
2021-12-30 17:16:57 +00:00
|
|
|
test_version = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "version" [] "version"
|
2021-12-30 17:16:57 +00:00
|
|
|
readonly_query $ git_annex "version" [] "readonly version"
|
2011-12-20 21:31:25 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_sync :: Assertion
|
|
|
|
test_sync = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2016-01-26 21:33:16 +00:00
|
|
|
{- Regression test for bug fixed in
|
|
|
|
- 039e83ed5d1a11fd562cce55b8429c840d72443e, where a present
|
|
|
|
- wanted file was dropped. -}
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
2016-01-26 21:33:16 +00:00
|
|
|
git_annex_expectoutput "find" ["--in", "."] [annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "wanted" [".", "present"] "wanted"
|
|
|
|
git_annex "sync" ["--content"] "sync"
|
2016-01-26 21:33:16 +00:00
|
|
|
git_annex_expectoutput "find" ["--in", "."] [annexedfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile] "drop"
|
2016-01-26 21:33:16 +00:00
|
|
|
git_annex_expectoutput "find" ["--in", "."] []
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" ["--content"] "sync"
|
2016-01-26 21:33:16 +00:00
|
|
|
git_annex_expectoutput "find" ["--in", "."] []
|
2011-12-20 20:26:39 +00:00
|
|
|
|
2019-11-14 18:02:09 +00:00
|
|
|
{- Regression test for the concurrency bug fixed in
|
|
|
|
- 667d38a8f11c1ee8f256cdbd80e225c2bae06595 -}
|
|
|
|
test_concurrent_get_of_dup_key_regression :: Assertion
|
|
|
|
test_concurrent_get_of_dup_key_regression = intmpclonerepo $ do
|
|
|
|
makedup dupfile
|
|
|
|
-- This was sufficient currency to trigger the bug.
|
|
|
|
git_annex "get" ["-J1", annexedfile, dupfile]
|
2020-11-24 21:17:09 +00:00
|
|
|
"concurrent get -J1 with dup"
|
2019-11-14 18:02:09 +00:00
|
|
|
git_annex "drop" ["-J1"]
|
2020-11-24 21:17:09 +00:00
|
|
|
"drop with dup"
|
2019-11-14 18:02:09 +00:00
|
|
|
-- With -J2, one more dup file was needed to trigger the bug.
|
|
|
|
makedup dupfile2
|
|
|
|
git_annex "get" ["-J2", annexedfile, dupfile, dupfile2]
|
2020-11-24 21:17:09 +00:00
|
|
|
"concurrent get -J2 with dup"
|
2019-11-14 18:02:09 +00:00
|
|
|
git_annex "drop" ["-J2"]
|
2020-11-24 21:17:09 +00:00
|
|
|
"drop with dup"
|
2019-11-14 18:02:09 +00:00
|
|
|
where
|
|
|
|
dupfile = annexedfile ++ "2"
|
|
|
|
dupfile2 = annexedfile ++ "3"
|
|
|
|
makedup f = do
|
|
|
|
Utility.CopyFile.copyFileExternal Utility.CopyFile.CopyAllMetaData annexedfile f
|
|
|
|
@? "copying annexed file failed"
|
2020-11-24 21:17:09 +00:00
|
|
|
git "add" [f] "git add"
|
2019-11-14 18:02:09 +00:00
|
|
|
|
2013-05-20 19:51:40 +00:00
|
|
|
{- Regression test for union merge bug fixed in
|
2013-01-17 20:02:58 +00:00
|
|
|
- 0214e0fb175a608a49b812d81b4632c081f63027 -}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_union_merge_regression :: Assertion
|
|
|
|
test_union_merge_regression =
|
2013-01-17 20:02:58 +00:00
|
|
|
{- We need 3 repos to see this bug. -}
|
2015-09-09 17:56:37 +00:00
|
|
|
withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 ->
|
|
|
|
withtmpclonerepo $ \r3 -> do
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ [r1, r2, r3] $ \r -> indir r $ do
|
2013-01-17 20:02:58 +00:00
|
|
|
when (r /= r1) $
|
2022-03-14 19:24:37 +00:00
|
|
|
git "remote" ["add", "r1", "../" ++ r1] "remote add"
|
2013-01-17 20:02:58 +00:00
|
|
|
when (r /= r2) $
|
2022-03-14 19:24:37 +00:00
|
|
|
git "remote" ["add", "r2", "../" ++ r2] "remote add"
|
2013-01-17 20:02:58 +00:00
|
|
|
when (r /= r3) $
|
2022-03-14 19:24:37 +00:00
|
|
|
git "remote" ["add", "r3", "../" ++ r3] "remote add"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get"
|
|
|
|
git "remote" ["rm", "origin"] "remote rm"
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ [r3, r2, r1] $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] ("sync in " ++ r)
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ [r3, r2] $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" ["--force", annexedfile] ("drop in " ++ r)
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" ["--in", "r3"] []
|
2013-01-17 20:02:58 +00:00
|
|
|
{- This was the bug. The sync
|
|
|
|
- mangled location log data and it
|
|
|
|
- thought the file was still in r2 -}
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" ["--in", "r2"] []
|
2013-01-17 20:02:58 +00:00
|
|
|
|
2013-05-20 19:51:40 +00:00
|
|
|
{- Regression test for the automatic conflict resolution bug fixed
|
|
|
|
- in f4ba19f2b8a76a1676da7bb5850baa40d9c388e2. -}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_conflict_resolution_movein_regression :: Assertion
|
2015-09-09 17:56:37 +00:00
|
|
|
test_conflict_resolution_movein_regression = withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
2013-11-14 21:03:49 +00:00
|
|
|
let rname r = if r == r1 then "r1" else "r2"
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ [r1, r2] $ \r -> indir r $ do
|
2013-11-14 21:03:49 +00:00
|
|
|
{- Get all files, see check below. -}
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [] "get"
|
2014-02-03 16:03:10 +00:00
|
|
|
disconnectOrigin
|
2014-12-30 20:58:02 +00:00
|
|
|
pair r1 r2
|
|
|
|
forM_ [r1, r2] $ \r -> indir r $ do
|
2013-11-14 21:03:49 +00:00
|
|
|
{- Set up a conflict. -}
|
|
|
|
let newcontent = content annexedfile ++ rname r
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "unlock" [annexedfile] "unlock"
|
2019-08-26 19:07:10 +00:00
|
|
|
writecontent annexedfile newcontent
|
2013-11-14 21:03:49 +00:00
|
|
|
{- Sync twice in r1 so it gets the conflict resolution
|
|
|
|
- update from r2 -}
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ [r1, r2, r1] $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" ["--force"] ("sync in " ++ rname r)
|
2013-11-14 21:03:49 +00:00
|
|
|
{- After the sync, it should be possible to get all
|
|
|
|
- files. This includes both sides of the conflict,
|
|
|
|
- although the filenames are not easily predictable.
|
|
|
|
-
|
2019-08-26 19:07:10 +00:00
|
|
|
- The bug caused one repo to be missing the content
|
|
|
|
- of the file that had been put in it. -}
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ [r1, r2] $ \r -> indir r $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [] ("get all files after merge conflict resolution in " ++ rname r)
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2014-03-05 03:12:15 +00:00
|
|
|
{- Simple case of conflict resolution; 2 different versions of annexed
|
|
|
|
- file. -}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_conflict_resolution :: Assertion
|
|
|
|
test_conflict_resolution =
|
2015-09-09 17:56:37 +00:00
|
|
|
withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
2014-03-05 03:12:15 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor1"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r2 $ do
|
2014-03-05 03:12:15 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor2"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2014-12-30 20:58:02 +00:00
|
|
|
pair r1 r2
|
|
|
|
forM_ [r1,r2,r1] $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2014-03-05 03:12:15 +00:00
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
|
|
|
where
|
|
|
|
conflictor = "conflictor"
|
|
|
|
variantprefix = conflictor ++ ".variant"
|
|
|
|
checkmerge what d = do
|
|
|
|
l <- getDirectoryContents d
|
|
|
|
let v = filter (variantprefix `isPrefixOf`) l
|
|
|
|
length v == 2
|
|
|
|
@? (what ++ " not exactly 2 variant files in: " ++ show l)
|
2014-07-11 20:56:19 +00:00
|
|
|
conflictor `notElem` l @? ("conflictor still present after conflict resolution")
|
2014-12-30 20:58:02 +00:00
|
|
|
indir d $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" v "get"
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" v v
|
2014-03-05 03:12:15 +00:00
|
|
|
|
2016-04-12 17:01:31 +00:00
|
|
|
{- Conflict resolution while in an adjusted branch. -}
|
|
|
|
test_conflict_resolution_adjusted_branch :: Assertion
|
2018-11-05 17:27:16 +00:00
|
|
|
test_conflict_resolution_adjusted_branch =
|
2016-04-12 17:01:31 +00:00
|
|
|
withtmpclonerepo $ \r1 ->
|
2018-11-05 17:27:16 +00:00
|
|
|
withtmpclonerepo $ \r2 -> whenM (adjustedbranchsupported r2) $ do
|
2016-04-12 17:01:31 +00:00
|
|
|
indir r1 $ do
|
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor1"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2016-04-12 17:01:31 +00:00
|
|
|
indir r2 $ do
|
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor2"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2016-05-23 15:23:30 +00:00
|
|
|
-- We might be in an adjusted branch
|
|
|
|
-- already, when eg on a crippled
|
|
|
|
-- filesystem. So, --force it.
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "adjust" ["--unlock", "--force"] "adjust"
|
2016-04-12 17:01:31 +00:00
|
|
|
pair r1 r2
|
|
|
|
forM_ [r1,r2,r1] $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2016-04-12 17:01:31 +00:00
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
|
|
|
where
|
|
|
|
conflictor = "conflictor"
|
|
|
|
variantprefix = conflictor ++ ".variant"
|
|
|
|
checkmerge what d = do
|
|
|
|
l <- getDirectoryContents d
|
|
|
|
let v = filter (variantprefix `isPrefixOf`) l
|
|
|
|
length v == 2
|
|
|
|
@? (what ++ " not exactly 2 variant files in: " ++ show l)
|
|
|
|
conflictor `notElem` l @? ("conflictor still present after conflict resolution")
|
|
|
|
indir d $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" v "get"
|
2016-04-12 17:01:31 +00:00
|
|
|
git_annex_expectoutput "find" v v
|
2014-03-05 03:12:15 +00:00
|
|
|
|
2013-11-14 21:03:49 +00:00
|
|
|
{- Check merge conflict resolution when one side is an annexed
|
|
|
|
- file, and the other is a directory. -}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_mixed_conflict_resolution :: Assertion
|
|
|
|
test_mixed_conflict_resolution = do
|
2014-03-04 21:12:26 +00:00
|
|
|
check True
|
|
|
|
check False
|
2013-11-14 21:03:49 +00:00
|
|
|
where
|
2015-09-09 17:56:37 +00:00
|
|
|
check inr1 = withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
2014-02-03 16:03:10 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r2 $ do
|
2014-02-03 16:03:10 +00:00
|
|
|
disconnectOrigin
|
2013-11-14 21:03:49 +00:00
|
|
|
createDirectory conflictor
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent subfile "subfile"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2014-12-30 20:58:02 +00:00
|
|
|
pair r1 r2
|
2014-02-03 18:32:07 +00:00
|
|
|
let l = if inr1 then [r1, r2] else [r2, r1]
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ l $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync in mixed conflict"
|
2014-02-03 18:32:07 +00:00
|
|
|
checkmerge "r1" r1
|
2014-03-04 21:12:26 +00:00
|
|
|
checkmerge "r2" r2
|
2014-02-04 19:14:16 +00:00
|
|
|
conflictor = "conflictor"
|
2014-03-04 17:23:47 +00:00
|
|
|
subfile = conflictor </> "subfile"
|
2014-02-04 19:14:16 +00:00
|
|
|
checkmerge what d = do
|
2020-11-24 21:17:09 +00:00
|
|
|
doesDirectoryExist (d </> conflictor)
|
|
|
|
@? (d ++ " conflictor directory missing")
|
2014-02-04 19:14:16 +00:00
|
|
|
l <- getDirectoryContents d
|
2021-11-22 17:28:20 +00:00
|
|
|
let v = filter (Annex.VariantFile.variantMarker `isInfixOf`) l
|
2014-03-04 17:23:47 +00:00
|
|
|
not (null v)
|
2014-03-05 03:12:15 +00:00
|
|
|
@? (what ++ " conflictor variant file missing in: " ++ show l )
|
|
|
|
length v == 1
|
|
|
|
@? (what ++ " too many variant files in: " ++ show v)
|
2014-12-30 20:58:02 +00:00
|
|
|
indir d $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" (conflictor:v) ("get in " ++ what)
|
2019-12-05 18:36:43 +00:00
|
|
|
git_annex_expectoutput "find" [conflictor] [fromRawFilePath (Git.FilePath.toInternalGitPath (toRawFilePath subfile))]
|
2014-12-30 20:58:02 +00:00
|
|
|
git_annex_expectoutput "find" v v
|
2014-02-04 19:14:16 +00:00
|
|
|
|
2014-03-04 21:37:36 +00:00
|
|
|
{- Check merge conflict resolution when both repos start with an annexed
|
2014-03-04 21:12:26 +00:00
|
|
|
- file; one modifies it, and the other deletes it. -}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_remove_conflict_resolution :: Assertion
|
|
|
|
test_remove_conflict_resolution = do
|
2014-03-04 21:12:26 +00:00
|
|
|
check True
|
|
|
|
check False
|
|
|
|
where
|
2015-09-09 17:56:37 +00:00
|
|
|
check inr1 = withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
2014-03-04 21:12:26 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r2 $
|
2014-03-04 21:12:26 +00:00
|
|
|
disconnectOrigin
|
2014-12-30 20:58:02 +00:00
|
|
|
pair r1 r2
|
|
|
|
indir r2 $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync in r2"
|
|
|
|
git_annex "get" [conflictor] "get conflictor"
|
|
|
|
git_annex "unlock" [conflictor] "unlock conflictor"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "newconflictor"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $
|
2020-11-24 16:38:12 +00:00
|
|
|
removeWhenExistsWith R.removeLink (toRawFilePath conflictor)
|
2014-03-04 21:12:26 +00:00
|
|
|
let l = if inr1 then [r1, r2, r1] else [r2, r1, r2]
|
2014-12-30 20:58:02 +00:00
|
|
|
forM_ l $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2014-03-04 21:12:26 +00:00
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
|
|
|
conflictor = "conflictor"
|
|
|
|
variantprefix = conflictor ++ ".variant"
|
|
|
|
checkmerge what d = do
|
|
|
|
l <- getDirectoryContents d
|
|
|
|
let v = filter (variantprefix `isPrefixOf`) l
|
|
|
|
not (null v)
|
2014-03-05 03:12:15 +00:00
|
|
|
@? (what ++ " conflictor variant file missing in: " ++ show l )
|
|
|
|
length v == 1
|
|
|
|
@? (what ++ " too many variant files in: " ++ show v)
|
2014-03-04 21:12:26 +00:00
|
|
|
|
2014-10-09 19:09:26 +00:00
|
|
|
{- Check merge confalict resolution when a file is annexed in one repo,
|
|
|
|
- and checked directly into git in the other repo.
|
|
|
|
-}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_nonannexed_file_conflict_resolution :: Assertion
|
|
|
|
test_nonannexed_file_conflict_resolution = do
|
2019-08-26 19:07:10 +00:00
|
|
|
check True
|
|
|
|
check False
|
2014-03-04 21:37:36 +00:00
|
|
|
where
|
2019-08-26 19:07:10 +00:00
|
|
|
check inr1 = withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
|
|
|
indir r1 $ do
|
|
|
|
disconnectOrigin
|
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2019-08-26 19:07:10 +00:00
|
|
|
indir r2 $ do
|
|
|
|
disconnectOrigin
|
|
|
|
writecontent conflictor nonannexed_content
|
2020-11-24 18:07:46 +00:00
|
|
|
git "config"
|
|
|
|
[ "annex.largefiles"
|
|
|
|
, "exclude=" ++ ingitfile ++ " and exclude=" ++ conflictor
|
2020-11-24 21:17:09 +00:00
|
|
|
] "git config annex.largefiles"
|
|
|
|
git "add" [conflictor] "git add conflictor"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2019-08-26 19:07:10 +00:00
|
|
|
pair r1 r2
|
|
|
|
let l = if inr1 then [r1, r2] else [r2, r1]
|
|
|
|
forM_ l $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2019-08-26 19:07:10 +00:00
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
2014-03-04 21:37:36 +00:00
|
|
|
conflictor = "conflictor"
|
|
|
|
nonannexed_content = "nonannexed"
|
|
|
|
variantprefix = conflictor ++ ".variant"
|
|
|
|
checkmerge what d = do
|
|
|
|
l <- getDirectoryContents d
|
|
|
|
let v = filter (variantprefix `isPrefixOf`) l
|
|
|
|
not (null v)
|
|
|
|
@? (what ++ " conflictor variant file missing in: " ++ show l )
|
2014-03-05 03:12:15 +00:00
|
|
|
length v == 1
|
|
|
|
@? (what ++ " too many variant files in: " ++ show v)
|
2014-03-04 21:37:36 +00:00
|
|
|
conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)
|
2014-03-04 21:45:11 +00:00
|
|
|
s <- catchMaybeIO (readFile (d </> conflictor))
|
|
|
|
s == Just nonannexed_content
|
|
|
|
@? (what ++ " wrong content for nonannexed file: " ++ show s)
|
2014-03-04 21:37:36 +00:00
|
|
|
|
2014-07-10 17:34:53 +00:00
|
|
|
|
2019-08-26 19:07:10 +00:00
|
|
|
{- Check merge conflict resolution when a file is annexed in one repo,
|
2014-07-10 17:34:53 +00:00
|
|
|
- and is a non-git-annex symlink in the other repo.
|
|
|
|
-
|
|
|
|
- Test can only run when coreSymlinks is supported, because git needs to
|
|
|
|
- be able to check out the non-git-annex symlink.
|
|
|
|
-}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_nonannexed_symlink_conflict_resolution :: Assertion
|
|
|
|
test_nonannexed_symlink_conflict_resolution = do
|
2019-08-26 19:07:10 +00:00
|
|
|
check True
|
|
|
|
check False
|
2014-07-10 17:34:53 +00:00
|
|
|
where
|
2019-08-26 19:07:10 +00:00
|
|
|
check inr1 = withtmpclonerepo $ \r1 ->
|
2015-09-09 17:56:37 +00:00
|
|
|
withtmpclonerepo $ \r2 ->
|
2019-08-26 19:07:10 +00:00
|
|
|
whenM (checkRepo (Types.coreSymlinks <$> Annex.getGitConfig) r1) $ do
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
2014-07-10 17:34:53 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r2 $ do
|
2014-07-10 17:34:53 +00:00
|
|
|
disconnectOrigin
|
2023-03-01 19:55:58 +00:00
|
|
|
R.createSymbolicLink (toRawFilePath symlinktarget) (toRawFilePath "conflictor")
|
2020-11-24 21:17:09 +00:00
|
|
|
git "add" [conflictor] "git add conflictor"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2014-12-30 20:58:02 +00:00
|
|
|
pair r1 r2
|
2014-07-10 17:34:53 +00:00
|
|
|
let l = if inr1 then [r1, r2] else [r2, r1]
|
2019-08-26 19:07:10 +00:00
|
|
|
forM_ l $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2019-08-26 19:07:10 +00:00
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
2014-07-10 17:34:53 +00:00
|
|
|
conflictor = "conflictor"
|
|
|
|
symlinktarget = "dummy-target"
|
|
|
|
variantprefix = conflictor ++ ".variant"
|
|
|
|
checkmerge what d = do
|
|
|
|
l <- getDirectoryContents d
|
|
|
|
let v = filter (variantprefix `isPrefixOf`) l
|
|
|
|
not (null v)
|
|
|
|
@? (what ++ " conflictor variant file missing in: " ++ show l )
|
|
|
|
length v == 1
|
|
|
|
@? (what ++ " too many variant files in: " ++ show v)
|
|
|
|
conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)
|
2023-03-01 19:55:58 +00:00
|
|
|
s <- catchMaybeIO (R.readSymbolicLink (toRawFilePath (d </> conflictor)))
|
|
|
|
s == Just (toRawFilePath symlinktarget)
|
2014-07-10 17:34:53 +00:00
|
|
|
@? (what ++ " wrong target for nonannexed symlink: " ++ show s)
|
|
|
|
|
2014-03-04 05:41:00 +00:00
|
|
|
{- Check merge conflict resolution when there is a local file,
|
|
|
|
- that is not staged or committed, that conflicts with what's being added
|
|
|
|
- from the remmote.
|
|
|
|
-
|
|
|
|
- Case 1: Remote adds file named conflictor; local has a file named
|
|
|
|
- conflictor.
|
|
|
|
-
|
|
|
|
- Case 2: Remote adds conflictor/file; local has a file named conflictor.
|
|
|
|
-}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_uncommitted_conflict_resolution :: Assertion
|
|
|
|
test_uncommitted_conflict_resolution = do
|
2014-03-04 05:41:00 +00:00
|
|
|
check conflictor
|
|
|
|
check (conflictor </> "file")
|
|
|
|
where
|
2015-09-09 17:56:37 +00:00
|
|
|
check remoteconflictor = withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
2014-03-04 05:41:00 +00:00
|
|
|
disconnectOrigin
|
2020-11-04 18:20:37 +00:00
|
|
|
createDirectoryIfMissing True (fromRawFilePath (parentDir (toRawFilePath remoteconflictor)))
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent remoteconflictor annexedcontent
|
2020-11-24 21:17:09 +00:00
|
|
|
add_annex conflictor "add remoteconflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r2 $ do
|
2014-03-04 05:41:00 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor localcontent
|
2014-12-30 20:58:02 +00:00
|
|
|
pair r1 r2
|
2019-08-26 19:07:10 +00:00
|
|
|
-- this case is intentionally not handled
|
|
|
|
-- since the user can recover on their own easily
|
2020-11-24 21:17:09 +00:00
|
|
|
indir r2 $ git_annex_shouldfail "sync" [] "sync should not succeed"
|
2014-03-04 05:41:00 +00:00
|
|
|
conflictor = "conflictor"
|
|
|
|
localcontent = "local"
|
|
|
|
annexedcontent = "annexed"
|
|
|
|
|
2014-03-04 18:31:26 +00:00
|
|
|
{- On Windows/FAT, repeated conflict resolution sometimes
|
|
|
|
- lost track of whether a file was a symlink.
|
2014-02-04 19:31:53 +00:00
|
|
|
-}
|
2014-12-30 20:58:02 +00:00
|
|
|
test_conflict_resolution_symlink_bit :: Assertion
|
2019-08-09 15:06:54 +00:00
|
|
|
test_conflict_resolution_symlink_bit = unlessM (hasUnlockedFiles <$> getTestMode) $
|
2015-09-09 17:56:37 +00:00
|
|
|
withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 ->
|
|
|
|
withtmpclonerepo $ \r3 -> do
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r1 $ do
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [conflictor] "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-03-04 18:31:26 +00:00
|
|
|
check_is_link conflictor "r1"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r2 $ do
|
2014-03-04 18:31:26 +00:00
|
|
|
createDirectory conflictor
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent (conflictor </> "subfile") "subfile"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [conflictor] "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2014-03-04 18:31:26 +00:00
|
|
|
check_is_link (conflictor </> "subfile") "r2"
|
2014-12-30 20:58:02 +00:00
|
|
|
indir r3 $ do
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [conflictor] "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2014-03-04 18:31:26 +00:00
|
|
|
check_is_link (conflictor </> "subfile") "r3"
|
|
|
|
where
|
2014-02-04 19:14:16 +00:00
|
|
|
conflictor = "conflictor"
|
2014-03-04 18:31:26 +00:00
|
|
|
check_is_link f what = do
|
2019-12-05 18:36:43 +00:00
|
|
|
git_annex_expectoutput "find" ["--include=*", f] [fromRawFilePath (Git.FilePath.toInternalGitPath (toRawFilePath f))]
|
2021-03-23 16:44:29 +00:00
|
|
|
l <- annexeval $ Annex.inRepo $ Git.LsTree.lsTreeFiles (Git.LsTree.LsTreeLong False) Git.Ref.headRef [f]
|
2018-05-14 18:22:44 +00:00
|
|
|
all (\i -> Git.Types.toTreeItemType (Git.LsTree.mode i) == Just Git.Types.TreeSymlink) l
|
2014-03-04 18:31:26 +00:00
|
|
|
@? (what ++ " " ++ f ++ " lost symlink bit after merge: " ++ show l)
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2019-08-30 17:54:57 +00:00
|
|
|
{- An unlocked file that conflicts with a locked file should be resolved
|
2015-12-30 20:36:39 +00:00
|
|
|
- in favor of the unlocked file, with no variant files, as long as they
|
|
|
|
- both point to the same key. -}
|
|
|
|
test_mixed_lock_conflict_resolution :: Assertion
|
|
|
|
test_mixed_lock_conflict_resolution =
|
|
|
|
withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
2019-08-30 17:54:57 +00:00
|
|
|
indir r1 $ do
|
2015-12-30 20:36:39 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [conflictor] "add conflicter"
|
|
|
|
git_annex "sync" [] "sync in r1"
|
2019-08-30 17:54:57 +00:00
|
|
|
indir r2 $ do
|
2015-12-30 20:36:39 +00:00
|
|
|
disconnectOrigin
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [conflictor] "add conflicter"
|
|
|
|
git_annex "unlock" [conflictor] "unlock conflicter"
|
|
|
|
git_annex "sync" [] "sync in r2"
|
2015-12-30 20:36:39 +00:00
|
|
|
pair r1 r2
|
|
|
|
forM_ [r1,r2,r1] $ \r -> indir r $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2015-12-30 20:36:39 +00:00
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
|
|
|
where
|
|
|
|
conflictor = "conflictor"
|
|
|
|
variantprefix = conflictor ++ ".variant"
|
2019-08-30 17:54:57 +00:00
|
|
|
checkmerge what d = indir d $ do
|
2015-12-30 20:36:39 +00:00
|
|
|
l <- getDirectoryContents "."
|
|
|
|
let v = filter (variantprefix `isPrefixOf`) l
|
|
|
|
length v == 0
|
|
|
|
@? (what ++ " not exactly 0 variant files in: " ++ show l)
|
|
|
|
conflictor `elem` l @? ("conflictor not present after conflict resolution")
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [conflictor] "get"
|
2015-12-30 20:36:39 +00:00
|
|
|
git_annex_expectoutput "find" [conflictor] [conflictor]
|
|
|
|
-- regular file because it's unlocked
|
|
|
|
checkregularfile conflictor
|
|
|
|
|
2016-06-13 16:56:31 +00:00
|
|
|
{- Regression test for a bad merge between two adjusted branch repos,
|
|
|
|
- where the same file is added to both independently. The bad merge
|
|
|
|
- emptied the whole tree. -}
|
|
|
|
test_adjusted_branch_merge_regression :: Assertion
|
2018-11-05 17:27:16 +00:00
|
|
|
test_adjusted_branch_merge_regression = do
|
2016-06-13 16:56:31 +00:00
|
|
|
withtmpclonerepo $ \r1 ->
|
2018-11-05 17:27:16 +00:00
|
|
|
withtmpclonerepo $ \r2 -> whenM (adjustedbranchsupported r1) $ do
|
2016-06-13 16:56:31 +00:00
|
|
|
pair r1 r2
|
|
|
|
setup r1
|
|
|
|
setup r2
|
|
|
|
checkmerge "r1" r1
|
|
|
|
checkmerge "r2" r2
|
|
|
|
where
|
|
|
|
conflictor = "conflictor"
|
2018-12-19 17:36:14 +00:00
|
|
|
setup r = indir r $ whensupported $ do
|
2016-06-13 16:56:31 +00:00
|
|
|
disconnectOrigin
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "upgrade" [] "upgrade"
|
|
|
|
git_annex "adjust" ["--unlock", "--force"] "adjust"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent conflictor "conflictor"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [conflictor] "add conflicter"
|
|
|
|
git_annex "sync" [] "sync"
|
2018-12-19 17:36:14 +00:00
|
|
|
checkmerge what d = indir d $ whensupported $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] ("sync should not work in " ++ what)
|
2016-06-13 16:56:31 +00:00
|
|
|
l <- getDirectoryContents "."
|
|
|
|
conflictor `elem` l
|
|
|
|
@? ("conflictor not present after merge in " ++ what)
|
2018-12-19 17:36:14 +00:00
|
|
|
-- Currently this fails on FAT, for unknown reasons not to
|
|
|
|
-- do with what it's intended to test.
|
|
|
|
whensupported = unlessM (annexeval Config.crippledFileSystem)
|
2016-06-13 16:56:31 +00:00
|
|
|
|
2016-10-11 18:22:49 +00:00
|
|
|
{- Regression test for a bug in adjusted branch syncing code, where adding
|
|
|
|
- a subtree to an existing tree lost files. -}
|
|
|
|
test_adjusted_branch_subtree_regression :: Assertion
|
|
|
|
test_adjusted_branch_subtree_regression =
|
2018-11-05 17:27:16 +00:00
|
|
|
withtmpclonerepo $ \r -> whenM (adjustedbranchsupported r) $ do
|
|
|
|
indir r $ do
|
|
|
|
disconnectOrigin
|
2020-06-23 21:41:50 +00:00
|
|
|
origbranch <- annexeval origBranch
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "upgrade" [] "upgrade"
|
|
|
|
git_annex "adjust" ["--unlock", "--force"] "adjust"
|
2018-11-05 17:27:16 +00:00
|
|
|
createDirectoryIfMissing True "a/b/c"
|
|
|
|
writecontent "a/b/c/d" "foo"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["a/b/c"] "add a/b/c"
|
|
|
|
git_annex "sync" [] "sync"
|
2018-11-05 17:27:16 +00:00
|
|
|
createDirectoryIfMissing True "a/b/x"
|
|
|
|
writecontent "a/b/x/y" "foo"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["a/b/x"] "add a/b/x"
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
git "checkout" [origbranch] "git checkout"
|
2018-11-05 17:27:16 +00:00
|
|
|
doesFileExist "a/b/x/y" @? ("a/b/x/y missing from master after adjusted branch sync")
|
2016-10-11 18:22:49 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_map :: Assertion
|
|
|
|
test_map = intmpclonerepo $ do
|
2011-12-20 20:31:59 +00:00
|
|
|
-- set descriptions, that will be looked for in the map
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "describe" [".", "this repo"] "describe 1"
|
|
|
|
git_annex "describe" ["origin", "origin repo"] "describe 2"
|
2011-12-20 20:31:59 +00:00
|
|
|
-- --fast avoids it running graphviz, not a build dependency
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "map" ["--fast"] "map"
|
2011-12-20 21:31:25 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_uninit :: Assertion
|
|
|
|
test_uninit = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [] "get"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
-- any exit status is accepted; does abnormal exit
|
2023-02-20 18:31:24 +00:00
|
|
|
git_annex'' (const True) (const True) "uninit" [] Nothing "uninit"
|
2013-11-14 21:03:49 +00:00
|
|
|
checkregularfile annexedfile
|
|
|
|
doesDirectoryExist ".git" @? ".git vanished in uninit"
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_uninit_inbranch :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_uninit_inbranch = intmpclonerepo $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git "checkout" ["git-annex"] "git checkout git-annex"
|
|
|
|
git_annex_shouldfail "uninit" [] "uninit should not succeed when git-annex branch is checked out"
|
2013-11-14 21:03:49 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_upgrade :: Assertion
|
|
|
|
test_upgrade = intmpclonerepo $
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "upgrade" [] "upgrade"
|
2011-12-20 21:31:25 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_whereis :: Assertion
|
|
|
|
test_whereis = intmpclonerepo $ do
|
2011-12-20 21:31:25 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "whereis" [annexedfile] "whereis on non-present file"
|
2021-12-30 17:16:57 +00:00
|
|
|
readonly_query $
|
|
|
|
git_annex "whereis" [annexedfile] "readonly whereis on non-present file"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "untrust" ["origin"] "untrust"
|
|
|
|
git_annex_shouldfail "whereis" [annexedfile] "whereis should exit nonzero on non-present file only present in untrusted repo"
|
|
|
|
git_annex "get" [annexedfile] "get"
|
2011-12-20 21:31:25 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "whereis" [annexedfile] "whereis on present file"
|
2021-12-30 17:16:57 +00:00
|
|
|
readonly_query $
|
|
|
|
git_annex "whereis" [annexedfile] "readonly whereis on present file"
|
2011-12-20 20:31:59 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_hook_remote :: Assertion
|
|
|
|
test_hook_remote = intmpclonerepo $ do
|
2013-08-04 17:07:55 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "initremote" (words "foo type=hook encryption=none hooktype=foo") "initremote"
|
2011-12-20 19:13:36 +00:00
|
|
|
createDirectory dir
|
|
|
|
git_config "annex.foo-store-hook" $
|
|
|
|
"cp $ANNEX_FILE " ++ loc
|
|
|
|
git_config "annex.foo-retrieve-hook" $
|
|
|
|
"cp " ++ loc ++ " $ANNEX_FILE"
|
|
|
|
git_config "annex.foo-remove-hook" $
|
|
|
|
"rm -f " ++ loc
|
|
|
|
git_config "annex.foo-checkpresent-hook" $
|
|
|
|
"if [ -e " ++ loc ++ " ]; then echo $ANNEX_KEY; fi"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2011-12-20 19:13:36 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" [annexedfile, "--to", "foo"] "copy --to hook remote"
|
2011-12-20 19:13:36 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile, "--numcopies=2"] "drop"
|
2011-12-20 19:13:36 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" [annexedfile, "--from", "foo"] "move --from hook remote"
|
2011-12-20 19:13:36 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "drop" [annexedfile, "--numcopies=2"] "drop should not be allowed with numcopies=2"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2012-11-11 04:51:07 +00:00
|
|
|
where
|
|
|
|
dir = "dir"
|
|
|
|
loc = dir ++ "/$ANNEX_KEY"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_config k v = git "config" [k, v] "git config"
|
2013-06-18 20:12:43 +00:00
|
|
|
#else
|
|
|
|
-- this test doesn't work in Windows TODO
|
|
|
|
noop
|
|
|
|
#endif
|
2011-12-20 19:13:36 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_directory_remote :: Assertion
|
|
|
|
test_directory_remote = intmpclonerepo $ do
|
2011-12-20 19:17:56 +00:00
|
|
|
createDirectory "dir"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "initremote" (words "foo type=directory encryption=none directory=dir") "initremote"
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" [annexedfile, "--to", "foo"] "copy --to directory remote"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile, "--numcopies=2"] "drop"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" [annexedfile, "--from", "foo"] "move --from directory remote"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "drop" [annexedfile, "--numcopies=2"] "drop should not be allowed with numcopies=2"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_rsync_remote :: Assertion
|
|
|
|
test_rsync_remote = intmpclonerepo $ do
|
2019-08-08 16:37:25 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2011-12-20 19:17:56 +00:00
|
|
|
createDirectory "dir"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "initremote" (words "foo type=rsync encryption=none rsyncurl=dir") "initremote"
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" [annexedfile, "--to", "foo"] "copy --to rsync remote"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile, "--numcopies=2"] "drop"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" [annexedfile, "--from", "foo"] "move --from rsync remote"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "drop" [annexedfile, "--numcopies=2"] "drop should not be allowed with numcopies=2"
|
2011-12-20 19:17:56 +00:00
|
|
|
annexed_present annexedfile
|
2019-08-08 17:41:56 +00:00
|
|
|
#else
|
|
|
|
noop
|
2019-08-08 16:37:25 +00:00
|
|
|
#endif
|
2011-12-20 19:17:56 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_bup_remote :: Assertion
|
2017-12-14 16:46:57 +00:00
|
|
|
test_bup_remote = intmpclonerepo $ when BuildInfo.bup $ do
|
2020-11-04 18:20:37 +00:00
|
|
|
-- bup special remote needs an absolute path
|
|
|
|
dir <- fromRawFilePath <$> absPath (toRawFilePath "dir")
|
2011-12-21 17:50:33 +00:00
|
|
|
createDirectory dir
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "initremote" (words $ "foo type=bup encryption=none buprepo="++dir) "initremote"
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
2011-12-21 17:50:33 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" [annexedfile, "--to", "foo"] "copy --to bup remote"
|
2011-12-21 17:50:33 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "drop" [annexedfile, "--numcopies=2"] "drop"
|
2011-12-21 17:50:33 +00:00
|
|
|
annexed_notpresent annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "copy" [annexedfile, "--from", "foo"] "copy --from bup remote"
|
2011-12-21 17:50:33 +00:00
|
|
|
annexed_present annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "move" [annexedfile, "--from", "foo"] "move --from bup remote"
|
2011-12-21 17:50:33 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
|
2021-09-03 16:40:23 +00:00
|
|
|
test_borg_remote :: Assertion
|
|
|
|
test_borg_remote = when BuildInfo.borg $ do
|
|
|
|
borgdirparent <- fromRawFilePath <$> (absPath . toRawFilePath =<< tmprepodir)
|
|
|
|
let borgdir = borgdirparent </> "borgrepo"
|
|
|
|
intmpclonerepo $ do
|
2023-02-20 18:31:24 +00:00
|
|
|
testProcess "borg" ["init", borgdir, "-e", "none"] Nothing (== True) (const True) "borg init"
|
|
|
|
testProcess "borg" ["create", borgdir++"::backup1", "."] Nothing (== True) (const True) "borg create"
|
2021-09-03 16:40:23 +00:00
|
|
|
|
|
|
|
git_annex "initremote" (words $ "borg type=borg borgrepo="++borgdir) "initremote"
|
|
|
|
git_annex "sync" ["borg"] "sync borg"
|
|
|
|
git_annex_expectoutput "find" ["--in=borg"] []
|
|
|
|
|
|
|
|
git_annex "get" [annexedfile] "get of file"
|
|
|
|
annexed_present annexedfile
|
|
|
|
git_annex_expectoutput "find" ["--in=borg"] []
|
|
|
|
|
2023-02-20 18:31:24 +00:00
|
|
|
testProcess "borg" ["create", borgdir++"::backup2", "."] Nothing (== True) (const True) "borg create"
|
2021-09-03 16:40:23 +00:00
|
|
|
git_annex "sync" ["borg"] "sync borg after getting file"
|
|
|
|
git_annex_expectoutput "find" ["--in=borg"] [annexedfile]
|
|
|
|
|
|
|
|
git "remote" ["rm", "origin"] "remote rm"
|
|
|
|
git_annex_shouldfail "drop" [annexedfile]
|
|
|
|
"drop from borg succeeded, but it should be untrusted by default"
|
|
|
|
git_annex "enableremote" ["borg", "appendonly=yes"] "enableremote appendonly"
|
|
|
|
git_annex "drop" [annexedfile] "drop from borg (appendonly)"
|
|
|
|
git_annex "get" [annexedfile, "--from=borg"] "get from borg"
|
|
|
|
|
2011-12-21 18:10:36 +00:00
|
|
|
-- gpg is not a build dependency, so only test when it's available
|
2014-12-30 20:58:02 +00:00
|
|
|
test_crypto :: Assertion
|
2013-08-04 17:07:55 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2014-12-30 20:58:02 +00:00
|
|
|
test_crypto = do
|
2013-11-14 21:03:49 +00:00
|
|
|
testscheme "shared"
|
|
|
|
testscheme "hybrid"
|
|
|
|
testscheme "pubkey"
|
|
|
|
where
|
2015-09-09 22:06:49 +00:00
|
|
|
gpgcmd = Utility.Gpg.mkGpgCmd Nothing
|
2021-10-12 17:22:46 +00:00
|
|
|
testscheme scheme = Utility.Tmp.Dir.withTmpDir "gpgtmp" $ \gpgtmp -> do
|
|
|
|
-- Use the system temp directory as gpg temp directory because
|
|
|
|
-- it needs to be able to store the agent socket there,
|
2023-03-14 02:39:16 +00:00
|
|
|
-- which can be problematic when testing some filesystems.
|
2021-10-12 17:22:46 +00:00
|
|
|
absgpgtmp <- fromRawFilePath <$> absPath (toRawFilePath gpgtmp)
|
2022-05-02 18:06:20 +00:00
|
|
|
res <- testscheme' scheme absgpgtmp
|
|
|
|
-- gpg may still be running and would prevent
|
|
|
|
-- removeDirectoryRecursive from succeeding, so
|
|
|
|
-- force removal of the temp directory.
|
|
|
|
liftIO $ removeDirectoryForCleanup gpgtmp
|
|
|
|
return res
|
2021-10-12 17:22:46 +00:00
|
|
|
testscheme' scheme absgpgtmp = intmpclonerepo $ do
|
|
|
|
-- Since gpg uses a unix socket, which is limited to a
|
|
|
|
-- short path, use whichever is shorter of absolute
|
|
|
|
-- or relative path.
|
|
|
|
relgpgtmp <- fromRawFilePath <$> relPathCwdToFile (toRawFilePath absgpgtmp)
|
|
|
|
let gpgtmp = if length relgpgtmp < length absgpgtmp
|
|
|
|
then relgpgtmp
|
|
|
|
else absgpgtmp
|
2022-05-18 19:32:40 +00:00
|
|
|
void $ Utility.Gpg.testHarness gpgtmp gpgcmd $ \environ -> do
|
2013-11-14 21:03:49 +00:00
|
|
|
createDirectory "dir"
|
2020-11-24 18:07:46 +00:00
|
|
|
let initps =
|
2013-11-14 21:03:49 +00:00
|
|
|
[ "foo"
|
|
|
|
, "type=directory"
|
|
|
|
, "encryption=" ++ scheme
|
|
|
|
, "directory=dir"
|
|
|
|
, "highRandomQuality=false"
|
|
|
|
] ++ if scheme `elem` ["hybrid","pubkey"]
|
|
|
|
then ["keyid=" ++ Utility.Gpg.testKeyId]
|
|
|
|
else []
|
2022-05-18 19:32:40 +00:00
|
|
|
git_annex' "initremote" initps (Just environ) "initremote"
|
|
|
|
git_annex_shouldfail' "initremote" initps (Just environ) "initremote should not work when run twice in a row"
|
|
|
|
git_annex' "enableremote" initps (Just environ) "enableremote"
|
|
|
|
git_annex' "enableremote" initps (Just environ) "enableremote when run twice in a row"
|
|
|
|
git_annex' "get" [annexedfile] (Just environ) "get of file"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2022-05-18 19:32:40 +00:00
|
|
|
git_annex' "copy" [annexedfile, "--to", "foo"] (Just environ) "copy --to encrypted remote"
|
2013-11-14 21:03:49 +00:00
|
|
|
(c,k) <- annexeval $ do
|
|
|
|
uuid <- Remote.nameToUUID "foo"
|
|
|
|
rs <- Logs.Remote.readRemoteLog
|
2020-07-10 18:17:35 +00:00
|
|
|
Just k <- Annex.WorkTree.lookupKey (toRawFilePath annexedfile)
|
2013-11-14 21:03:49 +00:00
|
|
|
return (fromJust $ M.lookup uuid rs, k)
|
|
|
|
let key = if scheme `elem` ["hybrid","pubkey"]
|
|
|
|
then Just $ Utility.Gpg.KeyIds [Utility.Gpg.testKeyId]
|
|
|
|
else Nothing
|
2022-05-18 19:32:40 +00:00
|
|
|
testEncryptedRemote environ scheme key c [k] @? "invalid crypto setup"
|
2013-11-14 21:03:49 +00:00
|
|
|
|
|
|
|
annexed_present annexedfile
|
2022-05-18 19:32:40 +00:00
|
|
|
git_annex' "drop" [annexedfile, "--numcopies=2"] (Just environ) "drop"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_notpresent annexedfile
|
2022-05-18 19:32:40 +00:00
|
|
|
git_annex' "move" [annexedfile, "--from", "foo"] (Just environ) "move --from encrypted remote"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
2022-05-18 19:32:40 +00:00
|
|
|
git_annex_shouldfail' "drop" [annexedfile, "--numcopies=2"] (Just environ) "drop should not be allowed with numcopies=2"
|
2013-11-14 21:03:49 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
{- Ensure the configuration complies with the encryption scheme, and
|
|
|
|
- that all keys are encrypted properly for the given directory remote. -}
|
2022-05-18 19:32:40 +00:00
|
|
|
testEncryptedRemote environ scheme ks c keys = case Remote.Helper.Encryptable.extractCipher pc of
|
2013-11-14 21:03:49 +00:00
|
|
|
Just cip@Crypto.SharedCipher{} | scheme == "shared" && isNothing ks ->
|
|
|
|
checkKeys cip Nothing
|
|
|
|
Just cip@(Crypto.EncryptedCipher encipher v ks')
|
|
|
|
| checkScheme v && keysMatch ks' ->
|
|
|
|
checkKeys cip (Just v) <&&> checkCipher encipher ks'
|
|
|
|
_ -> return False
|
|
|
|
where
|
fix encryption of content to gcrypt and git-lfs
Fix serious regression in gcrypt and encrypted git-lfs remotes.
Since version 7.20200202.7, git-annex incorrectly stored content
on those remotes without encrypting it.
Problem was, Remote.Git enumerates all git remotes, including git-lfs
and gcrypt. It then dispatches to those. So, Remote.List used the
RemoteConfigParser from Remote.Git, instead of from git-lfs or gcrypt,
and that parser does not know about encryption fields, so did not
include them in the ParsedRemoteConfig. (Also didn't include other
fields specific to those remotes, perhaps chunking etc also didn't
get through.)
To fix, had to move RemoteConfig parsing down into the generate methods
of each remote, rather than doing it in Remote.List.
And a consequence of that was that ParsedRemoteConfig had to change to
include the RemoteConfig that got parsed, so that testremote can
generate a new remote based on an existing remote.
(I would have rather fixed this just inside Remote.Git, but that was not
practical, at least not w/o re-doing work that Remote.List already did.
Big ugly mostly mechanical patch seemed preferable to making git-annex
slower.)
2020-02-26 21:20:56 +00:00
|
|
|
pc = either (const (Types.Remote.ParsedRemoteConfig mempty mempty)) id $
|
2020-01-14 16:35:08 +00:00
|
|
|
Remote.Helper.Encryptable.parseEncryptionConfig c
|
2013-11-14 21:03:49 +00:00
|
|
|
keysMatch (Utility.Gpg.KeyIds ks') =
|
|
|
|
maybe False (\(Utility.Gpg.KeyIds ks2) ->
|
|
|
|
sort (nub ks2) == sort (nub ks')) ks
|
2022-05-18 19:32:40 +00:00
|
|
|
checkCipher encipher = Utility.Gpg.checkEncryptionStream gpgcmd (Just environ) encipher . Just
|
2013-11-14 21:03:49 +00:00
|
|
|
checkScheme Types.Crypto.Hybrid = scheme == "hybrid"
|
|
|
|
checkScheme Types.Crypto.PubKey = scheme == "pubkey"
|
|
|
|
checkKeys cip mvariant = do
|
2017-08-17 16:26:14 +00:00
|
|
|
dummycfg <- Types.GitConfig.dummyRemoteGitConfig
|
fix encryption of content to gcrypt and git-lfs
Fix serious regression in gcrypt and encrypted git-lfs remotes.
Since version 7.20200202.7, git-annex incorrectly stored content
on those remotes without encrypting it.
Problem was, Remote.Git enumerates all git remotes, including git-lfs
and gcrypt. It then dispatches to those. So, Remote.List used the
RemoteConfigParser from Remote.Git, instead of from git-lfs or gcrypt,
and that parser does not know about encryption fields, so did not
include them in the ParsedRemoteConfig. (Also didn't include other
fields specific to those remotes, perhaps chunking etc also didn't
get through.)
To fix, had to move RemoteConfig parsing down into the generate methods
of each remote, rather than doing it in Remote.List.
And a consequence of that was that ParsedRemoteConfig had to change to
include the RemoteConfig that got parsed, so that testremote can
generate a new remote based on an existing remote.
(I would have rather fixed this just inside Remote.Git, but that was not
practical, at least not w/o re-doing work that Remote.List already did.
Big ugly mostly mechanical patch seemed preferable to making git-annex
slower.)
2020-02-26 21:20:56 +00:00
|
|
|
let encparams = (Types.Remote.ParsedRemoteConfig mempty mempty, dummycfg)
|
2022-05-18 19:32:40 +00:00
|
|
|
cipher <- Crypto.decryptCipher' gpgcmd (Just environ) encparams cip
|
2013-11-14 21:03:49 +00:00
|
|
|
files <- filterM doesFileExist $
|
2019-01-14 17:03:35 +00:00
|
|
|
map ("dir" </>) $ concatMap (serializeKeys cipher) keys
|
2013-11-14 21:03:49 +00:00
|
|
|
return (not $ null files) <&&> allM (checkFile mvariant) files
|
|
|
|
checkFile mvariant filename =
|
2022-05-18 19:32:40 +00:00
|
|
|
Utility.Gpg.checkEncryptionFile gpgcmd (Just environ) filename $
|
2013-11-14 21:03:49 +00:00
|
|
|
if mvariant == Just Types.Crypto.PubKey then ks else Nothing
|
2019-12-11 18:12:22 +00:00
|
|
|
serializeKeys cipher = map fromRawFilePath .
|
|
|
|
Annex.Locations.keyPaths .
|
2013-11-14 21:03:49 +00:00
|
|
|
Crypto.encryptKey Types.Crypto.HmacSha1 cipher
|
2013-05-17 20:49:34 +00:00
|
|
|
#else
|
2014-12-30 21:02:51 +00:00
|
|
|
test_crypto = putStrLn "gpg testing not implemented on Windows"
|
2013-05-17 20:49:34 +00:00
|
|
|
#endif
|
2011-12-21 03:20:36 +00:00
|
|
|
|
2014-12-30 20:58:02 +00:00
|
|
|
test_add_subdirs :: Assertion
|
|
|
|
test_add_subdirs = intmpclonerepo $ do
|
2014-02-07 00:33:30 +00:00
|
|
|
createDirectory "dir"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent ("dir" </> "foo") $ "dir/" ++ content annexedfile
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["dir"] "add of subdir"
|
2014-02-07 00:33:30 +00:00
|
|
|
|
|
|
|
{- Regression test for Windows bug where symlinks were not
|
|
|
|
- calculated correctly for files in subdirs. -}
|
2019-08-09 15:06:54 +00:00
|
|
|
unlessM (hasUnlockedFiles <$> getTestMode) $ do
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" [] "sync"
|
2019-01-01 18:54:06 +00:00
|
|
|
l <- annexeval $ Utility.FileSystemEncoding.decodeBL
|
2020-04-07 21:41:09 +00:00
|
|
|
<$> Annex.CatFile.catObject (Git.Types.Ref (encodeBS "HEAD:dir/foo"))
|
2016-02-16 19:30:59 +00:00
|
|
|
"../.git/annex/" `isPrefixOf` l @? ("symlink from subdir to .git/annex is wrong: " ++ l)
|
2014-02-07 00:33:30 +00:00
|
|
|
|
|
|
|
createDirectory "dir2"
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent ("dir2" </> "foo") $ content annexedfile
|
2014-02-07 00:33:30 +00:00
|
|
|
setCurrentDirectory "dir"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" [".." </> "dir2"] "add of ../subdir"
|
2014-02-07 00:33:30 +00:00
|
|
|
|
2015-02-10 19:20:07 +00:00
|
|
|
test_addurl :: Assertion
|
|
|
|
test_addurl = intmpclonerepo $ do
|
|
|
|
-- file:// only; this test suite should not hit the network
|
limit url downloads to whitelisted schemes
Security fix! Allowing any schemes, particularly file: and
possibly others like scp: allowed file exfiltration by anyone who had
write access to the git repository, since they could add an annexed file
using such an url, or using an url that redirected to such an url,
and wait for the victim to get it into their repository and send them a copy.
* Added annex.security.allowed-url-schemes setting, which defaults
to only allowing http and https URLs. Note especially that file:/
is no longer enabled by default.
* Removed annex.web-download-command, since its interface does not allow
supporting annex.security.allowed-url-schemes across redirects.
If you used this setting, you may want to instead use annex.web-options
to pass options to curl.
With annex.web-download-command removed, nearly all url accesses in
git-annex are made via Utility.Url via http-client or curl. http-client
only supports http and https, so no problem there.
(Disabling one and not the other is not implemented.)
Used curl --proto to limit the allowed url schemes.
Note that this will cause git annex fsck --from web to mark files using
a disallowed url scheme as not being present in the web. That seems
acceptable; fsck --from web also does that when a web server is not available.
youtube-dl already disabled file: itself (probably for similar
reasons). The scheme check was also added to youtube-dl urls for
completeness, although that check won't catch any redirects it might
follow. But youtube-dl goes off and does its own thing with other
protocols anyway, so that's fine.
Special remotes that support other domain-specific url schemes are not
affected by this change. In the bittorrent remote, aria2c can still
download magnet: links. The download of the .torrent file is
otherwise now limited by annex.security.allowed-url-schemes.
This does not address any external special remotes that might download
an url themselves. Current thinking is all external special remotes will
need to be audited for this problem, although many of them will use
http libraries that only support http and not curl's menagarie.
The related problem of accessing private localhost and LAN urls is not
addressed by this commit.
This commit was sponsored by Brett Eisenberg on Patreon.
2018-06-15 20:52:24 +00:00
|
|
|
let filecmd c ps = git_annex c ("-cannex.security.allowed-url-schemes=file" : ps)
|
2020-11-04 18:20:37 +00:00
|
|
|
f <- fromRawFilePath <$> absPath (toRawFilePath "myurl")
|
2015-02-11 16:22:43 +00:00
|
|
|
let url = replace "\\" "/" ("file:///" ++ dropDrive f)
|
add small delay to avoid problems on systems with low-resolution mtime
I've seen intermittent failures of the test suite with v6 for a long time,
it seems to have possibly gotten worse with the changes around v7. Or just
being unlucky; all tests failed today.
Seen on amd64 and i386 builders, repeatedly but intermittently:
unused: FAIL (4.86s)
Test.hs:928:
git diff did not show changes to unlocked file
And I think other such failures, all involving v7/v6 mode tests.
I managed to reproduce the unused failure with --keep-failures,
and inside the repo, git diff was indeed not showing any changes for
the modified unlocked file.
The two stats will be the same other than mtime; the old and new files have
the same size and inode, since the test case writes to the file and then
overwrites it.
Indeed, notice the identical timestamps:
builder@orca:~/gitbuilder/build/.t/tmprepo335$ echo 1 > foo; stat foo; echo 2 > foo; stat foo
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.894942036 +0000
Change: 2018-10-29 22:14:10.894942036 +0000
Birth: -
File: foo
Size: 2 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3546179 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ builder) Gid: ( 1000/ builder)
Access: 2018-10-29 22:14:10.894942036 +0000
Modify: 2018-10-29 22:14:10.898942036 +0000
Change: 2018-10-29 22:14:10.898942036 +0000
Birth: -
I'm seeing this in Linux VMs; it doesn't happen on my laptop. I've also
not experienced the intermittent test suite failures on my laptop.
So, I hope that this small delay will avoid the problem.
Update: I didn't, indeed I then reproduced the same failure on my
laptop, so it must be due to something else. But keeping this change anyway
since not needing to worry about lowish-resolution mtime in the test suite seems
worthwhile.
2018-10-29 22:42:20 +00:00
|
|
|
writecontent f "foo"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "addurl" [url] "addurl should not work on file url"
|
|
|
|
filecmd "addurl" [url] ("addurl on " ++ url)
|
2015-02-10 19:20:07 +00:00
|
|
|
let dest = "addurlurldest"
|
2020-11-24 21:17:09 +00:00
|
|
|
filecmd "addurl" ["--file", dest, url] ("addurl on " ++ url ++ " with --file")
|
2015-02-10 19:20:07 +00:00
|
|
|
doesFileExist dest @? (dest ++ " missing after addurl --file")
|
2019-03-06 20:49:33 +00:00
|
|
|
|
|
|
|
test_export_import :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_export_import = intmpclonerepo $ do
|
2019-03-06 20:49:33 +00:00
|
|
|
createDirectory "dir"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "initremote" (words "foo type=directory encryption=none directory=dir exporttree=yes importtree=yes") "initremote"
|
|
|
|
git_annex "get" [] "get of files"
|
2019-03-06 20:49:33 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
|
2019-08-09 17:33:29 +00:00
|
|
|
-- Nothing to commit, but this makes sure the master branch
|
|
|
|
-- is in sync with the adjusted branch, which it may not be
|
|
|
|
-- depending on how the repository was set up.
|
|
|
|
commitchanges
|
2020-06-23 21:41:50 +00:00
|
|
|
origbranch <- annexeval origBranch
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "export" [origbranch, "--to", "foo"] "export to dir"
|
2019-03-06 20:49:33 +00:00
|
|
|
dircontains annexedfile (content annexedfile)
|
|
|
|
|
|
|
|
writedir "import" (content "import")
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" [origbranch, "--from", "foo"] "import from dir"
|
|
|
|
git_annex "merge" ["foo/" ++ origbranch] "git annex merge"
|
2019-08-09 17:33:29 +00:00
|
|
|
annexed_present_imported "import"
|
2019-03-06 20:49:33 +00:00
|
|
|
|
2020-11-24 16:38:12 +00:00
|
|
|
removeWhenExistsWith R.removeLink (toRawFilePath "import")
|
2019-03-06 20:49:33 +00:00
|
|
|
writecontent "import" (content "newimport1")
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["import"] "add of import"
|
2019-08-09 17:33:29 +00:00
|
|
|
commitchanges
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "export" [origbranch, "--to", "foo"] "export modified file to dir"
|
2019-03-06 20:49:33 +00:00
|
|
|
dircontains "import" (content "newimport1")
|
|
|
|
|
|
|
|
-- verify that export refuses to overwrite modified file
|
|
|
|
writedir "import" (content "newimport2")
|
2020-11-24 16:38:12 +00:00
|
|
|
removeWhenExistsWith R.removeLink (toRawFilePath "import")
|
2019-03-06 20:49:33 +00:00
|
|
|
writecontent "import" (content "newimport3")
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["import"] "add of import"
|
2019-08-09 17:33:29 +00:00
|
|
|
commitchanges
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex_shouldfail "export" [origbranch, "--to", "foo"] "export should not work in conflict"
|
2019-03-06 20:49:33 +00:00
|
|
|
dircontains "import" (content "newimport2")
|
|
|
|
|
|
|
|
-- resolving import conflict
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" [origbranch, "--from", "foo"] "import from dir"
|
|
|
|
git_shouldfail "merge" ["foo/master", "-mmerge"] "git merge of conflict should exit nonzero"
|
2020-11-24 16:38:12 +00:00
|
|
|
removeWhenExistsWith R.removeLink (toRawFilePath "import")
|
2019-03-06 20:49:33 +00:00
|
|
|
writecontent "import" (content "newimport3")
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "add" ["import"] "add of import"
|
2019-08-09 17:33:29 +00:00
|
|
|
commitchanges
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "export" [origbranch, "--to", "foo"] "export after import conflict"
|
2019-03-06 20:49:33 +00:00
|
|
|
dircontains "import" (content "newimport3")
|
|
|
|
where
|
|
|
|
dircontains f v =
|
|
|
|
((v==) <$> readFile ("dir" </> f))
|
|
|
|
@? ("did not find expected content of " ++ "dir" </> f)
|
|
|
|
writedir f = writecontent ("dir" </> f)
|
2019-08-09 17:33:29 +00:00
|
|
|
-- When on an adjusted branch, this updates the master branch
|
|
|
|
-- to match it, which is necessary since the master branch is going
|
|
|
|
-- to be exported.
|
2020-11-24 21:17:09 +00:00
|
|
|
commitchanges = git_annex "sync" ["--no-pull", "--no-push"] "sync"
|
2019-05-06 18:24:42 +00:00
|
|
|
|
|
|
|
test_export_import_subdir :: Assertion
|
2019-08-26 19:07:10 +00:00
|
|
|
test_export_import_subdir = intmpclonerepo $ do
|
2019-05-06 18:24:42 +00:00
|
|
|
createDirectory "dir"
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "initremote" (words "foo type=directory encryption=none directory=dir exporttree=yes importtree=yes") "initremote"
|
|
|
|
git_annex "get" [] "get of files"
|
2019-05-06 18:24:42 +00:00
|
|
|
annexed_present annexedfile
|
|
|
|
|
|
|
|
createDirectory subdir
|
2020-11-24 21:17:09 +00:00
|
|
|
git "mv" [annexedfile, subannexedfile] "git mv"
|
|
|
|
git "commit" ["-m", "moved"] "git commit"
|
2019-08-08 17:28:04 +00:00
|
|
|
|
|
|
|
-- When on an adjusted branch, this updates the master branch
|
|
|
|
-- to match it, which is necessary since the master branch is going
|
|
|
|
-- to be exported.
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "sync" ["--no-pull", "--no-push"] "sync"
|
2019-05-06 18:24:42 +00:00
|
|
|
|
|
|
|
-- Run three times because there was a bug that took a couple
|
|
|
|
-- of runs to lead to the wrong tree being written to the remote
|
|
|
|
-- tracking branch.
|
|
|
|
testimport
|
|
|
|
testexport
|
|
|
|
testimport
|
|
|
|
testexport
|
|
|
|
testimport
|
|
|
|
testexport
|
|
|
|
where
|
|
|
|
dircontains f v =
|
|
|
|
((v==) <$> readFile ("dir" </> f))
|
|
|
|
@? ("did not find expected content of " ++ "dir" </> f)
|
|
|
|
|
|
|
|
subdir = "subdir"
|
|
|
|
subannexedfile = "subdir" </> annexedfile
|
|
|
|
|
|
|
|
testexport = do
|
2020-06-23 21:41:50 +00:00
|
|
|
origbranch <- annexeval origBranch
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "export" [origbranch++":"++subdir, "--to", "foo"] "export of subdir"
|
2019-05-06 18:24:42 +00:00
|
|
|
dircontains annexedfile (content annexedfile)
|
|
|
|
|
|
|
|
testimport = do
|
2020-06-23 21:41:50 +00:00
|
|
|
origbranch <- annexeval origBranch
|
2020-11-24 21:17:09 +00:00
|
|
|
git_annex "import" [origbranch++":"++subdir, "--from", "foo"] "import of subdir"
|
2021-07-19 16:08:24 +00:00
|
|
|
git_annex "merge" ["foo/master", "--allow-unrelated-histories"] "git annex merge foo/master"
|
2019-05-06 18:24:42 +00:00
|
|
|
|
|
|
|
-- Make sure that import did not import the file to the top
|
|
|
|
-- of the repo.
|
|
|
|
checkdoesnotexist annexedfile
|
2022-02-07 18:58:15 +00:00
|
|
|
|
|
|
|
test_transition_propagation_reversion :: Assertion
|
|
|
|
test_transition_propagation_reversion =
|
|
|
|
withtmpclonerepo $ \r1 ->
|
|
|
|
withtmpclonerepo $ \r2 -> do
|
|
|
|
pair r1 r2
|
|
|
|
indir r1 $ do
|
|
|
|
disconnectOrigin
|
|
|
|
writecontent wormannexedfile $ content wormannexedfile
|
|
|
|
git_annex "add" [wormannexedfile, "--backend=WORM"] "add"
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
indir r2 $ do
|
|
|
|
disconnectOrigin
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
indir r1 $ do
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
indir r2 $ do
|
|
|
|
git_annex "get" [wormannexedfile] "get"
|
|
|
|
git_annex "drop" [wormannexedfile] "drop"
|
|
|
|
git_annex "get" [wormannexedfile] "get"
|
|
|
|
git_annex "drop" [wormannexedfile] "drop"
|
|
|
|
indir r1 $ do
|
|
|
|
git_annex "drop" ["--force", wormannexedfile] "drop"
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
git_annex "forget" ["--force"] "forget"
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
emptylog
|
|
|
|
indir r2 $ do
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
emptylog
|
|
|
|
indir r1 $ do
|
|
|
|
git_annex "sync" [] "sync"
|
|
|
|
emptylog
|
|
|
|
where
|
|
|
|
emptylog = git_annex_expectoutput "log" [wormannexedfile] []
|