fix up commands that are trouble on bare repos
Most will just abort. init does a basic init and gives a command to run elsewhere to finish it.
This commit is contained in:
parent
b88637fff1
commit
b5b78f26ec
8 changed files with 31 additions and 23 deletions
|
@ -29,7 +29,7 @@ seek = [withStrings start]
|
||||||
|
|
||||||
{- Drops unused content by number. -}
|
{- Drops unused content by number. -}
|
||||||
start :: CommandStartString
|
start :: CommandStartString
|
||||||
start s = do
|
start s = notBareRepo $ do
|
||||||
m <- readUnusedLog
|
m <- readUnusedLog
|
||||||
case M.lookup s m of
|
case M.lookup s m of
|
||||||
Nothing -> return Nothing
|
Nothing -> return Nothing
|
||||||
|
|
|
@ -27,9 +27,8 @@ command = [Command "fromkey" paramPath seek
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withFilesMissing start]
|
seek = [withFilesMissing start]
|
||||||
|
|
||||||
{- Adds a file pointing at a manually-specified key -}
|
|
||||||
start :: CommandStartString
|
start :: CommandStartString
|
||||||
start file = do
|
start file = notBareRepo $ do
|
||||||
key <- cmdlineKey
|
key <- cmdlineKey
|
||||||
inbackend <- Backend.hasKey key
|
inbackend <- Backend.hasKey key
|
||||||
unless inbackend $ error $
|
unless inbackend $ error $
|
||||||
|
|
|
@ -27,7 +27,7 @@ seek :: [CommandSeek]
|
||||||
seek = [withAttrFilesInGit "annex.numcopies" start]
|
seek = [withAttrFilesInGit "annex.numcopies" start]
|
||||||
|
|
||||||
start :: CommandStartAttrFile
|
start :: CommandStartAttrFile
|
||||||
start (file, attr) = isAnnexed file $ \(key, backend) -> do
|
start (file, attr) = notBareRepo $ isAnnexed file $ \(key, backend) -> do
|
||||||
showStart "fsck" file
|
showStart "fsck" file
|
||||||
return $ Just $ perform key file backend numcopies
|
return $ Just $ perform key file backend numcopies
|
||||||
where
|
where
|
||||||
|
|
|
@ -41,11 +41,19 @@ perform :: String -> CommandPerform
|
||||||
perform description = do
|
perform description = do
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
u <- getUUID g
|
u <- getUUID g
|
||||||
describeUUID u description
|
|
||||||
setVersion
|
setVersion
|
||||||
liftIO $ gitAttributesWrite g
|
if Git.repoIsLocalBare g
|
||||||
gitPreCommitHookWrite g
|
then do
|
||||||
return $ Just cleanup
|
showLongNote $
|
||||||
|
"This is a bare repository, so its description cannot be committed.\n" ++
|
||||||
|
"To record the description, run this command in a clone of this repository:\n" ++
|
||||||
|
" git annex describe " ++ (show u) ++ " '" ++ description ++ "'\n\n"
|
||||||
|
return $ Just $ return True
|
||||||
|
else do
|
||||||
|
describeUUID u description
|
||||||
|
liftIO $ gitAttributesWrite g
|
||||||
|
gitPreCommitHookWrite g
|
||||||
|
return $ Just cleanup
|
||||||
|
|
||||||
cleanup :: CommandCleanup
|
cleanup :: CommandCleanup
|
||||||
cleanup = do
|
cleanup = do
|
||||||
|
|
|
@ -32,7 +32,7 @@ seek = [withNothing start]
|
||||||
|
|
||||||
{- Finds unused content in the annex. -}
|
{- Finds unused content in the annex. -}
|
||||||
start :: CommandStartNothing
|
start :: CommandStartNothing
|
||||||
start = do
|
start = notBareRepo $ do
|
||||||
showStart "unused" ""
|
showStart "unused" ""
|
||||||
return $ Just perform
|
return $ Just perform
|
||||||
|
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -11,7 +11,8 @@ git-annex (0.22) UNRELEASED; urgency=low
|
||||||
* New backends: SHA512 SHA384 SHA256 SHA224
|
* New backends: SHA512 SHA384 SHA256 SHA224
|
||||||
* fsck: Check for and repair location log damage.
|
* fsck: Check for and repair location log damage.
|
||||||
* Git annexes can now be attached to bare git repositories. Due to popular
|
* Git annexes can now be attached to bare git repositories. Due to popular
|
||||||
demand.
|
demand. Both the local and remote host must have this version of git-annex
|
||||||
|
installed for it to work.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sun, 13 Feb 2011 00:48:02 -0400
|
-- Joey Hess <joeyh@debian.org> Sun, 13 Feb 2011 00:48:02 -0400
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
**This is still an experimental feature!** Use with caution.
|
||||||
|
|
||||||
Due to popular demand, git-annex can now be used with bare repositories.
|
Due to popular demand, git-annex can now be used with bare repositories.
|
||||||
|
|
||||||
So, for example, you can stash a file away in your
|
So, for example, you can stash a file away in your
|
||||||
repos's origin: `git annex move mybigfile --to origin`
|
repos's origin: `git annex move mybigfile --to origin`
|
||||||
|
|
||||||
Of course, for that to work, the bare repository has to be on a system with
|
Of course, for that to work, the bare repository has to be on a system with
|
||||||
[[git-annex-shell]] installed. If "origin" is on gitweb, you still can't
|
[[git-annex-shell]] installed. If "origin" is on GitWeb, you still can't
|
||||||
use git-annex to there.
|
use git-annex to store stuff there.
|
||||||
|
|
||||||
**This is still an experimental feature!**
|
|
||||||
|
|
||||||
Known to work ok:
|
Known to work ok:
|
||||||
|
|
||||||
|
@ -17,16 +17,15 @@ Known to work ok:
|
||||||
that is being dropped.
|
that is being dropped.
|
||||||
* `git annex get` can transfer data from a bare repository.
|
* `git annex get` can transfer data from a bare repository.
|
||||||
|
|
||||||
There are a few caveats to keep in mind:
|
There are a few caveats to keep in mind when using bare repositories:
|
||||||
|
|
||||||
* `git annex init` can be run in a bare repository, but it cannot
|
* `git annex init` can be run in a bare repository, but it cannot
|
||||||
store the name you gave the repository in .git-annex/uuid.log (because
|
store the name you gave the repository in .git-annex/uuid.log (because
|
||||||
the bare repository has no such file to commit to).
|
the bare repository has no such file to commit to). Instead, it will
|
||||||
* `git annex fromkey` does something pointless in a bare repository.
|
tell you a command to run in some non-bare clone of the repository.
|
||||||
* `git annex fsck` cannot detect any problems in a bare repository.
|
* Some subcommands, like `fsck`, `trust`, `unused` and `fromkey`,
|
||||||
* `git annex unused` will think everything stored in a bare repository
|
cannot be run in a bare repository. Those subcommands will
|
||||||
is unused.
|
refuse to do anything.
|
||||||
* `git annex setkey` is a plumbing-level command, and using it manually
|
* `git annex setkey` is a plumbing-level command; using it manually
|
||||||
to add content to a bare repository is not recommended, since there
|
to add content to a bare repository is not recommended, since there
|
||||||
will be no record accessible by other repositories that the content
|
will be no record that the content is stored there.
|
||||||
is stored there.
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ files with git.
|
||||||
* git-annex prevents accidental data loss by [[tracking copies|copies]]
|
* git-annex prevents accidental data loss by [[tracking copies|copies]]
|
||||||
of your files
|
of your files
|
||||||
* [[internals]]
|
* [[internals]]
|
||||||
|
* [[bare_repositories]]
|
||||||
* [[what git annex is not|not]]
|
* [[what git annex is not|not]]
|
||||||
* git-annex is Free Software, licensed under the [[GPL]].
|
* git-annex is Free Software, licensed under the [[GPL]].
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue