Subject: Re: [PATCH RESEND] diff-files: fix copy detection

From: SZEDER Gábor <[email-masked]>
Date: Tue, 16 Dec 2025 00:02:13 +0100

On Sun, Dec 14, 2025 at 04:57:06PM +0100, René Scharfe wrote:
> Fix copy detection by queuing up-to-date and skip-worktree entries using
> diff_same().

> diff --git a/diff-lib.c b/diff-lib.c
> index 8e624f38c6..5307390ff3 100644
> --- a/diff-lib.c
> +++ b/diff-lib.c

> @@ -272,8 +276,10 @@ void run_diff_files(struct rev_info *revs, unsigned int option)
>  		if (!changed && !dirty_submodule) {
>  			ce_mark_uptodate(ce);
>  			mark_fsmonitor_valid(istate, ce);
> -			if (!revs->diffopt.flags.find_copies_harder)
> -				continue;
> +			if (revs->diffopt.flags.find_copies_harder)
> +				diff_same(&revs->diffopt, newmode,
> +					  &ce->oid, ce->name);

Junio, this patch should be queued on top of 38f88051da
(diff-index: don't queue unchanged filepairs with diff_change(),
2025-11-30), because diff_same() was introduced in that commit.

  ~/src/git ((7077c385f9...) %)$ git log --oneline -1
  7077c385f9 (HEAD) diff-files: fix copy detection
  ~/src/git ((7077c385f9...) %)$ make diff-lib.o
      CC diff-lib.o
  diff-lib.c: In function ‘run_diff_files’:
  diff-lib.c:231:33: error: implicit declaration of function ‘diff_same’; did you mean ‘diff_free’? [-Werror=implicit-function-declaration]
    231 |                                 diff_same(&revs->diffopt, ce->ce_mode,
        |                                 ^~~~~~~~~
        |                                 diff_free
  cc1: all warnings being treated as errors
  make: *** [Makefile:2862: diff-lib.o] Error 1