Bug: impure renames may be reported as pure renames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Git community,

please see the report below of what may be a bug.

Yours sincerely
Mário Guimarães

======================================================
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

In the rust-lang/rust repository (I cloned today from GitHub), if we
run the command

    git diff-tree -r -M a04e649^2 a04e649 --
tests/ui/issues/issue-83190.rs
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

we get this result

    :100644 100644 da931c3edaf6f9de6805e771f2b3b28edd27001f
11b659eec97323ea5190dac1771c7ca3241861e7 R100
tests/ui/issues/issue-83190.rs
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

However, the source and destination files of the rename are not 100%
equal. If we run this other command

    git diff -M a04e649^2 a04e649 -- tests/ui/issues/issue-83190.rs
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

we get the following result

    diff --git a/tests/ui/issues/issue-83190.rs
b/tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs
    similarity index 100%
    rename from tests/ui/issues/issue-83190.rs
    rename to tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs
    index da931c3edaf..11b659eec97 100644
    --- a/tests/ui/issues/issue-83190.rs
    +++ b/tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs
    @@ -1,7 +1,7 @@
    -// check-pass
    -
     // Regression test for issue #83190, triggering an ICE in borrowck.

    +// check-pass
    +
     pub trait Any {}
     impl<T> Any for T {}

What did you expect to happen? (Expected behavior)

I was expecting to get from the `git diff-tree ...` command above a
status of `R099`, but never `R100` which should be reserved for pure
renames (i.e., renames with no content modifications).

In fact, if we search for pure renames only, by using the `-M100%`
option, such as running this command

    git diff-tree -r -M100% a04e649^2 a04e649 --
tests/ui/issues/issue-83190.rs
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

we get this output

    :100644 000000 da931c3edaf6f9de6805e771f2b3b28edd27001f
0000000000000000000000000000000000000000 D
tests/ui/issues/issue-83190.rs
    :000000 100644 0000000000000000000000000000000000000000
11b659eec97323ea5190dac1771c7ca3241861e7 A
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

This suggests that the initial command in this report cannot return an
`R100` status, as doing so it contradicts this last command.

Note that we only get a rename in case we lower the similarity
percentage, as demonstrated by this other command using the `-M99%`
option

    git diff-tree -r -M99% a04e649^2 a04e649 --
tests/ui/issues/issue-83190.rs
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

which outputs

    :100644 100644 da931c3edaf6f9de6805e771f2b3b28edd27001f
11b659eec97323ea5190dac1771c7ca3241861e7 R100
tests/ui/issues/issue-83190.rs
tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs

in which we see again `R100`, whereas the correct status should be `R099`.

What happened instead? (Actual behavior)

What's different between what you expected and what actually happened?

Anything else you want to add:

The rename detection machinery should be fixed to report pure renames
(`R100`) only when the source and destination files have exactly the
same contents.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[Info de sistema]
versão git:
git version 2.42.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Darwin 20.6.0 Darwin Kernel Version 20.6.0: Thu Jul  6 22:12:47
PDT 2023; root:xnu-7195.141.49.702.12~1/RELEASE_X86_64 x86_64
info de compilador: clang: 13.0.0 (clang-1300.0.29.30)
info de libc: informação libc indisponível





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux