proxy: Made it work when run in a new repository before initial commit.
This commit is contained in:
parent
7a68b1978d
commit
d5a25bd567
2 changed files with 11 additions and 7 deletions
|
@ -15,6 +15,7 @@ import Utility.Env
|
||||||
import Annex.Direct
|
import Annex.Direct
|
||||||
import qualified Git.Sha
|
import qualified Git.Sha
|
||||||
import qualified Git.Ref
|
import qualified Git.Ref
|
||||||
|
import qualified Git.Branch
|
||||||
|
|
||||||
cmd :: [Command]
|
cmd :: [Command]
|
||||||
cmd = [notBareRepo $
|
cmd = [notBareRepo $
|
||||||
|
@ -28,19 +29,20 @@ start :: [String] -> CommandStart
|
||||||
start [] = error "Did not specify command to run."
|
start [] = error "Did not specify command to run."
|
||||||
start (c:ps) = liftIO . exitWith =<< ifM isDirect
|
start (c:ps) = liftIO . exitWith =<< ifM isDirect
|
||||||
( do
|
( do
|
||||||
g <- gitRepo
|
tmp <- gitAnnexTmpMiscDir <$> gitRepo
|
||||||
withTmpDirIn (gitAnnexTmpMiscDir g) "proxy" go
|
withTmpDirIn tmp "proxy" go
|
||||||
, liftIO $ safeSystem c (map Param ps)
|
, liftIO $ safeSystem c (map Param ps)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
go tmp = do
|
go tmp = do
|
||||||
oldref <- fromMaybe Git.Sha.emptyTree
|
oldref <- fromMaybe Git.Sha.emptyTree
|
||||||
<$> inRepo Git.Ref.headSha
|
<$> inRepo Git.Ref.headSha
|
||||||
exitcode <- liftIO $ proxy tmp
|
exitcode <- proxy tmp
|
||||||
mergeDirectCleanup tmp oldref
|
mergeDirectCleanup tmp oldref
|
||||||
return exitcode
|
return exitcode
|
||||||
proxy tmp = do
|
proxy tmp = do
|
||||||
usetmp <- Just . addEntry "GIT_WORK_TREE" tmp <$> getEnvironment
|
usetmp <- liftIO $ Just . addEntry "GIT_WORK_TREE" tmp <$> getEnvironment
|
||||||
unlessM (boolSystemEnv "git" [Param "checkout", Param "--", Param "."] usetmp) $
|
unlessM (isNothing <$> inRepo Git.Branch.current) $
|
||||||
error "Failed to set up proxy work tree."
|
unlessM (liftIO $ boolSystemEnv "git" [Param "checkout", Param "--", Param "."] usetmp) $
|
||||||
safeSystemEnv c (map Param ps) usetmp
|
error "Failed to set up proxy work tree."
|
||||||
|
liftIO $ safeSystemEnv c (map Param ps) usetmp
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -8,6 +8,8 @@ git-annex (5.20150406.2) UNRELEASED; urgency=medium
|
||||||
added, the file will be checked into git rather than being added to the
|
added, the file will be checked into git rather than being added to the
|
||||||
annex. Previously, git annex add skipped over such files; this new
|
annex. Previously, git annex add skipped over such files; this new
|
||||||
behavior is more useful in direct mode.
|
behavior is more useful in direct mode.
|
||||||
|
* proxy: Made it work when run in a new repository before initial
|
||||||
|
commit.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 06 Apr 2015 20:14:20 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 06 Apr 2015 20:14:20 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue