add: avoid ugly error message when adding a deleted file in direct mode
Due to add using withFilesMaybeModified, it will get files that have been deleted but are still in the index. So catch the IO error that results when trying to stat such a file.
This commit is contained in:
parent
07580dc3df
commit
8b0dcb3136
1 changed files with 8 additions and 6 deletions
|
@ -56,12 +56,14 @@ start :: FilePath -> CommandStart
|
|||
start file = ifAnnexed file addpresent add
|
||||
where
|
||||
add = do
|
||||
s <- liftIO $ getSymbolicLinkStatus file
|
||||
if isSymbolicLink s || not (isRegularFile s)
|
||||
then stop
|
||||
else do
|
||||
showStart "add" file
|
||||
next $ perform file
|
||||
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
|
||||
case ms of
|
||||
Nothing -> stop
|
||||
Just s
|
||||
| isSymbolicLink s || not (isRegularFile s) -> stop
|
||||
| otherwise -> do
|
||||
showStart "add" file
|
||||
next $ perform file
|
||||
addpresent (key, _) = ifM isDirect
|
||||
( ifM (goodContent key file) ( stop , add )
|
||||
, fixup key
|
||||
|
|
Loading…
Reference in a new issue