summaryrefslogtreecommitdiff
path: root/t/t6046-merge-skip-unneeded-updates.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-02-27 00:14:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-27 19:01:48 (GMT)
commit9f697ded88286804683ab2988abed23b4c63f530 (patch)
treeb799cd4b4087b4efe7713c08effe4e7f34d75e3c /t/t6046-merge-skip-unneeded-updates.sh
parentd5bb92ecede53ee8e22c13bc5d86b6a2bc620bb7 (diff)
downloadgit-9f697ded88286804683ab2988abed23b4c63f530.zip
git-9f697ded88286804683ab2988abed23b4c63f530.tar.gz
git-9f697ded88286804683ab2988abed23b4c63f530.tar.bz2
t6022, t6046: test expected behavior instead of testing a proxy for it
In t6022, we were testing for file being overwritten (or not) based on an output message instead of checking for the file being overwritten. Since we can check for the file being overwritten via mtime updates, check that instead. In t6046, we were largely checking for both the expected behavior and a proxy for it, which is unnecessary. The calls to test-tool also were a bit cryptic. Make them a little clearer. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6046-merge-skip-unneeded-updates.sh')
-rwxr-xr-xt/t6046-merge-skip-unneeded-updates.sh89
1 files changed, 57 insertions, 32 deletions
diff --git a/t/t6046-merge-skip-unneeded-updates.sh b/t/t6046-merge-skip-unneeded-updates.sh
index b7e4669..962030e 100755
--- a/t/t6046-merge-skip-unneeded-updates.sh
+++ b/t/t6046-merge-skip-unneeded-updates.sh
@@ -71,16 +71,16 @@ test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' '
git checkout A^0 &&
- test-tool chmtime =31337 b &&
- test-tool chmtime -v +0 b >expected-mtime &&
+ test-tool chmtime =-1 b &&
+ test-tool chmtime --get b >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
- test_i18ngrep "Skipped b" out &&
test_must_be_empty err &&
- test-tool chmtime -v +0 b >actual-mtime &&
- test_cmp expected-mtime actual-mtime &&
+ # Make sure b was NOT updated
+ test-tool chmtime --get b >new-mtime &&
+ test_cmp old-mtime new-mtime &&
git ls-files -s >index_files &&
test_line_count = 1 index_files &&
@@ -102,9 +102,14 @@ test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' '
git checkout B^0 &&
+ test-tool chmtime =-1 b &&
+ test-tool chmtime --get b >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
- test_i18ngrep "Auto-merging b" out &&
+ # Make sure b WAS updated
+ test-tool chmtime --get b >new-mtime &&
+ test $(cat old-mtime) -lt $(cat new-mtime) &&
+
test_must_be_empty err &&
git ls-files -s >index_files &&
@@ -165,10 +170,10 @@ test_expect_success '2a-L: Modify/rename, merge into modify side' '
git checkout A^0 &&
+ test_path_is_missing c &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
- test_i18ngrep ! "Skipped c" out &&
- test_must_be_empty err &&
+ test_path_is_file c &&
git ls-files -s >index_files &&
test_line_count = 1 index_files &&
@@ -193,9 +198,14 @@ test_expect_success '2a-R: Modify/rename, merge into rename side' '
git checkout B^0 &&
+ test-tool chmtime =-1 c &&
+ test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
- test_i18ngrep ! "Skipped c" out &&
+ # Make sure c WAS updated
+ test-tool chmtime --get c >new-mtime &&
+ test $(cat old-mtime) -lt $(cat new-mtime) &&
+
test_must_be_empty err &&
git ls-files -s >index_files &&
@@ -256,16 +266,15 @@ test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
git checkout A^0 &&
- test-tool chmtime =31337 c &&
- test-tool chmtime -v +0 c >expected-mtime &&
-
+ test-tool chmtime =-1 c &&
+ test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
- test_i18ngrep "Skipped c" out &&
test_must_be_empty err &&
- test-tool chmtime -v +0 c >actual-mtime &&
- test_cmp expected-mtime actual-mtime &&
+ # Make sure c WAS updated
+ test-tool chmtime --get c >new-mtime &&
+ test_cmp old-mtime new-mtime &&
git ls-files -s >index_files &&
test_line_count = 1 index_files &&
@@ -290,9 +299,12 @@ test_expect_success '2b-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
git checkout B^0 &&
+ test_path_is_missing c &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
- test_i18ngrep "Auto-merging c" out &&
+ # Make sure c now present (and thus was updated)
+ test_path_is_file c &&
+
test_must_be_empty err &&
git ls-files -s >index_files &&
@@ -361,13 +373,18 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
git checkout A^0 &&
+ test-tool chmtime =-1 c &&
+ test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 &&
export GIT_MERGE_VERBOSITY &&
test_must_fail git merge -s recursive B^0 >out 2>err &&
test_i18ngrep "CONFLICT (rename/add): Rename b->c" out &&
- test_i18ngrep ! "Skipped c" out &&
- test_must_be_empty err
+ test_must_be_empty err &&
+
+ # Make sure c WAS updated
+ test-tool chmtime --get c >new-mtime &&
+ test $(cat old-mtime) -lt $(cat new-mtime)
# FIXME: rename/add conflicts are horribly broken right now;
# when I get back to my patch series fixing it and
@@ -460,11 +477,13 @@ test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
git checkout A^0 &&
+ test_path_is_missing bar/bq &&
GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- test_i18ngrep ! "Skipped bar/bq" out &&
test_must_be_empty err &&
+ test_path_is_file bar/bq &&
+
git ls-files -s >index_files &&
test_line_count = 2 index_files &&
@@ -488,11 +507,13 @@ test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
git checkout B^0 &&
+ test_path_is_missing bar/bq &&
GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err &&
- test_i18ngrep ! "Skipped bar/bq" out &&
test_must_be_empty err &&
+ test_path_is_file bar/bq &&
+
git ls-files -s >index_files &&
test_line_count = 2 index_files &&
@@ -552,11 +573,13 @@ test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
git checkout A^0 &&
+ test_path_is_missing bar/bq &&
GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- test_i18ngrep ! "Skipped bar/bq" out &&
test_must_be_empty err &&
+ test_path_is_file bar/bq &&
+
git ls-files -s >index_files &&
test_line_count = 2 index_files &&
@@ -580,11 +603,13 @@ test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
git checkout B^0 &&
+ test_path_is_missing bar/bq &&
GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err &&
- test_i18ngrep ! "Skipped bar/bq" out &&
test_must_be_empty err &&
+ test_path_is_file bar/bq &&
+
git ls-files -s >index_files &&
test_line_count = 2 index_files &&
@@ -654,16 +679,16 @@ test_expect_failure '4a: Change on A, change on B subset of A, dirty mods presen
git checkout A^0 &&
echo "File rewritten" >b &&
- test-tool chmtime =31337 b &&
- test-tool chmtime -v +0 b >expected-mtime &&
+ test-tool chmtime =-1 b &&
+ test-tool chmtime --get b >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
- test_i18ngrep "Skipped b" out &&
test_must_be_empty err &&
- test-tool chmtime -v +0 b >actual-mtime &&
- test_cmp expected-mtime actual-mtime &&
+ # Make sure b was NOT updated
+ test-tool chmtime --get b >new-mtime &&
+ test_cmp old-mtime new-mtime &&
git ls-files -s >index_files &&
test_line_count = 1 index_files &&
@@ -722,16 +747,16 @@ test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mo
git checkout A^0 &&
echo "File rewritten" >c &&
- test-tool chmtime =31337 c &&
- test-tool chmtime -v +0 c >expected-mtime &&
+ test-tool chmtime =-1 c &&
+ test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
- test_i18ngrep "Skipped c" out &&
test_must_be_empty err &&
- test-tool chmtime -v +0 c >actual-mtime &&
- test_cmp expected-mtime actual-mtime &&
+ # Make sure c was NOT updated
+ test-tool chmtime --get c >new-mtime &&
+ test_cmp old-mtime new-mtime &&
git ls-files -s >index_files &&
test_line_count = 1 index_files &&