avoid smudge filter returning invalid content
1. git add file 2. git commit 3. modify file 4. git commit 5. git reset HEAD^ Before this fix, that resulted in git saying the file was modified. And indeed, it didn't have the content it should in the just checked out ref, because step 3 modified the object file for the old key.
This commit is contained in:
parent
cc2d78870c
commit
42caf42857
1 changed files with 12 additions and 3 deletions
|
@ -48,10 +48,19 @@ smudge file = do
|
||||||
case parseLinkOrPointer b of
|
case parseLinkOrPointer b of
|
||||||
Nothing -> liftIO $ B.putStr b
|
Nothing -> liftIO $ B.putStr b
|
||||||
Just k -> do
|
Just k -> do
|
||||||
|
-- A previous unlocked checkout of the file may have
|
||||||
|
-- led to the annex object getting modified;
|
||||||
|
-- don't provide such modified content as it
|
||||||
|
-- will be confusing. inAnnex will detect
|
||||||
|
-- modifications.
|
||||||
|
ifM (inAnnex k)
|
||||||
|
( do
|
||||||
|
content <- calcRepo (gitAnnexLocation k)
|
||||||
|
liftIO $ B.putStr . fromMaybe b
|
||||||
|
=<< catchMaybeIO (B.readFile content)
|
||||||
|
, liftIO $ B.putStr b
|
||||||
|
)
|
||||||
Database.Keys.addAssociatedFile k file
|
Database.Keys.addAssociatedFile k file
|
||||||
content <- calcRepo (gitAnnexLocation k)
|
|
||||||
liftIO $ B.hPut stdout . fromMaybe b
|
|
||||||
=<< catchMaybeIO (B.readFile content)
|
|
||||||
stop
|
stop
|
||||||
|
|
||||||
-- Clean filter is fed file content on stdin, decides if a file
|
-- Clean filter is fed file content on stdin, decides if a file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue