diff options
author | Joey Hess <joey@kitenet.net> | 2010-11-28 15:28:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-11-28 15:28:20 -0400 |
commit | 653ad35a9f728ed5b3e9b557cdfb15a19b4afe16 (patch) | |
tree | 40e8ed2880ea291f33ef20e931b9d9d1d8c7189c /Utility.hs | |
parent | 92e5d28ca83d057a3d8f5d7d30806642de699172 (diff) |
In .gitattributes, the git-annex-numcopies attribute can be used to control the number of copies to retain of different types of files.
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Utility.hs b/Utility.hs index 2bea6e875..882492a2d 100644 --- a/Utility.hs +++ b/Utility.hs @@ -12,7 +12,8 @@ module Utility ( relPathDirToDir, boolSystem, shellEscape, - unsetFileMode + unsetFileMode, + readMaybe ) where import System.IO @@ -125,3 +126,9 @@ unsetFileMode :: FilePath -> FileMode -> IO () unsetFileMode f m = do s <- getFileStatus f setFileMode f $ fileMode s `intersectFileModes` complement m + +{- Attempts to read a value from a String. -} +readMaybe :: (Read a) => String -> Maybe a +readMaybe s = case reads s of + ((x,_):_) -> Just x + _ -> Nothing |