import: Check for gitignored files before moving them into the tree. (Needs git 1.8.4 or newer.)
This commit is contained in:
parent
d8ffa498ef
commit
2e54251c18
3 changed files with 15 additions and 5 deletions
|
@ -16,6 +16,7 @@ import Backend
|
||||||
import Remote
|
import Remote
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
import Types.Key
|
import Types.Key
|
||||||
|
import Annex.CheckIgnore
|
||||||
|
|
||||||
cmd :: [Command]
|
cmd :: [Command]
|
||||||
cmd = [withOptions opts $ notBareRepo $ command "import" paramPaths seek
|
cmd = [withOptions opts $ notBareRepo $ command "import" paramPaths seek
|
||||||
|
@ -79,11 +80,15 @@ start mode (srcfile, destfile) =
|
||||||
next $ return True
|
next $ return True
|
||||||
importfile = do
|
importfile = do
|
||||||
handleexisting =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus destfile)
|
handleexisting =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus destfile)
|
||||||
liftIO $ createDirectoryIfMissing True (parentDir destfile)
|
ignored <- not <$> Annex.getState Annex.force <&&> checkIgnored destfile
|
||||||
liftIO $ if mode == Duplicate || mode == SkipDuplicates
|
if ignored
|
||||||
then void $ copyFileExternal CopyAllMetaData srcfile destfile
|
then error $ "not importing " ++ destfile ++ " which is .gitignored (use --force to override)"
|
||||||
else moveFile srcfile destfile
|
else do
|
||||||
Command.Add.perform destfile
|
liftIO $ createDirectoryIfMissing True (parentDir destfile)
|
||||||
|
liftIO $ if mode == Duplicate || mode == SkipDuplicates
|
||||||
|
then void $ copyFileExternal CopyAllMetaData srcfile destfile
|
||||||
|
else moveFile srcfile destfile
|
||||||
|
Command.Add.perform destfile
|
||||||
handleexisting Nothing = noop
|
handleexisting Nothing = noop
|
||||||
handleexisting (Just s)
|
handleexisting (Just s)
|
||||||
| isDirectory s = notoverwriting "(is a directory)"
|
| isDirectory s = notoverwriting "(is a directory)"
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -11,6 +11,8 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
|
||||||
* S3: Fix incompatability with bucket names used by hS3; the aws library
|
* S3: Fix incompatability with bucket names used by hS3; the aws library
|
||||||
cannot handle upper-case bucket names. git-annex now converts them to
|
cannot handle upper-case bucket names. git-annex now converts them to
|
||||||
lower case automatically.
|
lower case automatically.
|
||||||
|
* import: Check for gitignored files before moving them into the tree.
|
||||||
|
(Needs git 1.8.4 or newer.)
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400
|
||||||
|
|
||||||
|
|
|
@ -36,3 +36,6 @@ Can't the ignored files just be ignored?
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> Made git-annex import check for gitignored files before
|
||||||
|
> moving them into the work tree. [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue