From: "Mário Guimarães" <mario.luis.guimaraes@gmail.com>
To: git@vger.kernel.org
Subject: Bug: impure renames may be reported as pure renames
Date: Tue, 20 Feb 2024 20:58:30 +0000 [thread overview]
Message-ID: <CAF7CYk6dERu7Lb0iKeq7zwtZVVd_bG2FMZReSDeejcu1JGiaFw@mail.gmail.com> (raw)
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
next reply other threads:[~2024-02-20 20:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 20:58 Mário Guimarães [this message]
2024-02-21 2:12 ` Bug: impure renames may be reported as pure renames Elijah Newren
2024-02-21 17:11 ` Junio C Hamano
2024-02-21 21:00 ` 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=CAF7CYk6dERu7Lb0iKeq7zwtZVVd_bG2FMZReSDeejcu1JGiaFw@mail.gmail.com \
--to=mario.luis.guimaraes@gmail.com \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).