diff options
author | Dmitrii Filippov <dmfilippov@google.com> | 2022-06-23 15:28:10 +0200 |
---|---|---|
committer | Dmitrii Filippov <dmfilippov@google.com> | 2022-07-29 19:35:22 +0200 |
commit | 8584ac704849915cc573c98f277391d7c8b381a1 (patch) | |
tree | dffadb0bbb19880b76bb6b7fb7106a5f980f6142 /.mailmap | |
parent | 911b4e0d8257f1e9f02e35fcf8dba3d24e8fe56f (diff) | |
download | jgit-8584ac704849915cc573c98f277391d7c8b381a1.tar.gz jgit-8584ac704849915cc573c98f277391d7c8b381a1.zip |
NameConflictTreeWalk: respect git order on multi-tree iteration
The NameConflictTreeWalk class is used in 3-way merge for iterating over
entries in 3 different commits. The class provides information about a
current entry and a state of the entry in commits (e.g entry is file,
entry is directory, entry is missing). In rare cases, the tree walker
can mix information about entries with different name.
The problem appears, because git uses unusual sorting order for
files. Example (this is a simplified real-life example):
Commit 1:
* gradle.properties - file
* gradle - directory (with nested files)
* gradle/file - file in gradle directory
Commit 2:
* gradle.properties - file
* no entry with the name gradle
Commit 3:
* gradle.properties - file
* gradle - file
Here the names are ordered like this:
"gradle" file <"gradle.properties" file < "gradle/file" file.
NameConflictTreeWalk iterator already have code for processing
git sorting order, however in the example above the code doesn't
work correctly. Before the fix, NameConflictTreeWalk returns:
#next()
"gradle - directory" | "gradle.properties" | "gradle - file" - which is
wrong. The expected result is
#next()
"gradle - directory | MISSED_FILE | "gradle - file"
#next()
"gradle.properties"|"gradle.properties"|"gradle.properties"
Ensure that the "matches" field of tree iterators (which contains the
current path) is kept in sync in the case above.
Change-Id: Ief5aa06d80b358f4080043c8694aa0fd7c60045b
Signed-off-by: Dmitrii Filippov <dmfilippov@google.com>
Diffstat (limited to '.mailmap')
0 files changed, 0 insertions, 0 deletions