summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-05 16:05:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-05 16:05:07 -0400
commit19a01d9bf469607d4b491c1d2302ce6547fc80a2 (patch)
treec8a01d2367f76e10a466c7de9a768b57c58a3d99 /Command
parent57a01d90316d18d55a9e9120d74f65782c7d5cf8 (diff)
lock: Require --force.
Diffstat (limited to 'Command')
-rw-r--r--Command/Lock.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/Command/Lock.hs b/Command/Lock.hs
index 6dc58df74..bceba4a91 100644
--- a/Command/Lock.hs
+++ b/Command/Lock.hs
@@ -10,6 +10,7 @@ module Command.Lock where
import Common.Annex
import Command
import qualified Annex.Queue
+import qualified Annex
def :: [Command]
def = [notDirect $ command "lock" paramPaths seek SectionCommon
@@ -21,6 +22,8 @@ seek = [withFilesUnlocked start, withFilesUnlockedToBeCommitted start]
start :: FilePath -> CommandStart
start file = do
showStart "lock" file
+ unlessM (Annex.getState Annex.force) $
+ error "Locking this file would discard any changes you have made to it. Use 'git annex add' to stage your changes. (Or, use --force to override)"
next $ perform file
perform :: FilePath -> CommandPerform