# Line endings.
#
# This repository is developed on Windows with core.autocrlf=true, so a checkout
# rewrites text files to CRLF. That is invisible until one of them is copied to
# a server and run: a shell script with CRLF line endings fails on the first
# line with "\r: command not found", which reads as a corrupt file rather than a
# checkout artefact. The two kinds of file here that are executed or parsed on a
# Linux host are pinned to LF.
#
# Deliberately NOT "* text=auto": that would renormalise every existing file in
# the repository on the next commit and bury a real change in the diff.
*.sh   text eol=lf
*.conf text eol=lf

# The same hazard, in files with no extension to match on. An rc script is a
# shell script whatever it is called, and everything under the OPNsense plugin's
# files/ tree is read on a FreeBSD firewall - the rc script, the configd
# template targets, the PHP, the XML and the volt view. rc.netbsd was already
# exposed to this: the index holds LF, so pinning these changes nothing in the
# repository and only stops a Windows checkout handing a BSD a file whose first
# line fails with "
: command not found".
packaging/bsd/rc.*         text eol=lf
packaging/opnsense/files/** text eol=lf

# Same hazard again, for the init templates and the two new packagers. None of
# these has an extension for the rules above to match on, and all of them are
# executed or sourced on a non-Windows host:
#
#   deploy/init/*        installed as an init script (runit's run, an s6 run,
#                        /etc/init.d, a launchd plist)
#   xbps INSTALL/REMOVE  copied INTO the .xbps and run by xbps on Void
#   packaging/portage/** ebuilds are bash sourced by portage; breeze-core.confd
#                        is sourced by OpenRC, where a trailing CR would become
#                        part of BREEZE_HOST
#
# A CRLF checkout of any of them fails on its first line with
# "\r: command not found", or binds a host address with a carriage return in
# it, and reads as a corrupt file rather than a checkout artefact.
deploy/init/**          text eol=lf
packaging/xbps/INSTALL  text eol=lf
packaging/xbps/REMOVE   text eol=lf
packaging/portage/**    text eol=lf

# GitHub parses these itself, and a CRLF checkout of a YAML issue form is the
# kind of thing that fails in the form editor rather than anywhere useful.
.github/**              text eol=lf

# The opposite case: a patch against WinGup, whose sources are CRLF, so the
# patch's own lines carry CRs that must survive exactly. Stored and checked out
# byte for byte; any conversion and `git apply` refuses every hunk.
packaging/windows/wingup/breeze.patch -text

# Checked with `sha256sum -c` on Linux, where a CR would become part of the
# file name it looks for.
packaging/windows/wingup/SHA256SUMS text eol=lf

# The Termux package: its run script and maintainer scripts are executed by
# Termux's shell on a phone, and none of them has an extension to match on.
packaging/termux/**     text eol=lf

# The source-package recipes: debian/rules is a makefile run on Debian, and the
# spec, PKGBUILD and control files are read on Linux builders.
packaging/source/**     text eol=lf

# The MIPS builder and the OpenWrt apk builder: a Dockerfile whose RUN lines
# continue with backslashes, and scripts run in Linux containers.
packaging/mips/**        text eol=lf
packaging/openwrt-apk/** text eol=lf

# The macOS link stub: a .tbd is YAML read by zig's linker, which is not the
# place to find out whether it tolerates a CR on every line.
packaging/macos/**       text eol=lf

# The Homebrew formula template: Ruby read by brew on macOS and Linux.
packaging/homebrew/**     text eol=lf

# What the Linux packagers read off disk and put into packages -- the env file
# above all, which Termux, OpenRC and procd source with sh, so a CR turns
# BREEZE_PORT into "8420\r" -- and what is published as it is: the repository
# definition, the site, the web panel. The first 4.3.1 build shipped a CRLF
# env file because none of these were pinned; packaging/check-eol.sh now
# refuses a build whose files on disk disagree with the pins.
packaging/nfpm/**       text eol=lf
packaging/repo/**       text eol=lf
packaging/container/**  text eol=lf
site/**                 text eol=lf
static/**               text eol=lf
