bugfix: don't add files under .git-annex

That could happen if git annex add -N were used repeatedly..
This commit is contained in:
Joey Hess 2010-10-16 22:36:35 -04:00
parent 19daf3fca4
commit da453ba701
4 changed files with 9 additions and 5 deletions

View file

@ -54,7 +54,10 @@ options = [
findWanted :: CmdWants -> [String] -> Git.Repo -> IO [String] findWanted :: CmdWants -> [String] -> Git.Repo -> IO [String]
findWanted FilesNotInGit params repo = do findWanted FilesNotInGit params repo = do
files <- mapM (Git.notInRepo repo) params files <- mapM (Git.notInRepo repo) params
return $ foldl (++) [] files return $ filter notstate $ foldl (++) [] files
where
-- never include files in the state directory
notstate f = f /= take (length stateLoc) f
findWanted FilesInGit params repo = do findWanted FilesInGit params repo = do
files <- mapM (Git.inRepo repo) params files <- mapM (Git.inRepo repo) params
return $ foldl (++) [] files return $ foldl (++) [] files

View file

@ -51,7 +51,7 @@ gitAttributes repo = do
commit commit
else return () else return ()
where where
attrLine = stateLoc ++ "/*.log merge=union" attrLine = stateLoc ++ "*.log merge=union"
attributes = Git.attributes repo attributes = Git.attributes repo
commit = do commit = do
Git.run repo ["add", attributes] Git.run repo ["add", attributes]

View file

@ -18,9 +18,9 @@ import qualified GitRepo as Git
{- Long-term, cross-repo state is stored in files inside the .git-annex {- Long-term, cross-repo state is stored in files inside the .git-annex
- directory, in the git repository's working tree. -} - directory, in the git repository's working tree. -}
stateLoc = ".git-annex" stateLoc = ".git-annex/"
gitStateDir :: Git.Repo -> FilePath gitStateDir :: Git.Repo -> FilePath
gitStateDir repo = (Git.workTree repo) ++ "/" ++ stateLoc ++ "/" gitStateDir repo = (Git.workTree repo) ++ "/" ++ stateLoc
{- An annexed file's content is stored in {- An annexed file's content is stored in
- /path/to/repo/.git/annex/<key>, where <key> is of the form - /path/to/repo/.git/annex/<key>, where <key> is of the form

View file

@ -51,7 +51,8 @@ Enough broad picture, here's how it actually looks:
content again. Use this if you've moved the file around. content again. Use this if you've moved the file around.
* `git annex unannex $file` undoes a `git annex add`. But use `git annex drop` * `git annex unannex $file` undoes a `git annex add`. But use `git annex drop`
if you're just done with a file; only use `unannex` if you if you're just done with a file; only use `unannex` if you
accidentially added a file. accidentially added a file. (You can also run this on all your annexed
files come the Singularity. ;-)
* `git annex describe "some description"` allows associating some description * `git annex describe "some description"` allows associating some description
(such as "USB archive drive 1") with a repository. This can help with (such as "USB archive drive 1") with a repository. This can help with
finding it later, see "Location Tracking" below. finding it later, see "Location Tracking" below.