sync: Fix committing when in a direct mode repo that has no HEAD ref.

Seen for example, a newly checked out git submodule. In this case,
.git/HEAD is a raw sha, rather than the usual reference to a ref.

Removed currentSha in passing, since it was a more roundabout way of
doing what headSha does, and headSha is more robust.
This commit is contained in:
Joey Hess 2015-03-04 15:25:13 -04:00
parent 79b6500111
commit a6db10d565
5 changed files with 16 additions and 14 deletions

View file

@ -13,8 +13,8 @@ import Config
import Utility.Tmp
import Utility.Env
import Annex.Direct
import qualified Git.Branch
import qualified Git.Sha
import qualified Git.Ref
cmd :: [Command]
cmd = [notBareRepo $
@ -35,7 +35,7 @@ start (c:ps) = liftIO . exitWith =<< ifM isDirect
where
go tmp = do
oldref <- fromMaybe Git.Sha.emptyTree
<$> inRepo Git.Branch.currentSha
<$> inRepo Git.Ref.headSha
exitcode <- liftIO $ proxy tmp
mergeDirectCleanup tmp oldref
return exitcode