@matheusbsbs / matheus-bagliano / commits / 8a35981927
Fork 0

Add a test for merging changed and rename-changed branches

Also leave a warning for future merge-recursive explorers. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alex Riesen committed Apr 25, 2007 at 22:07 UTC 8a359819273a4460d5806d2d5e76cd7993a84843
2 files changed +28
merge-recursive.c
+5
@@ -1345,6 +1345,11 @@ static int process_renames(struct path_list *a_renames,
1345 if (mfi.merge && mfi.clean &&
1346 sha_eq(mfi.sha, ren1->pair->two->sha1) &&
1347 mfi.mode == ren1->pair->two->mode)
1348 + /*
1349 + * This messaged is part of
1350 + * t6022 test. If you change
1351 + * it update the test too.
1352 + */
1353 output(3, "Skipped %s (merged same as existing)", ren1_dst);
1354 else {
1355 if (mfi.merge || !mfi.clean)
t/t6022-merge-rename.sh
+23
@@ -47,6 +47,8 @@ git branch white &&
47 git branch red &&
48 git branch blue &&
49 git branch yellow &&
50 +git branch change &&
51 +git branch change+rename &&
52
53 sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
54 mv A+ A &&
@@ -77,6 +79,17 @@ rm -f A M &&
79 git update-index --add --remove A C M N &&
80 git commit -m "blue renames A->C, M->N" &&
81
82 +git checkout change &&
83 +sed -e "/^g /s/.*/g : changed line/" <A >A+ &&
84 +mv A+ A &&
85 +git commit -q -a -m "changed" &&
86 +
87 +git checkout change+rename &&
88 +sed -e "/^g /s/.*/g : changed line/" <A >B &&
89 +rm A &&
90 +git update-index --add B &&
91 +git commit -q -a -m "changed and renamed" &&
92 +
93 git checkout master'
94
95 test_expect_success 'pull renaming branch into unrenaming one' \
@@ -318,4 +331,14 @@ test_expect_success 'interference with untracked working tree file' '
331 git reset --hard anchor
332 '
333
334 +test_expect_success 'merge of identical changes in a renamed file' '
335 + rm -f A M N
336 + git reset --hard &&
337 + git checkout change+rename &&
338 + GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" &&
339 + git reset --hard HEAD^ &&
340 + git checkout change &&
341 + GIT_MERGE_VERBOSITY=3 git merge change+rename | grep "^Skipped B"
342 +'
343 +
344 test_done