import: Skip .git directories.
This commit is contained in:
parent
ac26b70809
commit
45aed381df
5 changed files with 10 additions and 3 deletions
|
@ -162,7 +162,7 @@ checkStaleGitLocks :: Assistant ()
|
||||||
checkStaleGitLocks = do
|
checkStaleGitLocks = do
|
||||||
lockfiles <- filter (not . isInfixOf "gc.pid")
|
lockfiles <- filter (not . isInfixOf "gc.pid")
|
||||||
. filter (".lock" `isSuffixOf`)
|
. filter (".lock" `isSuffixOf`)
|
||||||
<$> (liftIO . dirContentsRecursiveSkipping (annexDir `isInfixOf`)
|
<$> (liftIO . dirContentsRecursiveSkipping (== dropTrailingPathSeparator annexDir)
|
||||||
=<< liftAnnex (fromRepo Git.localGitDir))
|
=<< liftAnnex (fromRepo Git.localGitDir))
|
||||||
checkStaleLocks lockfiles
|
checkStaleLocks lockfiles
|
||||||
checkStaleLocks :: [FilePath] -> Assistant ()
|
checkStaleLocks :: [FilePath] -> Assistant ()
|
||||||
|
|
3
Seek.hs
3
Seek.hs
|
@ -60,7 +60,8 @@ withPathContents :: ((FilePath, FilePath) -> CommandStart) -> CommandSeek
|
||||||
withPathContents a params = map a . concat <$> liftIO (mapM get params)
|
withPathContents a params = map a . concat <$> liftIO (mapM get params)
|
||||||
where
|
where
|
||||||
get p = ifM (isDirectory <$> getFileStatus p)
|
get p = ifM (isDirectory <$> getFileStatus p)
|
||||||
( map (\f -> (f, makeRelative (parentDir p) f)) <$> dirContentsRecursive p
|
( map (\f -> (f, makeRelative (parentDir p) f))
|
||||||
|
<$> dirContentsRecursiveSkipping (".git" `isSuffixOf`) p
|
||||||
, return [(p, takeFileName p)]
|
, return [(p, takeFileName p)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,13 @@ dirContents d = map (d </>) . filter (not . dirCruft) <$> getDirectoryContents d
|
||||||
dirContentsRecursive :: FilePath -> IO [FilePath]
|
dirContentsRecursive :: FilePath -> IO [FilePath]
|
||||||
dirContentsRecursive topdir = dirContentsRecursiveSkipping (const False) topdir
|
dirContentsRecursive topdir = dirContentsRecursiveSkipping (const False) topdir
|
||||||
|
|
||||||
|
{- Skips directories whose basenames match the skipdir. -}
|
||||||
dirContentsRecursiveSkipping :: (FilePath -> Bool) -> FilePath -> IO [FilePath]
|
dirContentsRecursiveSkipping :: (FilePath -> Bool) -> FilePath -> IO [FilePath]
|
||||||
dirContentsRecursiveSkipping skipdir topdir = go [topdir]
|
dirContentsRecursiveSkipping skipdir topdir = go [topdir]
|
||||||
where
|
where
|
||||||
go [] = return []
|
go [] = return []
|
||||||
go (dir:dirs)
|
go (dir:dirs)
|
||||||
| skipdir dir = go dirs
|
| skipdir (takeFileName dir) = go dirs
|
||||||
| otherwise = unsafeInterleaveIO $ do
|
| otherwise = unsafeInterleaveIO $ do
|
||||||
(files, dirs') <- collect [] []
|
(files, dirs') <- collect [] []
|
||||||
=<< catchDefaultIO [] (dirContents dir)
|
=<< catchDefaultIO [] (dirContents dir)
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -11,6 +11,7 @@ git-annex (4.20131003) UNRELEASED; urgency=low
|
||||||
shorter than the maximum unix domain socket length, because ssh
|
shorter than the maximum unix domain socket length, because ssh
|
||||||
appends stuff to it to make a temporary filename. Closes: #725512
|
appends stuff to it to make a temporary filename. Closes: #725512
|
||||||
* status: Fix space leak in local mode, introduced in version 4.20130920.
|
* status: Fix space leak in local mode, introduced in version 4.20130920.
|
||||||
|
* import: Skip .git directories.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 03 Oct 2013 15:41:24 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 03 Oct 2013 15:41:24 -0400
|
||||||
|
|
||||||
|
|
|
@ -124,3 +124,7 @@ anarcat@angela:foo$
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
Thanks! --[[anarcat]]
|
Thanks! --[[anarcat]]
|
||||||
|
|
||||||
|
> Would have thought this was obviously something you shouldn't do
|
||||||
|
> (sorta like running git-annex import on your home directory),
|
||||||
|
> but ok, it can skip .git directories. [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue