Merge branch 'master' into watch
This commit is contained in:
commit
78f5f90c24
9 changed files with 95 additions and 17 deletions
|
@ -10,6 +10,7 @@ module Remote.Hook (remote) where
|
||||||
import qualified Data.ByteString.Lazy.Char8 as L
|
import qualified Data.ByteString.Lazy.Char8 as L
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import System.Exit
|
import System.Exit
|
||||||
|
import System.Environment
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import Types.Remote
|
import Types.Remote
|
||||||
|
@ -59,9 +60,12 @@ hookSetup u c = do
|
||||||
gitConfigSpecialRemote u c' "hooktype" hooktype
|
gitConfigSpecialRemote u c' "hooktype" hooktype
|
||||||
return c'
|
return c'
|
||||||
|
|
||||||
hookEnv :: Key -> Maybe FilePath -> Maybe [(String, String)]
|
hookEnv :: Key -> Maybe FilePath -> IO (Maybe [(String, String)])
|
||||||
hookEnv k f = Just $ fileenv f ++ keyenv
|
hookEnv k f = Just <$> mergeenv (fileenv f ++ keyenv)
|
||||||
where
|
where
|
||||||
|
mergeenv l = M.toList .
|
||||||
|
M.union (M.fromList l)
|
||||||
|
<$> M.fromList <$> getEnvironment
|
||||||
env s v = ("ANNEX_" ++ s, v)
|
env s v = ("ANNEX_" ++ s, v)
|
||||||
keyenv =
|
keyenv =
|
||||||
[ env "KEY" (show k)
|
[ env "KEY" (show k)
|
||||||
|
@ -88,8 +92,9 @@ runHook hooktype hook k f a = maybe (return False) run =<< lookupHook hooktype h
|
||||||
where
|
where
|
||||||
run command = do
|
run command = do
|
||||||
showOutput -- make way for hook output
|
showOutput -- make way for hook output
|
||||||
ifM (liftIO $ boolSystemEnv
|
ifM (liftIO $
|
||||||
"sh" [Param "-c", Param command] $ hookEnv k f)
|
boolSystemEnv "sh" [Param "-c", Param command]
|
||||||
|
=<< hookEnv k f)
|
||||||
( a
|
( a
|
||||||
, do
|
, do
|
||||||
warning $ hook ++ " hook exited nonzero!"
|
warning $ hook ++ " hook exited nonzero!"
|
||||||
|
@ -129,14 +134,14 @@ checkPresent r h k = do
|
||||||
liftIO $ catchMsgIO $ check v
|
liftIO $ catchMsgIO $ check v
|
||||||
where
|
where
|
||||||
findkey s = show k `elem` lines s
|
findkey s = show k `elem` lines s
|
||||||
env = hookEnv k Nothing
|
|
||||||
check Nothing = error "checkpresent hook misconfigured"
|
check Nothing = error "checkpresent hook misconfigured"
|
||||||
check (Just hook) = do
|
check (Just hook) = do
|
||||||
(frompipe, topipe) <- createPipe
|
(frompipe, topipe) <- createPipe
|
||||||
pid <- forkProcess $ do
|
pid <- forkProcess $ do
|
||||||
_ <- dupTo topipe stdOutput
|
_ <- dupTo topipe stdOutput
|
||||||
closeFd frompipe
|
closeFd frompipe
|
||||||
executeFile "sh" True ["-c", hook] env
|
executeFile "sh" True ["-c", hook]
|
||||||
|
=<< hookEnv k Nothing
|
||||||
closeFd topipe
|
closeFd topipe
|
||||||
fromh <- fdToHandle frompipe
|
fromh <- fdToHandle frompipe
|
||||||
reply <- hGetContentsStrict fromh
|
reply <- hGetContentsStrict fromh
|
||||||
|
|
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -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.
|
* 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.
|
* lock: Reset unlocked file to index, rather than to branch head.
|
||||||
|
@ -8,8 +8,9 @@ git-annex (3.20120523) UNRELEASED; urgency=low
|
||||||
unsupported backend.
|
unsupported backend.
|
||||||
* Require that the SHA256 backend can be used when building, since it's the
|
* Require that the SHA256 backend can be used when building, since it's the
|
||||||
default.
|
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
|
git-annex (3.20120522) unstable; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
|
"""]]
|
|
@ -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]]
|
[[!inline pages="page(design/assistant/blog/*)" show=30]]
|
||||||
|
|
|
@ -8,7 +8,7 @@ really useful, it needs to:
|
||||||
- on startup, fix the symlinks for any renamed links **done**
|
- on startup, fix the symlinks for any renamed links **done**
|
||||||
- on startup, stage any files that have been deleted since last run
|
- 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
|
(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 new files, and git annex add **done**
|
||||||
- notice renamed files, auto-fix the symlink, and stage the new file location
|
- notice renamed files, auto-fix the symlink, and stage the new file location
|
||||||
**done**
|
**done**
|
||||||
|
@ -18,9 +18,13 @@ really useful, it needs to:
|
||||||
contents from the index **done**
|
contents from the index **done**
|
||||||
- notice deleted files and stage the deletion
|
- notice deleted files and stage the deletion
|
||||||
(tricky; there's a race with add since it replaces the file with a symlink..)
|
(tricky; there's a race with add since it replaces the file with a symlink..)
|
||||||
|
**done**
|
||||||
- periodically auto-commit staged changes (avoid autocommitting when
|
- periodically auto-commit staged changes (avoid autocommitting when
|
||||||
lots of changes are coming in)
|
lots of changes are coming in)
|
||||||
- tunable delays before adding new files, etc
|
- 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
|
- don't annex `.gitignore` and `.gitattributes` files, but do auto-stage
|
||||||
changes to them
|
changes to them
|
||||||
- configurable option to only annex files meeting certian size or
|
- configurable option to only annex files meeting certian size or
|
||||||
|
@ -32,9 +36,37 @@ really useful, it needs to:
|
||||||
unannex its contents.
|
unannex its contents.
|
||||||
- Gracefully handle when the default limit of 8192 inotified directories
|
- Gracefully handle when the default limit of 8192 inotified directories
|
||||||
is exceeded. This can be tuned by root, so help the user fix it.
|
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.
|
- Support OSes other than Linux; it only uses inotify currently.
|
||||||
OSX and FreeBSD use the same mechanism, and there is a Haskell interface
|
OSX and FreeBSD use the same mechanism, and there is a Haskell interface
|
||||||
for it,
|
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.
|
||||||
|
|
|
@ -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!
|
||||||
|
"""]]
|
|
@ -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."""]]
|
|
11
doc/news/version_3.20120605.mdwn
Normal file
11
doc/news/version_3.20120605.mdwn
Normal 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."""]]
|
|
@ -1,5 +1,5 @@
|
||||||
Name: git-annex
|
Name: git-annex
|
||||||
Version: 3.20120522
|
Version: 3.20120605
|
||||||
Cabal-Version: >= 1.8
|
Cabal-Version: >= 1.8
|
||||||
License: GPL
|
License: GPL
|
||||||
Maintainer: Joey Hess <joey@kitenet.net>
|
Maintainer: Joey Hess <joey@kitenet.net>
|
||||||
|
|
Loading…
Reference in a new issue