aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Unannex.hs11
-rw-r--r--Command/Uninit.hs2
-rw-r--r--debian/changelog1
-rw-r--r--doc/git-annex.mdwn4
4 files changed, 13 insertions, 5 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index 3da7c2a41..ca9788ddb 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -75,7 +75,16 @@ cleanupIndirect :: FilePath -> Key -> CommandCleanup
cleanupIndirect file key = do
src <- calcRepo $ gitAnnexLocation key
ifM (Annex.getState Annex.fast)
- ( hardlinkfrom src
+ ( do
+ -- Only make a hard link if the annexed file does not
+ -- already have other hard links pointing at it.
+ -- This avoids unannexing (and uninit) ending up
+ -- hard linking files together, which would be
+ -- surprising.
+ s <- liftIO $ getFileStatus src
+ if linkCount s > 1
+ then copyfrom src
+ else hardlinkfrom src
, copyfrom src
)
where
diff --git a/Command/Uninit.hs b/Command/Uninit.hs
index 5b2adf0bd..dccf4a614 100644
--- a/Command/Uninit.hs
+++ b/Command/Uninit.hs
@@ -8,6 +8,7 @@
module Command.Uninit where
import Common.Annex
+import qualified Annex
import Command
import qualified Git
import qualified Git.Command
@@ -37,6 +38,7 @@ check = do
seek :: CommandSeek
seek ps = do
withFilesNotInGit False (whenAnnexed startCheckIncomplete) ps
+ Annex.changeState $ \s -> s { Annex.fast = True }
withFilesInGit (whenAnnexed Command.Unannex.start) ps
finish
diff --git a/debian/changelog b/debian/changelog
index e886f14ba..31226e4ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,7 @@ git-annex (5.20140413) UNRELEASED; urgency=medium
connections.
* Improve handling of monthly/yearly scheduling.
* Avoid depending on shakespeare except for when building the webapp.
+ * uninit: Avoid making unncessary copies of files.
-- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 21:33:35 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 9d896c6a0..d6f3d21b2 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -845,10 +845,6 @@ subdirectories).
repository, and remove all of git-annex's other data, leaving you with a
git repository plus the previously annexed files.
- Normally this does a slow copy of every file. In `--fast` mode, this copy
- is avoided, but if two files in the repository have the same content,
- they will end up hard linked together.
-
# PLUMBING COMMANDS
* `pre-commit [path ...]`