Re: [PATCH 1/2] convert: add a helper to determine the correct EOL for a given path
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Jan 23, 2016, 07:05 UTC
- Message-ID
- <56A32638.9060802@web.de>
- In-Reply-To
- <alpine.DEB.2.20.1601222003360.2964@virtualbox>
On 2016-01-22 20.04, Johannes Schindelin wrote:
Show 14 quoted lines
> Hi Junio, > > On Fri, 22 Jan 2016, Junio C Hamano wrote: > >> Johannes Schindelin <johannes.schindelin@gmx.de> writes: >> >>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> >>> --- >> >> This change somehow ringed a bell and reminded me of your recent >> ls-files stuff. Are there things that these topics can use from >> each other? > > Quite possibly. I'll have a look tomorrow.
Something like this should do: (Fully untested)
enum eol eol_for_path(const char *path, const char *src, size_t len)
{
struct conv_attrs ca;
if (!path)
path = "*"; /* catch * text=xxx */
convert_attrs(&ca, path);
ca.crlf_action = input_crlf_action(ca.crlf_action, ca.eol_attr);return output_eol(crlf_action); }