Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion merge-ort.c
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,8 @@ static int process_renames(struct merge_options *opt,
}
}

assert(source_deleted || oldinfo->filemask & old_sidemask);
assert(source_deleted || oldinfo->filemask & old_sidemask ||
!strcmp(pair->one->path, pair->two->path));

/* Need to check for special types of rename conflicts... */
if (collision && !source_deleted) {
Expand Down
41 changes: 41 additions & 0 deletions t/t6423-merge-rename-directories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5360,6 +5360,47 @@ test_expect_merge_algorithm failure success '12m: Change parent of renamed-dir t
)
'

test_setup_12n () {
git init 12n &&
(
cd 12n &&

mkdir tools &&
echo hello >tools/hello &&
git add tools/hello &&
git commit -m "O" &&

git branch O &&
git branch A &&
git branch B &&

git switch A &&
echo world >world &&
git add world &&
git commit -q world -m 'Add world' &&

git mv world tools/world &&
git commit -m "Move world into tools/" &&

git switch B &&
git mv tools/hello hello &&
git commit -m "Move hello from tools/ to toplevel"
)
}

test_expect_success '12n: Directory rename transitively makes rename back to self' '
test_setup_12n &&
(
cd 12n &&

git checkout -q B^0 &&

test_must_fail git cherry-pick A^0 >out &&
grep "CONFLICT (file location).*should perhaps be moved" out
)
'


###########################################################################
# SECTION 13: Checking informational and conflict messages
#
Expand Down
Loading