summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Content.hs4
-rw-r--r--Annex/GitOverlay.hs12
-rw-r--r--Command/Unannex.hs6
-rw-r--r--Git/Command.hs6
-rw-r--r--Git/Construct.hs1
-rw-r--r--Git/Types.hs1
-rw-r--r--Remote/Git.hs4
-rw-r--r--Utility/CopyFile.hs4
-rw-r--r--Utility/PosixFiles.hs10
-rw-r--r--Utility/UserInfo.hs2
-rw-r--r--debian/changelog2
-rw-r--r--doc/design/adjusted_branches.mdwn25
-rw-r--r--doc/tips/unlocked_files.mdwn2
-rw-r--r--doc/todo/smudge.mdwn8
14 files changed, 46 insertions, 41 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 9c4c1d5b8..a17098ad7 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -594,14 +594,10 @@ linkOrCopy' canhardlink key src dest = catchBoolIO $
where
hardlink = do
s <- getstat
-#ifndef mingw32_HOST_OS
if linkCount s > 1
then copy s
else liftIO (createLink src dest >> return True)
`catchIO` const (copy s)
-#else
- copy s
-#endif
copy = checkedCopyFile' key src dest
getstat = liftIO $ getFileStatus src
diff --git a/Annex/GitOverlay.hs b/Annex/GitOverlay.hs
index 4230ed4a4..7e18d225b 100644
--- a/Annex/GitOverlay.hs
+++ b/Annex/GitOverlay.hs
@@ -45,11 +45,13 @@ withWorkTreeRelated :: FilePath -> Annex a -> Annex a
withWorkTreeRelated d = withAltRepo modrepo unmodrepo
where
modrepo g = do
- let g' = g { location = modlocation (location g) }
- addGitEnv g' "GIT_COMMON_DIR" =<< absPath (localGitDir g)
- unmodrepo g g' = g' { gitEnv = gitEnv g, location = location g }
- modlocation l@(Local {}) = l { gitdir = d }
- modlocation _ = error "withWorkTreeRelated of non-local git repo"
+ g' <- addGitEnv g "GIT_COMMON_DIR" =<< absPath (localGitDir g)
+ g'' <- addGitEnv g' "GIT_DIR" d
+ return (g'' { gitEnvOverridesGitDir = True })
+ unmodrepo g g' = g'
+ { gitEnv = gitEnv g
+ , gitEnvOverridesGitDir = gitEnvOverridesGitDir g
+ }
withAltRepo
:: (Repo -> IO Repo)
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index f01d2b219..4e83fd420 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -5,8 +5,6 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE CPP #-}
-
module Command.Unannex where
import Command
@@ -107,15 +105,11 @@ cleanupIndirect file key = do
copyfrom src =
thawContent file `after` liftIO (copyFileExternal CopyAllMetaData src file)
hardlinkfrom src =
-#ifndef mingw32_HOST_OS
-- creating a hard link could fall; fall back to copying
ifM (liftIO $ catchBoolIO $ createLink src file >> return True)
( return True
, copyfrom src
)
-#else
- copyfrom src
-#endif
performDirect :: FilePath -> Key -> CommandPerform
performDirect file key = do
diff --git a/Git/Command.hs b/Git/Command.hs
index 02e3e5a34..206056368 100644
--- a/Git/Command.hs
+++ b/Git/Command.hs
@@ -17,9 +17,11 @@ import qualified Utility.CoProcess as CoProcess
{- Constructs a git command line operating on the specified repo. -}
gitCommandLine :: [CommandParam] -> Repo -> [CommandParam]
gitCommandLine params r@(Repo { location = l@(Local { } ) }) =
- setdir : settree ++ gitGlobalOpts r ++ params
+ setdir ++ settree ++ gitGlobalOpts r ++ params
where
- setdir = Param $ "--git-dir=" ++ gitdir l
+ setdir
+ | gitEnvOverridesGitDir r = []
+ | otherwise = [Param $ "--git-dir=" ++ gitdir l]
settree = case worktree l of
Nothing -> []
Just t -> [Param $ "--work-tree=" ++ t]
diff --git a/Git/Construct.hs b/Git/Construct.hs
index 03dd29f41..765562212 100644
--- a/Git/Construct.hs
+++ b/Git/Construct.hs
@@ -236,6 +236,7 @@ newFrom l = Repo
, remotes = []
, remoteName = Nothing
, gitEnv = Nothing
+ , gitEnvOverridesGitDir = False
, gitGlobalOpts = []
}
diff --git a/Git/Types.hs b/Git/Types.hs
index 44135738d..327c1d722 100644
--- a/Git/Types.hs
+++ b/Git/Types.hs
@@ -39,6 +39,7 @@ data Repo = Repo
, remoteName :: Maybe RemoteName
-- alternate environment to use when running git commands
, gitEnv :: Maybe [(String, String)]
+ , gitEnvOverridesGitDir :: Bool
-- global options to pass to git when running git commands
, gitGlobalOpts :: [CommandParam]
} deriving (Show, Eq, Ord)
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 9f99dccab..256428137 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -695,7 +695,6 @@ mkCopier :: Bool -> [CommandParam] -> Annex Copier
mkCopier remotewanthardlink rsyncparams = do
let copier = \src dest p check -> unVerified $
rsyncOrCopyFile rsyncparams src dest p <&&> check
-#ifndef mingw32_HOST_OS
localwanthardlink <- wantHardLink
let linker = \src dest -> createLink src dest >> return True
ifM (pure (remotewanthardlink || localwanthardlink) <&&> not <$> isDirect)
@@ -706,6 +705,3 @@ mkCopier remotewanthardlink rsyncparams = do
)
, return copier
)
-#else
- return $ if remotewanthardlink then copier else copier
-#endif
diff --git a/Utility/CopyFile.hs b/Utility/CopyFile.hs
index 46bc43d50..01c600504 100644
--- a/Utility/CopyFile.hs
+++ b/Utility/CopyFile.hs
@@ -49,13 +49,9 @@ copyFileExternal meta src dest = do
{- Create a hard link if the filesystem allows it, and fall back to copying
- the file. -}
createLinkOrCopy :: FilePath -> FilePath -> IO Bool
-#ifndef mingw32_HOST_OS
createLinkOrCopy src dest = go `catchIO` const fallback
where
go = do
createLink src dest
return True
fallback = copyFileExternal CopyAllMetaData src dest
-#else
-createLinkOrCopy = copyFileExternal CopyAllMetaData
-#endif
diff --git a/Utility/PosixFiles.hs b/Utility/PosixFiles.hs
index 4550bebdf..37253da29 100644
--- a/Utility/PosixFiles.hs
+++ b/Utility/PosixFiles.hs
@@ -1,6 +1,6 @@
{- POSIX files (and compatablity wrappers).
-
- - This is like System.PosixCompat.Files, except with a fixed rename.
+ - This is like System.PosixCompat.Files, but with a few fixes.
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
@@ -21,6 +21,7 @@ import System.PosixCompat.Files as X hiding (rename)
import System.Posix.Files (rename)
#else
import qualified System.Win32.File as Win32
+import qualified System.Win32.HardLink as Win32
#endif
{- System.PosixCompat.Files.rename on Windows calls renameFile,
@@ -32,3 +33,10 @@ import qualified System.Win32.File as Win32
rename :: FilePath -> FilePath -> IO ()
rename src dest = Win32.moveFileEx src dest Win32.mOVEFILE_REPLACE_EXISTING
#endif
+
+{- System.PosixCompat.Files.createLink throws an error, but windows
+ - does support hard links. -}
+#ifdef mingw32_HOST_OS
+createLink :: FilePath -> FilePath -> IO ()
+createLink = Win32.createHardLink
+#endif
diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs
index 6f0c59d04..c6010116e 100644
--- a/Utility/UserInfo.hs
+++ b/Utility/UserInfo.hs
@@ -17,9 +17,7 @@ module Utility.UserInfo (
import Utility.Env
import System.PosixCompat
-#ifndef mingw32_HOST_OS
import Control.Applicative
-#endif
import Prelude
{- Current user's home directory.
diff --git a/debian/changelog b/debian/changelog
index 1134ca2de..bfde90da1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ git-annex (6.20160319) UNRELEASED; urgency=medium
* log --raw-date: Use to display seconds from unix epoch.
* v6: Close pointer file handles more quickly, to avoid problems on Windows.
* sync: Show output of git commit.
+ * annex.thin and annex.hardlink are now supported on Windows.
+ * unannex --fast now makes hard links on Windows.
-- Joey Hess <id@joeyh.name> Wed, 23 Mar 2016 11:42:36 -0400
diff --git a/doc/design/adjusted_branches.mdwn b/doc/design/adjusted_branches.mdwn
index 2b2e37a27..75ece6e99 100644
--- a/doc/design/adjusted_branches.mdwn
+++ b/doc/design/adjusted_branches.mdwn
@@ -280,11 +280,20 @@ into adjusted view worktrees.]
to checkout the adjusted branch some other way. Maybe generalize so this
more efficient checkout is available as a git-annex command?
* There are potentially races in code that assumes a branch like
- master is not being changed by someone else. In particular,
- propigateAdjustedCommits rebases the adjusted branch on top of master.
- That is called by sync. The assumption is that any changes in master
- have already been handled by updateAdjustedBranch. But, if another remote
- pushed a new master at just the right time, the adjusted branch could be
- rebased on top of a master that it doesn't incorporate, which is wrong.
-* Annex symlinks generated in merging into an adjusted branch are badly
- formed to point to the temp git dir's annex object dir.
+ master is not being changed by someone else.
+
+ In particular, propigateAdjustedCommits rebases the adjusted branch on
+ top of master. That is called by sync. The assumption is that any changes
+ in master have already been handled by updateAdjustedBranch. But, if
+ another remote pushed a new master at just the right time, the adjusted
+ branch could be rebased on top of a master that it doesn't incorporate,
+ which is wrong.
+
+ Best fix seems to be to use a hidden ref, like refs/annex/adjusted/master
+ and copy master's ref to it when entering the view branch. Then, make
+ all adjustments via that ref, and propigate back to refs/heads/master.
+
+ It's fine to overwrite changes that were pushed to master when
+ propigating from the adjusted branch. Synced changes also go to
+ synced/master so won't be lost. Pushes not made using git-annex sync
+ of master are not really desired, just a possibility.
diff --git a/doc/tips/unlocked_files.mdwn b/doc/tips/unlocked_files.mdwn
index cc9972f9e..20605b612 100644
--- a/doc/tips/unlocked_files.mdwn
+++ b/doc/tips/unlocked_files.mdwn
@@ -143,7 +143,7 @@ match the new setting:
git annex fix
Note that setting annex.thin only has any effect on systems that support
-hard links. Ie, not Windows, and not FAT filesystems.
+hard links. It is supported on Windows, but not on FAT filesystems.
## tradeoffs
diff --git a/doc/todo/smudge.mdwn b/doc/todo/smudge.mdwn
index a80869dc0..d4187c0a0 100644
--- a/doc/todo/smudge.mdwn
+++ b/doc/todo/smudge.mdwn
@@ -26,10 +26,10 @@ git-annex should use smudge/clean filters.
* Eventually (but not yet), make v6 the default for new repositories.
Note that the assistant forces repos into direct mode; that will need to
be changed then, and it should enable annex.thin instead.
-* annex.thin doesn't work on crippled filesystems, so changing to v6
- unlocked files on such a FS always doubles disk use from direct mode.
- Do something about this? Could use windows hard link equivilant.. Or,
- could only store the file content in the work tree and not annex/objects.
+* annex.thin doesn't have any effect on filesystems not supporting
+ hard links. It does work on Windows now(!) -- but not on FAT.
+ So changing to v6 unlocked files on such a FS always doubles
+ disk use from direct mode. Do something about this?
* Later still, remove support for direct mode, and enable automatic
v5 to v6 upgrades.