summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-14 11:56:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-14 11:56:37 -0400
commitb4af18f29de3848b736a24cde2dce34715b970f6 (patch)
tree70ad65df737d2e21c374ef9ae7b07c5807e75015
parent5db2552997f3ada4d8ec3bfe4c9eddc75c23740a (diff)
In direct mode, files with the same key are no longer hardlinked, as that would cause a surprising behavior if modifying one, where the other would also change.
-rw-r--r--Annex/Content.hs3
-rw-r--r--Annex/Direct.hs9
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/Switching_from_indirect_mode_to_direct_mode_breaks_duplicates.mdwn11
4 files changed, 20 insertions, 6 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 7fa6541f7..f58628097 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -254,7 +254,8 @@ moveAnnex key src = withObjectLoc key storeobject storedirect
updateCache key src
thawContent src
liftIO $ replaceFile dest $ moveFile src
- liftIO $ forM_ fs $ \f -> replaceFile f $ createLink dest
+ liftIO $ forM_ fs $ \f -> replaceFile f $
+ void . copyFileExternal dest
{- Replaces any existing file with a new version, by running an action.
- First, makes sure the file is deleted. Or, if it didn't already exist,
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index 9ef808163..e0d3f9d79 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -24,6 +24,7 @@ import Backend
import Types.KeySource
import Annex.Content
import Annex.Content.Direct
+import Utility.CopyFile
{- Uses git ls-files to find files that need to be committed, and stages
- them into the index. Returns True if some changes were staged. -}
@@ -181,11 +182,11 @@ toDirectGen k f = do
liftIO $ replaceFile f $ moveFile loc
, return Nothing
)
- (loc':_) -> ifM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f)
- {- Another direct file has the content, so
- - hard link to it. -}
+ (loc':_) -> ifM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus loc')
+ {- Another direct file has the content; copy it. -}
( return $ Just $ do
- liftIO $ replaceFile f $ createLink loc'
+ liftIO $ replaceFile f $
+ void . copyFileExternal loc'
, return Nothing
)
diff --git a/debian/changelog b/debian/changelog
index 4a4498880..8f0384bf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,9 @@ git-annex (3.20130108) UNRELEASED; urgency=low
* webapp: Adjust longpoll code to work with recent versions of
shakespeare-js.
* assistant: Support new gvfs dbus names used in Gnome 3.6.
+ * In direct mode, files with the same key are no longer hardlinked, as
+ that would cause a surprising behavior if modifying one, where the other
+ would also change.
-- Joey Hess <joeyh@debian.org> Tue, 08 Jan 2013 12:37:38 -0400
diff --git a/doc/bugs/Switching_from_indirect_mode_to_direct_mode_breaks_duplicates.mdwn b/doc/bugs/Switching_from_indirect_mode_to_direct_mode_breaks_duplicates.mdwn
index c4c1a8385..55d2b13b9 100644
--- a/doc/bugs/Switching_from_indirect_mode_to_direct_mode_breaks_duplicates.mdwn
+++ b/doc/bugs/Switching_from_indirect_mode_to_direct_mode_breaks_duplicates.mdwn
@@ -12,10 +12,19 @@
When switching to direct mode, both symlinks should be replaced by a copy (or at least a hardlink) of the actual file.
+> The typo that caused this bug is fixed. --[[Joey]]
+
#What version of git-annex are you using? On what operating system?
3.20130107 on Arch Linux x64
#Please provide any additional information below.
-The deduplication performed by git-annex is very dangerous in itself because files with identical content become replaced by references to the same file without the user necessarily being aware. Think of the user making a copy of a file, than modifying it. He would expect to end up with two files, the unchanged original and the modified copy. But what he really gets is two symlinks pointing to the same modified file.
+The deduplication performed by git-annex is very dangerous in itself
+because files with identical content become replaced by references to the
+same file without the user necessarily being aware. Think of the user
+making a copy of a file, than modifying it. He would expect to end up with
+two files, the unchanged original and the modified copy. But what he really
+gets is two symlinks pointing to the same modified file.
+
+> I agree, it now copies rather than hard linking. [[done]] --[[Joey]]