fsck: Refuse to do anything if more than one of --incremental, --more, and --incremental-schedule are given, since it's not clear which option should win.

This commit is contained in:
Joey Hess 2014-02-20 15:56:45 -04:00
parent 7d288d83c9
commit 9edc3a735d
2 changed files with 8 additions and 3 deletions

View file

@ -67,6 +67,7 @@ seek :: CommandSeek
seek ps = do seek ps = do
from <- getOptionField fsckFromOption Remote.byNameWithUUID from <- getOptionField fsckFromOption Remote.byNameWithUUID
i <- getIncremental i <- getIncremental
liftIO $ print i
withKeyOptions withKeyOptions
(\k -> startKey i k =<< getNumCopies) (\k -> startKey i k =<< getNumCopies)
(withFilesInGit $ whenAnnexed $ start from i) (withFilesInGit $ whenAnnexed $ start from i)
@ -80,11 +81,12 @@ getIncremental = do
morei <- Annex.getFlag (optionName moreIncrementalOption) morei <- Annex.getFlag (optionName moreIncrementalOption)
case (i, starti, morei) of case (i, starti, morei) of
(False, False, False) -> return NonIncremental (False, False, False) -> return NonIncremental
(False, True, _) -> startIncremental (False, True, False) -> startIncremental
(False ,False, True) -> ContIncremental <$> getStartTime (False ,False, True) -> ContIncremental <$> getStartTime
(True, _, _) -> (True, False, False) ->
maybe startIncremental (return . ContIncremental . Just) maybe startIncremental (return . ContIncremental . Just)
=<< getStartTime =<< getStartTime
_ -> error "Specify only one of --incremental, --more, or --incremental-schedule"
where where
startIncremental = do startIncremental = do
recordStartTime recordStartTime
@ -408,7 +410,7 @@ badContentRemote remote key = do
++ Remote.name remote ++ Remote.name remote
data Incremental = StartIncremental | ContIncremental (Maybe EpochTime) | NonIncremental data Incremental = StartIncremental | ContIncremental (Maybe EpochTime) | NonIncremental
deriving (Eq) deriving (Eq, Show)
runFsck :: Incremental -> FilePath -> Key -> Annex Bool -> CommandStart runFsck :: Incremental -> FilePath -> Key -> Annex Bool -> CommandStart
runFsck inc file key a = ifM (needFsck inc key) runFsck inc file key a = ifM (needFsck inc key)

3
debian/changelog vendored
View file

@ -20,6 +20,9 @@ git-annex (5.20140211) UNRELEASED; urgency=medium
overridden in .git/config. overridden in .git/config.
* glacier: Do not try to run glacier value create when an existing glacier * glacier: Do not try to run glacier value create when an existing glacier
remote is enabled. remote is enabled.
* fsck: Refuse to do anything if more than one of --incremental, --more,
and --incremental-schedule are given, since it's not clear which option
should win.
* Windows webapp: Can set up box.com, Amazon S3, and rsync.net remotes * Windows webapp: Can set up box.com, Amazon S3, and rsync.net remotes
* Windows webapp: Can create repos on removable drives. * Windows webapp: Can create repos on removable drives.
* Windows: Ensure HOME is set, as needed by bundled cygwin utilities. * Windows: Ensure HOME is set, as needed by bundled cygwin utilities.