Fix bug that caused typechanged symlinks to be assumed to be unlocked files, so they were added to the annex by the pre-commit hook.
This commit is contained in:
parent
2fc7092095
commit
412dcb8017
4 changed files with 19 additions and 6 deletions
|
@ -12,6 +12,7 @@ module Annex.CatFile (
|
||||||
catFileHandle,
|
catFileHandle,
|
||||||
catKey,
|
catKey,
|
||||||
catKeyFile,
|
catKeyFile,
|
||||||
|
catKeyFileHEAD,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
|
@ -87,6 +88,9 @@ catKey ref = do
|
||||||
-}
|
-}
|
||||||
catKeyFile :: FilePath -> Annex (Maybe Key)
|
catKeyFile :: FilePath -> Annex (Maybe Key)
|
||||||
catKeyFile f = ifM (Annex.getState Annex.daemon)
|
catKeyFile f = ifM (Annex.getState Annex.daemon)
|
||||||
( catKey $ Ref $ "HEAD:./" ++ f
|
( catKeyFileHEAD f
|
||||||
, catKey $ Ref $ ":./" ++ f
|
, catKey $ Ref $ ":./" ++ f
|
||||||
)
|
)
|
||||||
|
|
||||||
|
catKeyFileHEAD :: FilePath -> Annex (Maybe Key)
|
||||||
|
catKeyFileHEAD f = catKey $ Ref $ "HEAD:./" ++ f
|
||||||
|
|
15
Seek.hs
15
Seek.hs
|
@ -26,6 +26,7 @@ import qualified Option
|
||||||
import Config
|
import Config
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import Logs.Unused
|
import Logs.Unused
|
||||||
|
import Annex.CatFile
|
||||||
|
|
||||||
seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath]
|
seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath] -> Annex [FilePath]
|
||||||
seekHelper a params = do
|
seekHelper a params = do
|
||||||
|
@ -86,12 +87,16 @@ withFilesUnlocked = withFilesUnlocked' LsFiles.typeChanged
|
||||||
withFilesUnlockedToBeCommitted :: (FilePath -> CommandStart) -> CommandSeek
|
withFilesUnlockedToBeCommitted :: (FilePath -> CommandStart) -> CommandSeek
|
||||||
withFilesUnlockedToBeCommitted = withFilesUnlocked' LsFiles.typeChangedStaged
|
withFilesUnlockedToBeCommitted = withFilesUnlocked' LsFiles.typeChangedStaged
|
||||||
|
|
||||||
|
{- Unlocked files have changed type from a symlink to a regular file.
|
||||||
|
-
|
||||||
|
- Furthermore, unlocked files used to be a git-annex symlink,
|
||||||
|
- not some other sort of symlink.
|
||||||
|
-}
|
||||||
withFilesUnlocked' :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> (FilePath -> CommandStart) -> CommandSeek
|
withFilesUnlocked' :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> (FilePath -> CommandStart) -> CommandSeek
|
||||||
withFilesUnlocked' typechanged a params = do
|
withFilesUnlocked' typechanged a params = prepFiltered a unlockedfiles
|
||||||
-- unlocked files have changed type from a symlink to a regular file
|
where
|
||||||
typechangedfiles <- seekHelper typechanged params
|
check f = liftIO (notSymlink f) <&&> isJust <$> catKeyFileHEAD f
|
||||||
let unlockedfiles = liftIO $ filterM notSymlink typechangedfiles
|
unlockedfiles = filterM check =<< seekHelper typechanged params
|
||||||
prepFiltered a unlockedfiles
|
|
||||||
|
|
||||||
{- Finds files that may be modified. -}
|
{- Finds files that may be modified. -}
|
||||||
withFilesMaybeModified :: (FilePath -> CommandStart) -> CommandSeek
|
withFilesMaybeModified :: (FilePath -> CommandStart) -> CommandSeek
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -12,6 +12,8 @@ git-annex (4.20130816) UNRELEASED; urgency=low
|
||||||
* Unescape characters in 'file://...' URIs. (Thanks, guilhem for the patch.)
|
* Unescape characters in 'file://...' URIs. (Thanks, guilhem for the patch.)
|
||||||
* Better error message when trying to use a git remote that has annex.ignore
|
* Better error message when trying to use a git remote that has annex.ignore
|
||||||
set.
|
set.
|
||||||
|
* Fix bug that caused typechanged symlinks to be assumed to be unlocked
|
||||||
|
files, so they were added to the annex by the pre-commit hook.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 15 Aug 2013 15:47:52 +0200
|
-- Joey Hess <joeyh@debian.org> Thu, 15 Aug 2013 15:47:52 +0200
|
||||||
|
|
||||||
|
|
|
@ -36,3 +36,5 @@ Ubuntu 12.04 LTS
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue