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
|
(Just key, Nothing, _) -> deletedannexed file key
|
||||||
(Nothing, Nothing, _) -> deletegit file
|
(Nothing, Nothing, _) -> deletegit file
|
||||||
(_, Just _, _) -> addgit file
|
(_, Just _, _) -> addgit file
|
||||||
go (file, Nothing) = do
|
go _ = noop
|
||||||
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
|
|
||||||
|
|
||||||
modifiedannexed file oldkey cache = do
|
modifiedannexed file oldkey cache = do
|
||||||
void $ removeAssociatedFile oldkey file
|
void $ removeAssociatedFile oldkey file
|
||||||
|
|
|
@ -21,14 +21,19 @@ import Annex.Perms
|
||||||
import Utility.Touch
|
import Utility.Touch
|
||||||
import Utility.FileMode
|
import Utility.FileMode
|
||||||
import Config
|
import Config
|
||||||
|
import qualified Git.HashObject
|
||||||
|
import qualified Git.UpdateIndex
|
||||||
|
import Git.Types
|
||||||
|
|
||||||
def :: [Command]
|
def :: [Command]
|
||||||
def = [notDirect $ notBareRepo $
|
def = [notBareRepo $ command "add" paramPaths seek "add files to annex"]
|
||||||
command "add" paramPaths seek "add files to annex"]
|
|
||||||
|
|
||||||
{- Add acts on both files not checked into git yet, and unlocked files. -}
|
{- Add acts on both files not checked into git yet, and unlocked files. -}
|
||||||
seek :: [CommandSeek]
|
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
|
{- 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
|
- 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.
|
{- 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.
|
- information.
|
||||||
-}
|
-}
|
||||||
ingest :: KeySource -> Annex (Maybe Key)
|
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
|
{- Note: Several other commands call this, and expect it to
|
||||||
- create the symlink and add it. -}
|
- create the symlink and add it. -}
|
||||||
cleanup :: FilePath -> Key -> Bool -> CommandCleanup
|
cleanup :: FilePath -> Key -> Bool -> CommandCleanup
|
||||||
cleanup file key hascontent = do
|
cleanup file key hascontent = ifM isDirect
|
||||||
_ <- link file key hascontent
|
( do
|
||||||
params <- ifM (Annex.getState Annex.force)
|
l <- calcGitLink file key
|
||||||
( return [Param "-f"]
|
sha <- inRepo $ Git.HashObject.hashObject BlobObject l
|
||||||
, return []
|
Annex.Queue.addUpdateIndex =<<
|
||||||
)
|
inRepo (Git.UpdateIndex.stageSymlink file sha)
|
||||||
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
logStatus key InfoPresent
|
||||||
return True
|
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.
|
* committer: Fix a file handle leak.
|
||||||
* assistant: Make expensive transfer scan work fully in direct mode.
|
* assistant: Make expensive transfer scan work fully in direct mode.
|
||||||
* More commands work in direct mode repositories: find, whereis, move, copy,
|
* 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,
|
* assistant: Detect when system is not configured with a user name,
|
||||||
and set environment to prevent git from failing.
|
and set environment to prevent git from failing.
|
||||||
* direct: Avoid hardlinking symlinks that point to the same content
|
* direct: Avoid hardlinking symlinks that point to the same content
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue