add works in direct mode
Also, changed sync to no longer automatically add files in direct mode. That was only necessary before because add didn't work.
This commit is contained in:
parent
0b665658b6
commit
858ad6783b
3 changed files with 29 additions and 23 deletions
|
@ -55,16 +55,7 @@ stageDirect = do
|
|||
(Just key, Nothing, _) -> deletedannexed file key
|
||||
(Nothing, Nothing, _) -> deletegit file
|
||||
(_, Just _, _) -> addgit file
|
||||
go (file, Nothing) = do
|
||||
mstat <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
|
||||
case (mstat, toCache =<< mstat) of
|
||||
(Nothing, _) -> noop
|
||||
(Just stat, Just cache)
|
||||
| isSymbolicLink stat -> addgit file
|
||||
| otherwise -> void $ addDirect file cache
|
||||
(Just stat, Nothing)
|
||||
| isSymbolicLink stat -> addgit file
|
||||
| otherwise -> noop
|
||||
go _ = noop
|
||||
|
||||
modifiedannexed file oldkey cache = do
|
||||
void $ removeAssociatedFile oldkey file
|
||||
|
|
|
@ -21,14 +21,19 @@ import Annex.Perms
|
|||
import Utility.Touch
|
||||
import Utility.FileMode
|
||||
import Config
|
||||
import qualified Git.HashObject
|
||||
import qualified Git.UpdateIndex
|
||||
import Git.Types
|
||||
|
||||
def :: [Command]
|
||||
def = [notDirect $ notBareRepo $
|
||||
command "add" paramPaths seek "add files to annex"]
|
||||
def = [notBareRepo $ command "add" paramPaths seek "add files to annex"]
|
||||
|
||||
{- Add acts on both files not checked into git yet, and unlocked files. -}
|
||||
seek :: [CommandSeek]
|
||||
seek = [withFilesNotInGit start, withFilesUnlocked start]
|
||||
seek =
|
||||
[ withFilesNotInGit start
|
||||
, whenNotDirect $ withFilesUnlocked start
|
||||
]
|
||||
|
||||
{- The add subcommand annexes a file, generating a key for it using a
|
||||
- backend, and then moving it into the annex directory and setting up
|
||||
|
@ -68,7 +73,7 @@ lockDown file = do
|
|||
|
||||
{- Moves a locked down file into the annex.
|
||||
-
|
||||
- In direct mode, leaves the file alone, and just updates bookeeping
|
||||
- In direct mode, leaves the file alone, and just updates bookkeeping
|
||||
- information.
|
||||
-}
|
||||
ingest :: KeySource -> Annex (Maybe Key)
|
||||
|
@ -146,11 +151,20 @@ link file key hascontent = handle (undo file key) $ do
|
|||
{- Note: Several other commands call this, and expect it to
|
||||
- create the symlink and add it. -}
|
||||
cleanup :: FilePath -> Key -> Bool -> CommandCleanup
|
||||
cleanup file key hascontent = do
|
||||
_ <- link file key hascontent
|
||||
params <- ifM (Annex.getState Annex.force)
|
||||
( return [Param "-f"]
|
||||
, return []
|
||||
)
|
||||
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
||||
return True
|
||||
cleanup file key hascontent = ifM isDirect
|
||||
( do
|
||||
l <- calcGitLink file key
|
||||
sha <- inRepo $ Git.HashObject.hashObject BlobObject l
|
||||
Annex.Queue.addUpdateIndex =<<
|
||||
inRepo (Git.UpdateIndex.stageSymlink file sha)
|
||||
logStatus key InfoPresent
|
||||
return True
|
||||
, do
|
||||
_ <- link file key hascontent
|
||||
params <- ifM (Annex.getState Annex.force)
|
||||
( return [Param "-f"]
|
||||
, return []
|
||||
)
|
||||
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
||||
return True
|
||||
)
|
||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -4,7 +4,8 @@ git-annex (3.20130105) UNRELEASED; urgency=low
|
|||
* committer: Fix a file handle leak.
|
||||
* assistant: Make expensive transfer scan work fully in direct mode.
|
||||
* More commands work in direct mode repositories: find, whereis, move, copy,
|
||||
drop, log, fsck.
|
||||
drop, log, fsck, add.
|
||||
* sync: No longer automatically adds files in direct mode.
|
||||
* assistant: Detect when system is not configured with a user name,
|
||||
and set environment to prevent git from failing.
|
||||
* direct: Avoid hardlinking symlinks that point to the same content
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue