Hi,
On Mon, 25 Jan 2016, Johannes Schindelin wrote:
> diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
> index c852acc..d98f430 100644
> --- a/xdiff/xmerge.c
> +++ b/xdiff/xmerge.c
> @@ -172,15 +178,8 @@ static int is_eol_crlf(xdfile_t *file, int i)
> file->recs[i - 1]->ptr[size - 2] == '\r';
> }
>
> -static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1,
> - xdfenv_t *xe2, const char *name2,
> - const char *name3,
> - int size, int i, int style,
> - xdmerge_t *m, char *dest, int marker_size)
> +static int is_cr_needed(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m)
> {
> - int marker1_size = (name1 ? strlen(name1) + 1 : 0);
> - int marker2_size = (name2 ? strlen(name2) + 1 : 0);
> - int marker3_size = (name3 ? strlen(name3) + 1 : 0);
> int needs_cr;
>
> /* Match post-images' preceding, or first, lines' end-of-line style */
> @@ -191,14 +190,25 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char
> *name1,
> if (needs_cr)
> needs_cr = is_eol_crlf(&xe1->xdf1, 0);
> /* If still undecided, use LF-only */
> - if (needs_cr < 0)
> - needs_cr = 0;
> + return needs_cr < 0 ? 0 : needs_cr;
> +}
> +
> +static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1,
> + xdfenv_t *xe2, const char *name2,
> + const char *name3,
> + int size, int i, int style,
> + xdmerge_t *m, char *dest, int marker_size)
> +{
> + int marker1_size = (name1 ? strlen(name1) + 1 : 0);
> + int marker2_size = (name2 ? strlen(name2) + 1 : 0);
> + int marker3_size = (name3 ? strlen(name3) + 1 : 0);
> + int needs_cr = is_cr_needed(xe1, xe2, m);
>
> if (marker_size <= 0)
> marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
>
Oh bummer. I just realized that I should have refactored that already in
patch 1/2 before sending out v3. Of course it would be true to history to
do the refactoring only as part of 2/2, but who cares about true history
when one can rewrite it?
Will send out v4 in a while (I want to wait for more feedback in case I
need to change more things.) In the meantime, you can always look at my
patch series' current state here:
https://github.com/git/git/compare/next...dscho:merge-marker-crlf
Ciao,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html