Preserve execute bits of unlocked files in v6 mode.
When annex.thin is set, adding an object will add the execute bits to the work tree file, and this does mean that the annex object file ends up executable. This doesn't add any complexity that wasn't already present, because git annex add of an executable file has always ingested it so that the annex object ends up executable. But, since an annex object file can be executable or not, when populating an unlocked file from one, the executable bit is always added or removed to match the mode of the pointer file.
This commit is contained in:
parent
d05a75e45a
commit
b7c8bf5274
12 changed files with 128 additions and 67 deletions
|
@ -61,7 +61,7 @@ linkKey file oldkey newkey = ifM (isJust <$> isAnnexLink file)
|
|||
- and vulnerable to corruption. -}
|
||||
( getViaTmp' DefaultVerify newkey $ \tmp -> unVerified $ do
|
||||
oldobj <- calcRepo (gitAnnexLocation oldkey)
|
||||
linkOrCopy' (return True) newkey oldobj tmp
|
||||
linkOrCopy' (return True) newkey oldobj tmp Nothing
|
||||
, do
|
||||
ic <- withTSDelta (liftIO . genInodeCache file)
|
||||
{- The file being rekeyed is itself an unlocked file, so if
|
||||
|
@ -69,7 +69,7 @@ linkKey file oldkey newkey = ifM (isJust <$> isAnnexLink file)
|
|||
oldobj <- calcRepo (gitAnnexLocation oldkey)
|
||||
v <- tryNonAsync $ modifyContent oldobj $ do
|
||||
replaceFile oldobj $ \tmp ->
|
||||
unlessM (checkedCopyFile oldkey file tmp) $
|
||||
unlessM (checkedCopyFile oldkey file tmp Nothing) $
|
||||
error "can't lock old key"
|
||||
freezeContent oldobj
|
||||
oldic <- withTSDelta (liftIO . genInodeCache oldobj)
|
||||
|
@ -95,9 +95,10 @@ cleanup file oldkey newkey = do
|
|||
liftIO $ removeFile file
|
||||
addLink file newkey Nothing
|
||||
, do
|
||||
mode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus file
|
||||
liftIO $ whenM (isJust <$> isPointerFile file) $
|
||||
writeFile file (formatPointer newkey)
|
||||
stagePointerFile file =<< hashPointerFile newkey
|
||||
writePointerFile file newkey mode
|
||||
stagePointerFile file mode =<< hashPointerFile newkey
|
||||
Database.Keys.removeAssociatedFile oldkey
|
||||
=<< inRepo (toTopFilePath file)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue