Merge branch 'master' into watch

This commit is contained in:
Joey Hess 2012-06-05 14:53:38 -04:00
commit 78f5f90c24
9 changed files with 95 additions and 17 deletions

View file

@ -10,6 +10,7 @@ module Remote.Hook (remote) where
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Map as M
import System.Exit
import System.Environment
import Common.Annex
import Types.Remote
@ -59,9 +60,12 @@ hookSetup u c = do
gitConfigSpecialRemote u c' "hooktype" hooktype
return c'
hookEnv :: Key -> Maybe FilePath -> Maybe [(String, String)]
hookEnv k f = Just $ fileenv f ++ keyenv
hookEnv :: Key -> Maybe FilePath -> IO (Maybe [(String, String)])
hookEnv k f = Just <$> mergeenv (fileenv f ++ keyenv)
where
mergeenv l = M.toList .
M.union (M.fromList l)
<$> M.fromList <$> getEnvironment
env s v = ("ANNEX_" ++ s, v)
keyenv =
[ env "KEY" (show k)
@ -88,8 +92,9 @@ runHook hooktype hook k f a = maybe (return False) run =<< lookupHook hooktype h
where
run command = do
showOutput -- make way for hook output
ifM (liftIO $ boolSystemEnv
"sh" [Param "-c", Param command] $ hookEnv k f)
ifM (liftIO $
boolSystemEnv "sh" [Param "-c", Param command]
=<< hookEnv k f)
( a
, do
warning $ hook ++ " hook exited nonzero!"
@ -129,14 +134,14 @@ checkPresent r h k = do
liftIO $ catchMsgIO $ check v
where
findkey s = show k `elem` lines s
env = hookEnv k Nothing
check Nothing = error "checkpresent hook misconfigured"
check (Just hook) = do
(frompipe, topipe) <- createPipe
pid <- forkProcess $ do
_ <- dupTo topipe stdOutput
closeFd frompipe
executeFile "sh" True ["-c", hook] env
executeFile "sh" True ["-c", hook]
=<< hookEnv k Nothing
closeFd topipe
fromh <- fdToHandle frompipe
reply <- hGetContentsStrict fromh

5
debian/changelog vendored
View file

@ -1,4 +1,4 @@
git-annex (3.20120523) UNRELEASED; urgency=low
git-annex (3.20120605) unstable; urgency=low
* sync: Show a nicer message if a user tries to sync to a special remote.
* lock: Reset unlocked file to index, rather than to branch head.
@ -8,8 +8,9 @@ git-annex (3.20120523) UNRELEASED; urgency=low
unsupported backend.
* Require that the SHA256 backend can be used when building, since it's the
default.
* Preserve parent environment when running hooks of the hook special remote.
-- Joey Hess <joeyh@debian.org> Sun, 27 May 2012 20:55:29 -0400
-- Joey Hess <joeyh@debian.org> Tue, 05 Jun 2012 14:03:39 -0400
git-annex (3.20120522) unstable; urgency=low

View file

@ -0,0 +1,21 @@
[[!comment format=mdwn
username="https://www.google.com/accounts/o8/id?id=AItOawkSq2FDpK2n66QRUxtqqdbyDuwgbQmUWus"
nickname="Jimmy"
subject="comment 2"
date="2012-06-05T14:07:26Z"
content="""
FYI, (the follow is on OSX 10.7 on two different machines)
On my 64bit install of haskell platform...
laplace:~ jtang$ ghc -e 'print System.Info.arch'
\"x86_64\"
On my 32bit install of haskell platform...
x00:git-annex jtang$ ghc -e 'print System.Info.arch'
\"i386\"
Running _cabal build_ or _cabal install git-annex_ as you suggest with the 32bit install does do the right thing.
"""]]

View file

@ -1 +1,5 @@
The git-annex assistant is being
[crowd funded on Kickstarter](http://www.kickstarter.com/projects/joeyh/git-annex-assistant-like-dropbox-but-with-your-own/).
I'll be blogging about my progress here on a semi-daily basis.
[[!inline pages="page(design/assistant/blog/*)" show=30]]

View file

@ -8,7 +8,7 @@ really useful, it needs to:
- on startup, fix the symlinks for any renamed links **done**
- on startup, stage any files that have been deleted since last run
(seems to require a `git commit -a` on startup, or at least a
`git add --update`, which will notice deleted files)
`git add --update`, which will notice deleted files) **done**
- notice new files, and git annex add **done**
- notice renamed files, auto-fix the symlink, and stage the new file location
**done**
@ -18,9 +18,13 @@ really useful, it needs to:
contents from the index **done**
- notice deleted files and stage the deletion
(tricky; there's a race with add since it replaces the file with a symlink..)
**done**
- periodically auto-commit staged changes (avoid autocommitting when
lots of changes are coming in)
- tunable delays before adding new files, etc
- Coleasce related add/rm events. See commit
cbdaccd44aa8f0ca30afba23fc06dd244c242075 for some details of the problems
with doing this.
- don't annex `.gitignore` and `.gitattributes` files, but do auto-stage
changes to them
- configurable option to only annex files meeting certian size or
@ -32,9 +36,37 @@ really useful, it needs to:
unannex its contents.
- Gracefully handle when the default limit of 8192 inotified directories
is exceeded. This can be tuned by root, so help the user fix it.
Also to do:
- Support OSes other than Linux; it only uses inotify currently.
OSX and FreeBSD use the same mechanism, and there is a Haskell interface
for it,
## the races
Many races need to be dealt with by this code. Here are some of them.
* File is added and then removed before the annex add finishes.
Currently unfixed; The annex add re-adds the file as a symlink and then
the remove event does nothing since the file exists.
* File is added and then replaced with another file before the annex add
makes its symlink.
Currently unfixed; The annex add will fail creating its symlink since
the file exists. The second add event will add the new file.
* File is added and then replaced with another file before the annex add
moves its content into the annex.
Currently unfixed; The new content will be moved to the annex under the
old checksum, and fsck will later catch this inconsistency.
* File is removed and then re-added before the removal event finishes.
Not a problem; The removal event removes the old file from the index, and
the add event adds the new one.
* File is removed and then re-added before the removal event starts.
Not a problem; The removal event does nothing since the file exists,
and the add event replaces it in git with the new one.

View file

@ -0,0 +1,8 @@
[[!comment format=mdwn
username="https://www.google.com/accounts/o8/id?id=AItOawlu7K3h7Ry1uDAU_ERYGuqt0LoGNJqGuRo"
nickname="Nathan"
subject="comment 2"
date="2012-06-04T21:01:52Z"
content="""
Joey, that sounds reasonable; I'll try it. Thanks!
"""]]

View file

@ -1,4 +0,0 @@
git-annex 3.20120406 released with [[!toggle text="these changes"]]
[[!toggleable text="""
* Disable diskfree on kfreebsd, as I have a build failure on kfreebsd-i386
that is quite likely caused by it."""]]

View file

@ -0,0 +1,11 @@
git-annex 3.20120605 released with [[!toggle text="these changes"]]
[[!toggleable text="""
* sync: Show a nicer message if a user tries to sync to a special remote.
* lock: Reset unlocked file to index, rather than to branch head.
* import: New subcommand, pulls files from a directory outside the annex
and adds them.
* Fix display of warning message when encountering a file that uses an
unsupported backend.
* Require that the SHA256 backend can be used when building, since it's the
default.
* Preserve parent environment when running hooks of the hook special remote."""]]

View file

@ -1,5 +1,5 @@
Name: git-annex
Version: 3.20120522
Version: 3.20120605
Cabal-Version: >= 1.8
License: GPL
Maintainer: Joey Hess <joey@kitenet.net>