Skip to content

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

Description

@sokai116

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions