summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-16 22:36:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-16 22:36:35 -0400
commitda453ba70149444672b8cd64e36fe34604edce73 (patch)
treed72f9886f8df45795589c37e30b8b9a2947c25ce
parent19daf3fca40d99dd305a75e10dcaa8fbc734598b (diff)
bugfix: don't add files under .git-annex
That could happen if git annex add -N were used repeatedly..
-rw-r--r--Commands.hs5
-rw-r--r--Core.hs2
-rw-r--r--Locations.hs4
-rw-r--r--doc/git-annex.mdwn3
4 files changed, 9 insertions, 5 deletions
diff --git a/Commands.hs b/Commands.hs
index af6b5aad7..1364a1b35 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -54,7 +54,10 @@ options = [
findWanted :: CmdWants -> [String] -> Git.Repo -> IO [String]
findWanted FilesNotInGit params repo = do
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
files <- mapM (Git.inRepo repo) params
return $ foldl (++) [] files
diff --git a/Core.hs b/Core.hs
index 021595f8b..70e6e6680 100644
--- a/Core.hs
+++ b/Core.hs
@@ -51,7 +51,7 @@ gitAttributes repo = do
commit
else return ()
where
- attrLine = stateLoc ++ "/*.log merge=union"
+ attrLine = stateLoc ++ "*.log merge=union"
attributes = Git.attributes repo
commit = do
Git.run repo ["add", attributes]
diff --git a/Locations.hs b/Locations.hs
index 497850062..76516224c 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -18,9 +18,9 @@ import qualified GitRepo as Git
{- Long-term, cross-repo state is stored in files inside the .git-annex
- directory, in the git repository's working tree. -}
-stateLoc = ".git-annex"
+stateLoc = ".git-annex/"
gitStateDir :: Git.Repo -> FilePath
-gitStateDir repo = (Git.workTree repo) ++ "/" ++ stateLoc ++ "/"
+gitStateDir repo = (Git.workTree repo) ++ "/" ++ stateLoc
{- An annexed file's content is stored in
- /path/to/repo/.git/annex/<key>, where <key> is of the form
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index e65ad5b02..50fd28e82 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -51,7 +51,8 @@ Enough broad picture, here's how it actually looks:
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`
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
(such as "USB archive drive 1") with a repository. This can help with
finding it later, see "Location Tracking" below.