Justin's metadata code
This commit is contained in:
parent
9e54a29546
commit
39d60f3570
1 changed files with 25 additions and 0 deletions
|
@ -27,6 +27,9 @@ import Utility.FileMode
|
||||||
import Config
|
import Config
|
||||||
import qualified Option
|
import qualified Option
|
||||||
import Types.Key
|
import Types.Key
|
||||||
|
import System.Posix.Types
|
||||||
|
import System.Posix.Files
|
||||||
|
import Data.Bits
|
||||||
|
|
||||||
def :: [Command]
|
def :: [Command]
|
||||||
def = [withOptions options $ command "fsck" paramPaths seek
|
def = [withOptions options $ command "fsck" paramPaths seek
|
||||||
|
@ -318,3 +321,25 @@ badContentRemote remote key = do
|
||||||
Remote.logStatus remote key InfoMissing
|
Remote.logStatus remote key InfoMissing
|
||||||
return $ (if ok then "dropped from " else "failed to drop from ")
|
return $ (if ok then "dropped from " else "failed to drop from ")
|
||||||
++ Remote.name remote
|
++ Remote.name remote
|
||||||
|
|
||||||
|
isSticky :: String -> IO Bool
|
||||||
|
isSticky f = do
|
||||||
|
fs <- getFileStatus f
|
||||||
|
let mode = fileMode fs
|
||||||
|
return $ 0/= mode .&. 512
|
||||||
|
|
||||||
|
setSticky :: String -> IO FileMode
|
||||||
|
setSticky f = do
|
||||||
|
fs <- getFileStatus f
|
||||||
|
let mode = fileMode fs
|
||||||
|
let newmode = mode .|. 512
|
||||||
|
setFileMode f newmode
|
||||||
|
return newmode
|
||||||
|
|
||||||
|
updateMetadata :: Key -> Annex Bool
|
||||||
|
updateMetadata key = do
|
||||||
|
file <- inRepo $ gitAnnexLocation key
|
||||||
|
let parent = parentDir file
|
||||||
|
liftIO $ touchFile parent
|
||||||
|
liftIO $ setSticky parent
|
||||||
|
return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue