diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-26 13:54:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-26 13:54:19 -0400 |
commit | 215c08e4cb39da535f6e12a62083743d8c53a946 (patch) | |
tree | 383377236db7eddc96389571f552d800be939a43 /Git | |
parent | bf933867dce7211e116ef27cad7c7fa7bf49f648 (diff) | |
download | git-repair-215c08e4cb39da535f6e12a62083743d8c53a946.tar.gz |
avoid damaging git hook scripts
Diffstat (limited to 'Git')
-rw-r--r-- | Git/Destroyer.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Git/Destroyer.hs b/Git/Destroyer.hs index 57d8ad5..8827976 100644 --- a/Git/Destroyer.hs +++ b/Git/Destroyer.hs @@ -139,8 +139,12 @@ applyDamage ds r = do moveFile fb fa moveFile tmp fa where - -- A broken .git/config is not recoverable. - skipped f = f `elem` [ "config" ] + -- A broken .git/config is not recoverable. + -- Don't damage hook scripts, to avoid running arbitrary code. ;) + skipped f = or + [ f == "config" + , "hooks" `isPrefixOf` f + ] withSaneMode :: FilePath -> IO () -> IO () withSaneMode f = withModifiedFileMode f (addModes [ownerWriteMode, ownerReadMode]) |