Skip to content
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

Repository index corrupted after a cherry pick with .gitattribute text settings #131

Open
sokai116 opened this issue Jan 17, 2025 · 1 comment

Comments

@sokai116
Copy link

Version

7.2.0

Operating System

Windows

Bug description

In a cherry-pick with an auto 3-way merge, org.eclipse.jgit.merge.ResolveMerger.updateIndex wrongly uses rawMerged.length() for TEXT_CRLF steam causes the issue. rawMerged.length() calculate length in LF but the merged file is in CRLF, cause the index length different from workspace file length. After such cherry-pick, git status will always show the file is modified, then checkout/cherry-pick another commit will change the repository into a conflict state.

Actual behavior

After the cherry-pick, git status shows the file has been modified, but git diff shows no difference. Use git ls-files --debug xxx && ls -l xxx can see the index size is different from the actual file size.

It will be aborted as FAILED if this happens within a rebase action.

Expected behavior

The repository should have no unstaged changes after the cherry-pick.

Relevant log output

Other information

No response

@tomaswolf
Copy link
Contributor

Could you please provide a public Github repository and instructions on how to reproduce this? ("Clone repo xyz, check out branch foo, cherry-pick commit abc".) Please make it as self-contained as possible, with all needed settings in .gitattributes, and provide any other relevant settings from the git config, such as core.eol or core.autocrlf.

Analyzing this and then doing something about it requires us to have a reproducer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants