From 72721799790c4fe6212799d40fc8abc4081c38c8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Jan 2013 14:11:01 -0400 Subject: [PATCH] avoid running pre-commit hook in direct mode The code that handles committing unlocked files in indirect mode did something unexpected and data lossy. --- Command/PreCommit.hs | 2 +- ..._git_status___39__typechange__39___and_direct_mode.mdwn | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs index e675483c40..7ecf496a9f 100644 --- a/Command/PreCommit.hs +++ b/Command/PreCommit.hs @@ -20,7 +20,7 @@ def = [command "pre-commit" paramPaths seek "run by git pre-commit hook"] seek :: [CommandSeek] seek = [ whenNotDirect $ withFilesToBeCommitted $ whenAnnexed $ Command.Fix.start - , withFilesUnlockedToBeCommitted start] + , whenNotDirect $ withFilesUnlockedToBeCommitted start] start :: FilePath -> CommandStart start file = next $ perform file diff --git a/doc/bugs/Possible_data_loss_-_git_status___39__typechange__39___and_direct_mode.mdwn b/doc/bugs/Possible_data_loss_-_git_status___39__typechange__39___and_direct_mode.mdwn index 18fd1c2914..4a3329326b 100644 --- a/doc/bugs/Possible_data_loss_-_git_status___39__typechange__39___and_direct_mode.mdwn +++ b/doc/bugs/Possible_data_loss_-_git_status___39__typechange__39___and_direct_mode.mdwn @@ -24,4 +24,9 @@ OS: OSX 10.6.8 #### Please provide any additional information below. - +> This was the pre-commit hook, made it not run in direct mode. [[done]] +> +> However, it's normal to see typechanged files in direct mode, and many +> git commands that manipulate files in the working tree *can* result in +> data loss. This is documented on [[direct_mode]]. +> --[[Joey]]