status: On crippled filesystems, was displaying M for all annexed files that were present. Probably caused by a change to what git status displays in this situation. Fixed by treating files git thinks are modified the same as typechanged files.

This commit is contained in:
Joey Hess 2015-12-19 13:36:40 -04:00
parent 9d19a60349
commit 35827e2705
Failed to extract signature
3 changed files with 67 additions and 4 deletions

View file

@ -46,10 +46,19 @@ displayStatus s = do
unlessM (showFullJSON [("status", [c]), ("file", f)]) $
liftIO $ putStrLn $ [c] ++ " " ++ f
-- Git thinks that present direct mode files are typechanged;
-- check their content to see if they are modified or not.
-- Git thinks that present direct mode files are typechanged.
-- (On crippled filesystems, git instead thinks they're modified.)
-- Check their content to see if they are modified or not.
statusDirect :: Status -> Annex (Maybe Status)
statusDirect (TypeChanged t) = do
statusDirect (TypeChanged t) = statusDirect' t
statusDirect s@(Modified t) = ifM crippledFileSystem
( statusDirect' t
, pure (Just s)
)
statusDirect s = pure (Just s)
statusDirect' :: TopFilePath -> Annex (Maybe Status)
statusDirect' t = do
absf <- fromRepo $ fromTopFilePath t
f <- liftIO $ relPathCwdToFile absf
v <- liftIO (catchMaybeIO $ getFileStatus f)
@ -65,7 +74,6 @@ statusDirect (TypeChanged t) = do
, return $ Just $ Modified t
)
checkkey f _ Nothing = Just <$> checkNew f t
statusDirect s = pure (Just s)
checkNew :: FilePath -> TopFilePath -> Annex Status
checkNew f t = ifM (isJust <$> catObjectDetails (Git.Ref.fileRef f))

9
debian/changelog vendored
View file

@ -1,3 +1,12 @@
git-annex (5.20151219) UNRELEASED; urgency=medium
* status: On crippled filesystems, was displaying M for all annexed files
that were present. Probably caused by a change to what git status
displays in this situation. Fixed by treating files git thinks are
modified the same as typechanged files.
-- Joey Hess <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400
git-annex (5.20151218) unstable; urgency=medium
* Add S3 features to git-annex version output.

View file

@ -0,0 +1,46 @@
[[!comment format=mdwn
username="joey"
subject="""comment 6"""
date="2015-12-19T16:30:55Z"
content="""
Sorry I haven't had a chance to think about this problem any more.
The v6 repository format I've been working on should eliminate class problem
anyway. It will let git itself be able to tell if annexed files are modified
or not.
But there is something you can try to debug what's going on.
0. Run the git bash shell and cd to your repository's directory.
1. `cat .git/annex/sentinal.cache` and paste its content.
2. `stat .git/annex/sentinal --terse` and paste the output of that.
2. Pick one of the files wrongly showing as modified. Run `stat $file --terse`
and paste the output of that.
3. And then this command should output the inode cache for the file.
Be sure to replace $file with the name of the file:
`cat $(git annex find $file --format='.git/annex/objects/${hashdirlower}${key}/${key}.cache`)
But hmm, as I was running windows to get these instructions, I seem to have
reproduced the problem myself! In my case:
* The sentinal.cache contained data matching the stat of the sentinal file.
* The annexed file's mtime and size (and even inode) matched the cached
values.
* `git annex status` showed the file as modifed; `git annex sync` found
nothing to commit and didn't change that.
Some more debugging and.. It seems this is not a horrible windows-specific
time zone problem. Thank goodness. Instead, what's going on is that `git -c
core.bare=false status` does not show these files as typechanged, but as
modified instead. Since `git annex status` only has special case handling
for typechanged files, it just passes the M through and displays it.
So, this is only a display problem, and thus nothing to worry about really.
Ie, the rest of git-annex's behavior should not be impacted at all.
It's not windows specific.. Same happens on FAT on Linux. I think git's
behavior probably changed since an earlier version; I'm pretty sure its
status showed typechanged before. Anyway, I've fixed the status display,
on these systems it will now treat files git says are modified the same
as typechanged, and so will use git-annex's inode cache info to diplay
an accurate status for them.
"""]]