Patch attached, including tests. See https://bugzilla.gnome.org/show_bug.cgi?id=776319 for the rationale.
Created attachment 128791 [details] [review] Add x-systemd-unit MIME type This covers all types of systemd unit file, matching by filename and magic string.
Looks good to me. But this could be tightened a bit I think. The section name must be followed by a newline, and must be following either a newline or the beginning of the file. Can the mime spec language express something like that?
Test doesn't pass: 0 errors, 1164 comparisons, 189 failed (189 expected), 1 unexpected successes You should also add a D-Bus .service mime-type and test, as mentioned in https://bugzilla.gnome.org/show_bug.cgi?id=776319#c4
Created attachment 128822 [details] [review] Add x-systemd-unit and x-dbus-service MIME types These cover all types of systemd unit file, and D-Bus services, matching by filename and magic string. They are added together as both use the .service extension, and hence can be confused if only matched by name. Matching by content sniffing disambiguates them, as they use different group headers.
Attachment 128822 [details] pushed as 46adfc5 - Add x-systemd-unit and x-dbus-service MIME types
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.