aboutsummaryrefslogtreecommitdiff
path: root/Annex/Direct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-08-04 14:01:59 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-08-04 14:01:59 -0400
commit76bc6f4b653a9dc94709fc3ee511cc877c487ee1 (patch)
treefb7b9bacbb8a99a43d9b6e4cda2a24e6a070e389 /Annex/Direct.hs
parent5c2eff7f4e56378a807f0c5e2a32f1e65d8da0b6 (diff)
proxy: Fix proxy git commit of non-annexed files in direct mode.
* proxy: Fix proxy git commit of non-annexed files in direct mode. * proxy: If a non-proxied git command, such as git revert would normally fail because of unstaged files in the work tree, make the proxied command fail the same way.
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r--Annex/Direct.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index bb470e04c..d88dc43fb 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -230,7 +230,7 @@ mergeDirectCommit allowff old branch commitmode = do
mergeDirectCleanup :: FilePath -> Git.Ref -> Annex ()
mergeDirectCleanup d oldref = do
- updateWorkTree d oldref
+ updateWorkTree d oldref False
liftIO $ removeDirectoryRecursive d
{- Updates the direct mode work tree to reflect the changes staged in the
@@ -247,8 +247,8 @@ mergeDirectCleanup d oldref = do
- order, but we cannot add the directory until the file with the
- same name is removed.)
-}
-updateWorkTree :: FilePath -> Git.Ref -> Annex ()
-updateWorkTree d oldref = do
+updateWorkTree :: FilePath -> Git.Ref -> Bool -> Annex ()
+updateWorkTree d oldref force = do
(items, cleanup) <- inRepo $ DiffTree.diffIndex oldref
makeabs <- flip fromTopFilePath <$> gitRepo
let fsitems = zip (map (makeabs . DiffTree.file) items) items
@@ -281,7 +281,7 @@ updateWorkTree d oldref = do
- Otherwise, create the symlink and then if possible, replace it
- with the content. -}
movein item makeabs k f = unlessM (goodContent k f) $ do
- preserveUnannexed item makeabs f oldref
+ unless force $ preserveUnannexed item makeabs f oldref
l <- calcRepo $ gitAnnexLink f k
replaceFile f $ makeAnnexLink l
toDirect k f
@@ -289,7 +289,7 @@ updateWorkTree d oldref = do
{- Any new, modified, or renamed files were written to the temp
- directory by the merge, and are moved to the real work tree. -}
movein_raw item makeabs f = do
- preserveUnannexed item makeabs f oldref
+ unless force $ preserveUnannexed item makeabs f oldref
liftIO $ do
createDirectoryIfMissing True $ parentDir f
void $ tryIO $ rename (d </> getTopFilePath (DiffTree.file item)) f