public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] whitespace: symbolic links usually lack LF at the end
Date: Thu, 5 Feb 2026 13:21:19 +0100	[thread overview]
Message-ID: <aYSLP1LqBiMwur3O@pks.im> (raw)
In-Reply-To: <xmqqecn0nqyt.fsf@gitster.g>

On Wed, Feb 04, 2026 at 01:23:06PM -0800, Junio C Hamano wrote:
> diff --git a/apply.c b/apply.c
> index 3de4aa4d2e..581aafb8be 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -2193,6 +2193,11 @@ static int parse_chunk(struct apply_state *state, char *buffer, unsigned long si
>  		patch->ws_rule = whitespace_rule(state->repo->index,
>  						 patch->old_name);
>  
> +	/* being an incomplete line is the norm for a symbolic link */
> +	if ((patch->old_mode && S_ISLNK(patch->old_mode)) ||
> +	    (patch->new_mode && S_ISLNK(patch->new_mode)))
> +		patch->ws_rule &= ~WS_INCOMPLETE_LINE;
> +
>  	patchsize = parse_single_patch(state,
>  				       buffer + offset + hdrsize,
>  				       size - offset - hdrsize,

Hm. Wouldn't that mean that we disable this check for both sides of a
diff if either of them is a symlink? That's typically fine, but if the
diff also contains a mode change it might not be.

I'd suggest that we only disable this check in case either:

  - One side doesn't exist, the other is a symbolic link.

  - Both sides are a symbolic link.

Another question is whether we support symref targets that end in a
newline. I guess the answer is going to be some form of "yes", and in
that case we could of course loose some information. But honestly, this
is so much of an edge case that I don't really worry about it too much.

Thanks!

Patrick

  reply	other threads:[~2026-02-05 12:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 21:23 [PATCH] whitespace: symbolic links usually lack LF at the end Junio C Hamano
2026-02-05 12:21 ` Patrick Steinhardt [this message]
2026-02-05 15:50   ` Junio C Hamano
2026-02-06  6:31     ` Patrick Steinhardt
2026-02-06 16:25       ` Junio C Hamano
2026-02-06 16:58         ` Patrick Steinhardt
2026-02-06 16:25 ` [PATCH v2] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYSLP1LqBiMwur3O@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox