-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copy detection differs from git weirdly #1524
Comments
Thanks for reporting! I'd think that it is possible to extract a test-case from the trees that show the issue. Also, I am not surprised as Git implements a more complex algorithm to find the best possible matches. For that it keeps a list of candidates, which One cold hope that once For now I have no plans to improve this, but I should get there at some point. Contributions for this are very welcome, too. |
if you help with test reduction and point me to the code involved, I could take a crack at this, but I don't know the code base well, so something to give me a jump start would be appreciated |
That's a great idea and I'd appreciate you taking a stab at it. Getting a test ready should be possible to me, feel free to ping me though if it doesn't happen within the next 'days' (whatever that means 😅). |
We have a few users on the |
The pathspec list to reduce the set of files was generated with ``` git diff 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3~1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 --stat --no-renames --name-only ``` The assets and script to reproduce the fixture was created with: ``` cargo run -p internal-tools -- git-to-sh -c2 /Users/byron/dev/github.com/martinvonz/jj assets/jj-trackcopy-1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 CHANGELOG.md cli/src/commands/cat.rs cli/src/commands/chmod.rs cli/src/commands/file/chmod.rs cli/src/commands/file/mod.rs cli/src/commands/file/print.rs cli/src/commands/mod.rs cli/tests/cli-reference@.md.snap cli/tests/runner.rs cli/tests/test_acls.rs cli/tests/test_cat_command.rs cli/tests/test_chmod_command.rs cli/tests/test_diffedit_command.rs cli/tests/test_file_chmod_command.rs cli/tests/test_file_print_command.rs cli/tests/test_fix_command.rs cli/tests/test_global_opts.rs cli/tests/test_immutable_commits.rs cli/tests/test_move_command.rs cli/tests/test_new_command.rs cli/tests/test_squash_command.rs cli/tests/test_unsquash_command.rs ``` It's notable that such issues are currently expected as the tracker implementation isn't as precise as the one in Git, which tracks more than one candidate.
The pathspec list to reduce the set of files was generated with ``` git diff 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3~1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 --stat --no-renames --name-only ``` The assets and script to reproduce the fixture was created with: ``` cargo run -p internal-tools -- git-to-sh -c2 /Users/byron/dev/github.com/martinvonz/jj assets/jj-trackcopy-1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 CHANGELOG.md cli/src/commands/cat.rs cli/src/commands/chmod.rs cli/src/commands/file/chmod.rs cli/src/commands/file/mod.rs cli/src/commands/file/print.rs cli/src/commands/mod.rs cli/tests/cli-reference@.md.snap cli/tests/runner.rs cli/tests/test_acls.rs cli/tests/test_cat_command.rs cli/tests/test_chmod_command.rs cli/tests/test_diffedit_command.rs cli/tests/test_file_chmod_command.rs cli/tests/test_file_print_command.rs cli/tests/test_fix_command.rs cli/tests/test_global_opts.rs cli/tests/test_immutable_commits.rs cli/tests/test_move_command.rs cli/tests/test_new_command.rs cli/tests/test_squash_command.rs cli/tests/test_unsquash_command.rs ``` It's notable that such issues are currently expected as the tracker implementation isn't as precise as the one in Git, which tracks more than one candidate.
Sorry for the wait, but once #1529 is merged there is a test for the exact situation described here. Tooling was also added to allow reproducing any real-world scenario easily. With that you should be able to do whatever is needed to get similar results as Git. Something notably absent is benchmarks, but if you are interested, you could probably set one up based on the new fixture for realistic performance in this scenario. All the best - please feel free to let me know if you need anything else. |
The pathspec list to reduce the set of files was generated with ``` git diff 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3~1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 --stat --no-renames --name-only ``` The assets and script to reproduce the fixture was created with: ``` cargo run -p internal-tools -- git-to-sh -c2 /Users/byron/dev/github.com/martinvonz/jj assets/jj-trackcopy-1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 CHANGELOG.md cli/src/commands/cat.rs cli/src/commands/chmod.rs cli/src/commands/file/chmod.rs cli/src/commands/file/mod.rs cli/src/commands/file/print.rs cli/src/commands/mod.rs cli/tests/cli-reference@.md.snap cli/tests/runner.rs cli/tests/test_acls.rs cli/tests/test_cat_command.rs cli/tests/test_chmod_command.rs cli/tests/test_diffedit_command.rs cli/tests/test_file_chmod_command.rs cli/tests/test_file_print_command.rs cli/tests/test_fix_command.rs cli/tests/test_global_opts.rs cli/tests/test_immutable_commits.rs cli/tests/test_move_command.rs cli/tests/test_new_command.rs cli/tests/test_squash_command.rs cli/tests/test_unsquash_command.rs ``` It's notable that such issues are currently expected as the tracker implementation isn't as precise as the one in Git, which tracks more than one candidate.
The pathspec list to reduce the set of files was generated with ``` git diff 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3~1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 --stat --no-renames --name-only ``` The assets and script to reproduce the fixture was created with: ``` cargo run -p internal-tools -- git-to-sh -c2 /Users/byron/dev/github.com/martinvonz/jj assets/jj-trackcopy-1 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 CHANGELOG.md cli/src/commands/cat.rs cli/src/commands/chmod.rs cli/src/commands/file/chmod.rs cli/src/commands/file/mod.rs cli/src/commands/file/print.rs cli/src/commands/mod.rs cli/tests/cli-reference@.md.snap cli/tests/runner.rs cli/tests/test_acls.rs cli/tests/test_cat_command.rs cli/tests/test_chmod_command.rs cli/tests/test_diffedit_command.rs cli/tests/test_file_chmod_command.rs cli/tests/test_file_print_command.rs cli/tests/test_fix_command.rs cli/tests/test_global_opts.rs cli/tests/test_immutable_commits.rs cli/tests/test_move_command.rs cli/tests/test_new_command.rs cli/tests/test_squash_command.rs cli/tests/test_unsquash_command.rs ``` It's notable that such issues are currently expected as the tracker implementation isn't as precise as the one in Git, which tracks more than one candidate.
awesome! I will take a look at this later in the week |
having started debugging a bit, I am pretty sure the similarity computation is what is going wrong here. In the provided example "cli/src/commands/file/mod.rs" and "cli/src/commands/cat.rs" are reported to have a 0.9977956 similarity which seems very wrong if you look at the file contents. |
Thanks for sharing, that could be the spot! I still remember that I 'tuned' it to provide the same results as Git in some specific examples, so it might have been over-fitted there. I also wonder if even with that fixed one can obtain the same results without also adding the additional heuristics and candidates to find the best possible match. |
Is that supposed to be a |
that was it. Sending a PR shortly |
resolving this until we find any more issues! |
Current behavior 😯
Expected behavior 🤔
Git behavior
Git does what I have listed under "expected behavior"
Steps to reproduce 🕹
I am sorry that I don't have a super simple repro. I only know how to cause this in a larger context.
jj
viacargo install jj-cli
jj git clone --colocate https://github.com/martinvonz/jj
cd jj
cargo build
target/debug/jj diff -r 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 --summary
git diff 2de73f57fc9599602e001fc6331034749b2eacb0 47bd6f4aa4a7eeef8b01ce168c6c771bdfffcbd3 --summary
The relevant code for how we use gix is https://github.com/martinvonz/jj/blob/95e8dd51ebfd61712d9fc5f6e19dd95d0026a004/lib/src/git_backend.rs#L1301
The text was updated successfully, but these errors were encountered: