summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-09 12:24:42 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-09 12:24:42 -0400
commit3748b178705497c0136d2f3cf679ea16a27ee50b (patch)
tree20239b0c7617ef9028e07e017884158401a19b96
parentcf0126f4366d8b2cc51cfe1319867298d026952a (diff)
proxy: Made it work when run in a new repository before initial commit.
-rw-r--r--Command/Proxy.hs16
-rw-r--r--debian/changelog2
2 files changed, 11 insertions, 7 deletions
diff --git a/Command/Proxy.hs b/Command/Proxy.hs
index 9ccea5796..8c11bf770 100644
--- a/Command/Proxy.hs
+++ b/Command/Proxy.hs
@@ -15,6 +15,7 @@ import Utility.Env
import Annex.Direct
import qualified Git.Sha
import qualified Git.Ref
+import qualified Git.Branch
cmd :: [Command]
cmd = [notBareRepo $
@@ -28,19 +29,20 @@ start :: [String] -> CommandStart
start [] = error "Did not specify command to run."
start (c:ps) = liftIO . exitWith =<< ifM isDirect
( do
- g <- gitRepo
- withTmpDirIn (gitAnnexTmpMiscDir g) "proxy" go
+ tmp <- gitAnnexTmpMiscDir <$> gitRepo
+ withTmpDirIn tmp "proxy" go
, liftIO $ safeSystem c (map Param ps)
)
where
go tmp = do
oldref <- fromMaybe Git.Sha.emptyTree
<$> inRepo Git.Ref.headSha
- exitcode <- liftIO $ proxy tmp
+ exitcode <- proxy tmp
mergeDirectCleanup tmp oldref
return exitcode
proxy tmp = do
- usetmp <- Just . addEntry "GIT_WORK_TREE" tmp <$> getEnvironment
- unlessM (boolSystemEnv "git" [Param "checkout", Param "--", Param "."] usetmp) $
- error "Failed to set up proxy work tree."
- safeSystemEnv c (map Param ps) usetmp
+ usetmp <- liftIO $ Just . addEntry "GIT_WORK_TREE" tmp <$> getEnvironment
+ unlessM (isNothing <$> inRepo Git.Branch.current) $
+ unlessM (liftIO $ boolSystemEnv "git" [Param "checkout", Param "--", Param "."] usetmp) $
+ error "Failed to set up proxy work tree."
+ liftIO $ safeSystemEnv c (map Param ps) usetmp
diff --git a/debian/changelog b/debian/changelog
index 519628d1d..cd12c7e79 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
annex. Previously, git annex add skipped over such files; this new
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