ensure local remote is initialized when copying to it

Needed due to this scenario: Bare repo origin is made, foo is cloned from it;
foo is initalized; a file is added to foo's annex; git annex move --to origin

Since the git-annex branch has not yet been pushed to origin, it doesn't
auto-initialize. When the content is sent to it, it's stored, but
the remote has NoUUID, and so nothing is logged in the location log.
Then the content is removed from the local repo, and git-annex has lost
track of it.

git annex fsck in origin will find the lost content, but let's not let this
happen. Content should only be sent to initalized remotes.

This cannot happen for non-local remotes, since git-annex-shell always
checks that the repo is initialized.
This commit is contained in:
Joey Hess 2011-12-10 19:38:27 -04:00
parent 9ba99a544b
commit f44f715f51

View file

@ -210,6 +210,7 @@ copyToRemote r key
params <- rsyncParams r
-- run copy from perspective of remote
liftIO $ onLocal r $ do
ensureInitialized
ok <- Annex.Content.getViaTmp key $
rsyncOrCopyFile params keysrc
Annex.Content.saveState