Correct git-annex info to include unlocked files in v6 repository.
An unlocked present file does not have a pointer file in the worktree, so info skipped counting it. It may be that unused was also affected by the problem, but it seemed not to be in my tests. I think because of the use of the associatedFilesFilter. This fix slows down both info and unused a little bit, since they have to query the contents of files from git, but only when handling unlocked files.
This commit is contained in:
		
					parent
					
						
							
								8f362565a8
							
						
					
				
			
			
				commit
				
					
						1df49506c4
					
				
			
		
					 3 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
					@ -159,7 +159,9 @@ formatPointer :: Key -> String
 | 
				
			||||||
formatPointer k = 
 | 
					formatPointer k = 
 | 
				
			||||||
	toInternalGitPath (pathSeparator:objectDir </> keyFile k) ++ "\n"
 | 
						toInternalGitPath (pathSeparator:objectDir </> keyFile k) ++ "\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{- Checks if a file is a pointer to a key. -}
 | 
					{- Checks if a worktree file is a pointer to a key.
 | 
				
			||||||
 | 
					 -
 | 
				
			||||||
 | 
					 - Unlocked files whose content is present are not detected by this. -}
 | 
				
			||||||
isPointerFile :: FilePath -> IO (Maybe Key)
 | 
					isPointerFile :: FilePath -> IO (Maybe Key)
 | 
				
			||||||
isPointerFile f = catchDefaultIO Nothing $ do
 | 
					isPointerFile f = catchDefaultIO Nothing $ do
 | 
				
			||||||
	b <- L.take maxPointerSz <$> L.readFile f
 | 
						b <- L.take maxPointerSz <$> L.readFile f
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,7 @@ import qualified Remote
 | 
				
			||||||
import qualified Annex.Branch
 | 
					import qualified Annex.Branch
 | 
				
			||||||
import Annex.Link
 | 
					import Annex.Link
 | 
				
			||||||
import Annex.CatFile
 | 
					import Annex.CatFile
 | 
				
			||||||
 | 
					import Annex.WorkTree
 | 
				
			||||||
import Types.RefSpec
 | 
					import Types.RefSpec
 | 
				
			||||||
import Git.Types
 | 
					import Git.Types
 | 
				
			||||||
import Git.Sha
 | 
					import Git.Sha
 | 
				
			||||||
| 
						 | 
					@ -215,10 +216,7 @@ withKeysReferenced' mdir initial a = do
 | 
				
			||||||
		Just dir -> inRepo $ LsFiles.inRepo [dir]
 | 
							Just dir -> inRepo $ LsFiles.inRepo [dir]
 | 
				
			||||||
	go v [] = return v
 | 
						go v [] = return v
 | 
				
			||||||
	go v (f:fs) = do
 | 
						go v (f:fs) = do
 | 
				
			||||||
		mk <- getM id
 | 
							mk <- lookupFile f
 | 
				
			||||||
			[ isAnnexLink f
 | 
					 | 
				
			||||||
			, liftIO (isPointerFile f)
 | 
					 | 
				
			||||||
			]
 | 
					 | 
				
			||||||
		case mk of
 | 
							case mk of
 | 
				
			||||||
			Nothing -> go v fs
 | 
								Nothing -> go v fs
 | 
				
			||||||
			Just k -> do
 | 
								Just k -> do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								debian/changelog
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/changelog
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -12,6 +12,7 @@ git-annex (6.20160230) UNRELEASED; urgency=medium
 | 
				
			||||||
  * Fix OSX dmg to include libraries needed by bundled gpg,
 | 
					  * Fix OSX dmg to include libraries needed by bundled gpg,
 | 
				
			||||||
    lost in last release.
 | 
					    lost in last release.
 | 
				
			||||||
  * Always try to thaw content, even when annex.crippledfilesystem is set.
 | 
					  * Always try to thaw content, even when annex.crippledfilesystem is set.
 | 
				
			||||||
 | 
					  * Correct git-annex info to include unlocked files in v6 repository.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 -- Joey Hess <id@joeyh.name>  Mon, 29 Feb 2016 13:00:30 -0400
 | 
					 -- Joey Hess <id@joeyh.name>  Mon, 29 Feb 2016 13:00:30 -0400
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue