Improve ~/.ssh/config modification code to not add trailing spaces to lines it cannot parse.

"Host\n" is a valid line, and actually gets parsed ok, but this also holds
for other lines that it fails to parse for some reason.
This commit is contained in:
Joey Hess 2015-09-22 12:06:10 -04:00
parent 927498a1e4
commit 1dcb86498e
4 changed files with 17 additions and 1 deletions

View file

@ -82,7 +82,8 @@ genSshConfig = unlines . concatMap gen
gen (GlobalConfig s) = [setting s] gen (GlobalConfig s) = [setting s]
gen (HostConfig h cs) = ("Host " ++ h) : map (either comment setting) cs gen (HostConfig h cs) = ("Host " ++ h) : map (either comment setting) cs
setting (SshSetting indent k v) = indent ++ k ++ " " ++ v setting (SshSetting indent k v) = indent ++ k ++
if null v then "" else " " ++ v
comment (Comment indent c) = indent ++ c comment (Comment indent c) = indent ++ c
findHostConfigKey :: SshConfig -> Key -> Maybe Value findHostConfigKey :: SshConfig -> Key -> Maybe Value

2
debian/changelog vendored
View file

@ -8,6 +8,8 @@ git-annex (5.20150917) UNRELEASED; urgency=medium
In particular, storageclass=STANDARD_IA to use Amazon's In particular, storageclass=STANDARD_IA to use Amazon's
new Infrequently Accessed storage, and storageclass=NEARLINE new Infrequently Accessed storage, and storageclass=NEARLINE
to use Google's NearLine storage. to use Google's NearLine storage.
* Improve ~/.ssh/config modification code to not add trailing spaces
to lines it cannot parse.
-- Joey Hess <id@joeyh.name> Wed, 16 Sep 2015 12:23:33 -0400 -- Joey Hess <id@joeyh.name> Wed, 16 Sep 2015 12:23:33 -0400

View file

@ -13,3 +13,5 @@ git-annex-5.20140717-8.fc24.x86_64
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Has worked wonders for syncing keepass files between devices; just now setting up assistant to do things automatically though :) . Has worked wonders for syncing keepass files between devices; just now setting up assistant to do things automatically though :) .
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,11 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2015-09-22T16:03:42Z"
content="""
Well, it does seem legal to do that -- man page says a pattern can be 0 or
more characters, and you have 0.
I've put in a fix in the generator to avoid adding whitespace in this
case.
"""]]