import Config
import Git.Types
import Git.Sha
+import Git.FilePath
import qualified Git.Ref
import Command.Export (filterExport, getExportCommit, seekExport)
import Command.Sync (syncBranch)
pushedbranches <- liftIO $
S.fromList . map snd . parseHookInput
<$> B.hGetContents stdin
- let waspushed b = S.member b pushedbranches
- || S.member (syncBranch b) pushedbranches
- case filter (waspushed . Git.Ref.branchRef . fst . snd) rbs of
- [] -> return ()
- rbs' -> forM_ rbs' $ \((r, b), _) -> go r b
+ let waspushed (r, (b, d))
+ | S.member (Git.Ref.branchRef b) pushedbranches =
+ Just (r, b, d)
+ | S.member (Git.Ref.branchRef (syncBranch b)) pushedbranches =
+ Just (r, syncBranch b, d)
+ | otherwise = Nothing
+ case headMaybe (mapMaybe waspushed rbs) of
+ Just (r, b, Nothing) -> go r b
+ Just (r, b, Just d) -> go r $
+ Git.Ref.branchFileRef b (getTopFilePath d)
+ Nothing -> noop
where
canexport r = case remoteAnnexTrackingBranch (Remote.gitconfig r) of
Nothing -> return Nothing
Just branch ->
ifM (isExportSupported r)
- ( return (Just ((r, branch), splitRemoteAnnexTrackingBranchSubdir branch))
+ ( return (Just (r, splitRemoteAnnexTrackingBranchSubdir branch))
, return Nothing
)
Just t -> do
tree <- filterExport r t
mtbcommitsha <- getExportCommit r b
- seekExport r tree mtbcommitsha []
+ seekExport r tree mtbcommitsha [r]
parseHookInput :: B.ByteString -> [((Sha, Sha), Ref)]
parseHookInput = mapMaybe parse . B8.lines
* A proxied exporttree=yes special remote is not untrusted, and should be.
-* Handle cases where a single key is used by multiple files in the exported
- tree. Need to download from the special remote in order to export
- multiple copies to it. (In particular, this is needed when using
- `git-annex push`. When using first `git push` followed by
- `git-annex copy --to` the proxied remote, the received key is stored
- to all export locations.)
-
* Implement `git-annex export treeish --to=foo --from=bar`, which
gets from bar as needed to send to foo. Make post-retrieve use
`--to=r --from=r` to handle the multiple files case.
an exporttree=yes special remote that does not have
annexobjects=yes, to avoid foot shooting.
+* Added --from option to `git-annex export`.
+
## items deferred until later for p2p protocol over http
* `git-annex p2phttp` should support serving several repositories at the same