diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-09-21 12:39:13 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-09-21 12:39:13 -0400 |
commit | d57325804d57faef755be86f330119cffe1d1bba (patch) | |
tree | ef31d92d17e6c563e626e34ea242a9ad000e3296 | |
parent | 0535973adab83a9a73a399a6fa798629c0067633 (diff) |
assistant: When updating ~/.ssh/config, preserve any symlinks.
-rw-r--r-- | Utility/SshConfig.hs | 8 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment | 15 |
3 files changed, 22 insertions, 2 deletions
diff --git a/Utility/SshConfig.hs b/Utility/SshConfig.hs index ca336a4b8..57e4f0f38 100644 --- a/Utility/SshConfig.hs +++ b/Utility/SshConfig.hs @@ -15,6 +15,7 @@ import Utility.FileMode import Data.Char import Data.Ord import Data.Either +import System.Directory data SshConfig = GlobalConfig SshSetting @@ -117,8 +118,11 @@ changeUserSshConfig modifier = do whenM (doesFileExist configfile) $ do c <- readFileStrict configfile let c' = modifier c - when (c /= c') $ - viaTmp writeSshConfig configfile c' + when (c /= c') $ do + -- If it's a symlink, replace the file it + -- points to. + f <- catchDefaultIO configfile (canonicalizePath configfile) + viaTmp writeSshConfig f c' writeSshConfig :: FilePath -> String -> IO () writeSshConfig f s = do diff --git a/debian/changelog b/debian/changelog index 0ded62f12..e13e648e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ git-annex (5.20150917) UNRELEASED; urgency=medium * info: Don't allow use in a non-git-annex repository, since it uses the git-annex branch and would create it if it were missing. + * assistant: When updating ~/.ssh/config, preserve any symlinks. -- Joey Hess <id@joeyh.name> Wed, 16 Sep 2015 12:23:33 -0400 diff --git a/doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment b/doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment new file mode 100644 index 000000000..26df1211a --- /dev/null +++ b/doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2015-09-21T16:14:03Z" + content=""" +The assistant does not normally do this when you merely start it up. It does it +when you configure a ssh remote, when it needs to modify that file. +It might also modify the file on startup if it detects a configuration that +an old version of the assistant put in that needs to be fixed up. + +Is the trailing whitespace you speak of just a newline added after the +existing host block, or something else? Your "..." is not very clear. + +Fixed symlink issue in git. +"""]] |