From: Torsten Bögershausen Date: Sat, 23 Jan 2016 07:05:28 GMT Subject: Re: [PATCH 1/2] convert: add a helper to determine the correct EOL for a given path Message-ID: <56A32638.9060802@web.de> In-Reply-To: On 2016-01-22 20.04, Johannes Schindelin wrote: > Hi Junio, > > On Fri, 22 Jan 2016, Junio C Hamano wrote: > >> Johannes Schindelin writes: >> >>> Signed-off-by: Johannes Schindelin >>> --- >> >> 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); }