All of lore.kernel.org
 help / color / mirror / Atom feed
* Unix-mode newlines
@ 2021-11-12 16:17 Patrick Williams
  2021-11-12 22:49 ` Michael Richardson
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Williams @ 2021-11-12 16:17 UTC (permalink / raw)
  To: OpenBMC List

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

Hello,

Generally we've had a preference for Unix-style newlines (\n) and not DOS-style
newlines (\r\n), but it has never been documented.  I've recently found
a small number of files that are either DOS-style or mixed-styles and I've been
fixing them as I've ran into them.

I recently discovered that clang-format has options that allow us to force
Unix-style newlines.  I've pushed up a commit to docs that makes two changes to
our C++ style guidelines:

    1) Document expectation of using Unix-style newlines.
    2) Update .clang-format to enforce Unix-style newlines.

See https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/48770 .

I'll leave this commit open until early next week and then merge it if I don't
hear any concerns.

-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Unix-mode newlines
  2021-11-12 16:17 Unix-mode newlines Patrick Williams
@ 2021-11-12 22:49 ` Michael Richardson
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Richardson @ 2021-11-12 22:49 UTC (permalink / raw)
  To: Patrick Williams; +Cc: OpenBMC List

Patrick Williams <patrick@stwcx.xyz> wrote:
    > Generally we've had a preference for Unix-style newlines (\n) and not DOS-style
    > newlines (\r\n), but it has never been documented.  I've recently found
    > a small number of files that are either DOS-style or mixed-styles and I've been
    > fixing them as I've ran into them.

Check out "man gitattributes"

You create a file like:
% cat .gitattributes
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.yang text
*.txt text
*.md text
*.mkd text

...

and then git translates in/out.
Which is the default in the "repo" is up to you.
It takes a hit where many files with the "wrong" line endings have to
tweaked, but then it's done.

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        |    IoT architect   [
]     mcr@sandelman.ca  http://www.sandelman.ca/        |   ruby on rails    [







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-12 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-12 16:17 Unix-mode newlines Patrick Williams
2021-11-12 22:49 ` Michael Richardson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.