git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diffcore-delta: avoid ignoring final 'line' of file

From
Elijah Newren <newren@gmail.com>
Date
Jan 19, 2024, 01:54 UTC
Message-ID
<CABPp-BEaYkAPphh06R1HrfD03WTv5uy-2q-T0ZMZaxo9hfXv-g@mail.gmail.com>
In-Reply-To
<xmqqil3x69dk.fsf@gitster.g>
On Fri, Jan 12, 2024 at 10:22 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
>
> Elijah Newren <newren@gmail.com> writes:
>
> >> I am not very happy with the hardcoded 97.  You are already using
> >> the non-standard 10% threshold.  If the delta detection that
> >> forgets about the last line is so broken as your proposed log
> >> message noted, shouldn't you be able to construct a sample pair of
> >> preimage and postimage for which the broken version gives so low
> >> similarity to be judged not worth treating as a rename, while the
> >> fixed version gives reasonable similarity to be made into a rename,
> >> by the default threshold?  That way, the test only needs to see if
> >> we got a rename (with any similarity) or a delete and an add.
> >
> > Oops, the threshold is entirely unnecessary here; not sure why I
> > didn't remember to take it out (originally used the threshold while
> > testing without the fix to just how low of a similarity git thought
> > these nearly identical files had).
> >
> > Since you don't like the threshold, and since we don't seem to have a
> > summary format that reports on the rename without the percentage, I
> > guess I need to munge the output with sed:
> >
> >       sed -e "s/^R[0-9]* /R /" actual >actual.munged &&
>
> Heh, I was hoping that we should be able to use "diff --name-only".
>
>  $ git mv Makefile Breakfile
>  $ git diff --name-only -M HEAD
>  Breakfile
>  $ git reset --hard
>  $ git rm Makefile
>  $ >Breakfile && git add Breakfile
>  $ git diff --name-only -M HEAD
>  Breakfile
>  Makefile
>  $ git reset --hard

I guess we could, since the only thing in this repository is a file which is being renamed, and we can then deduce based on the setup that the change we expected must have happened.

However, I didn't like the deduce bit; since --name-only only lists one of the two filenames and doesn't provide any hint that the change involved is a rename, it felt to me like using --name-only would make the test not really be a rename test.

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 10 in “diffcore-delta: avoid ignoring final 'line' of file”
  1. diffcore-delta: avoid ignoring final 'line' of fileElijah Newren via GitGitGadget, Jan 11, 2024
  2. Taylor BlauJan 11, 2024
  3. Junio C HamanoJan 11, 2024
  4. Elijah NewrenJan 13, 2024
  5. Junio C HamanoJan 13, 2024
  6. Elijah NewrenJan 19, 2024
  7. Junio C HamanoJan 19, 2024
  8. Elijah NewrenJan 19, 2024
  9. Junio C HamanoJan 19, 2024
  10. diffcore-delta: avoid ignoring final 'line' of fileElijah Newren via GitGitGadget, Jan 13, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.