git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/6] Add merge recursive testcases with undetected conflicts
@ 2018-07-01  4:11 Elijah Newren
  2018-07-01  4:11 ` [PATCH 1/6] t6036: add a failed conflict detection case with symlink modify/modify Elijah Newren
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

SPOILER ALERT: This series contains answers to the "fun puzzle" at
  https://public-inbox.org/git/CABPp-BFc1OLYKzS5rauOehvEugPc0oGMJp-NMEAmVMW7QR=4Eg@mail.gmail.com/

When a merge succeeds, we expect the resulting contents to depend only
upon the trees and blobs of the branches involved and of their merge
base(s).  Unfortunately, there are currently about half a dozen cases
where the contents of a "successful" merge depend on the relative
commit timestamps of the merge bases.  Document these with testcases.

(This series came out of looking at modifying how file collision
conflict types are handled, as discussed at [1].  I discovered these
issues while working on that topic.)

[1] https://public-inbox.org/git/CAPc5daVu8vv9RdGON8JiXEO3ycDVqQ38ySzZc-cpo+AQcAKXjA@mail.gmail.com/

Elijah Newren (6):
  t6036: add a failed conflict detection case with symlink modify/modify
  t6036: add a failed conflict detection case with symlink add/add
  t6036: add a failed conflict detection case with submodule
    modify/modify
  t6036: add a failed conflict detection case with submodule add/add
  t6036: add a failed conflict detection case with conflicting types
  t6036: add a failed conflict detection case: regular files, different
    modes

 t/t6036-recursive-corner-cases.sh | 451 ++++++++++++++++++++++++++++++
 1 file changed, 451 insertions(+)

-- 
2.18.0.130.gd703bbb5d

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] t6036: add a failed conflict detection case with symlink modify/modify
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
@ 2018-07-01  4:11 ` Elijah Newren
  2018-07-01  4:11 ` [PATCH 2/6] t6036: add a failed conflict detection case with symlink add/add Elijah Newren
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 67 +++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index b5621303d..4a94fa5ba 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -805,4 +805,71 @@ test_expect_success 'virtual merge base handles rename/rename(1to2)/add-dest' '
 	)
 '
 
+#
+# criss-cross with modify/modify on a symlink:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: simple simlink fickle->lagoon
+#   Commit B: redirect fickle->disneyland
+#   Commit C: redirect fickle->home
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious modify/modify conflict for the symlink 'fickle'.  Can
+# git detect it?
+
+test_expect_success 'setup symlink modify/modify' '
+	test_create_repo symlink-modify-modify &&
+	(
+		cd symlink-modify-modify &&
+
+		test_ln_s_add lagoon fickle &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		git rm fickle &&
+		test_ln_s_add disneyland fickle &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		git rm fickle &&
+		test_ln_s_add home fickle &&
+		git add fickle &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check symlink modify/modify' '
+	(
+		cd symlink-modify-modify &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 3 out &&
+		git ls-files -u >out &&
+		test_line_count = 3 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] t6036: add a failed conflict detection case with symlink add/add
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
  2018-07-01  4:11 ` [PATCH 1/6] t6036: add a failed conflict detection case with symlink modify/modify Elijah Newren
@ 2018-07-01  4:11 ` Elijah Newren
  2018-07-01  4:11 ` [PATCH 3/6] t6036: add a failed conflict detection case with submodule modify/modify Elijah Newren
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 66 +++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index 4a94fa5ba..0ba04d46d 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -872,4 +872,70 @@ test_expect_failure 'check symlink modify/modify' '
 	)
 '
 
+#
+# criss-cross with add/add of a symlink:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: No symlink or path exists yet
+#   Commit B: set up symlink: fickle->disneyland
+#   Commit C: set up symlink: fickle->home
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious add/add conflict for the symlink 'fickle'.  Can
+# git detect it?
+
+test_expect_success 'setup symlink add/add' '
+	test_create_repo symlink-add-add &&
+	(
+		cd symlink-add-add &&
+
+		touch ignoreme &&
+		git add ignoreme &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		test_ln_s_add disneyland fickle &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		test_ln_s_add home fickle &&
+		git add fickle &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check symlink add/add' '
+	(
+		cd symlink-add-add &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 2 out &&
+		git ls-files -u >out &&
+		test_line_count = 2 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] t6036: add a failed conflict detection case with submodule modify/modify
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
  2018-07-01  4:11 ` [PATCH 1/6] t6036: add a failed conflict detection case with symlink modify/modify Elijah Newren
  2018-07-01  4:11 ` [PATCH 2/6] t6036: add a failed conflict detection case with symlink add/add Elijah Newren
@ 2018-07-01  4:11 ` Elijah Newren
  2018-07-01  4:11 ` [PATCH 4/6] t6036: add a failed conflict detection case with submodule add/add Elijah Newren
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 88 +++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index 0ba04d46d..0c8f81331 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -938,4 +938,92 @@ test_expect_failure 'check symlink add/add' '
 	)
 '
 
+#
+# criss-cross with modify/modify on a submodule:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: simple submodule repo
+#   Commit B: update repo
+#   Commit C: update repo differently
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious modify/modify conflict for the submodule 'repo'.  Can
+# git detect it?
+
+test_expect_success 'setup submodule modify/modify' '
+	test_create_repo submodule-modify-modify &&
+	(
+		cd submodule-modify-modify &&
+
+		test_create_repo submod &&
+		(
+			cd submod &&
+			touch file-A &&
+			git add file-A &&
+			git commit -m A &&
+			git tag A &&
+
+			git checkout -b B A &&
+			touch file-B &&
+			git add file-B &&
+			git commit -m B &&
+			git tag B &&
+
+			git checkout -b C A &&
+			touch file-C &&
+			git add file-C &&
+			git commit -m C &&
+			git tag C
+		) &&
+
+		git -C submod reset --hard A &&
+		git add submod &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		git -C submod reset --hard B &&
+		git add submod &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		git -C submod reset --hard C &&
+		git add submod &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check submodule modify/modify' '
+	(
+		cd submodule-modify-modify &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 3 out &&
+		git ls-files -u >out &&
+		test_line_count = 3 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] t6036: add a failed conflict detection case with submodule add/add
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
                   ` (2 preceding siblings ...)
  2018-07-01  4:11 ` [PATCH 3/6] t6036: add a failed conflict detection case with submodule modify/modify Elijah Newren
@ 2018-07-01  4:11 ` Elijah Newren
  2018-07-01  4:11 ` [PATCH 5/6] t6036: add a failed conflict detection case with conflicting types Elijah Newren
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 88 +++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index 0c8f81331..e920c7505 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1026,4 +1026,92 @@ test_expect_failure 'check submodule modify/modify' '
 	)
 '
 
+#
+# criss-cross with add/add on a submodule:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: nothing of note
+#   Commit B: introduce submodule repo
+#   Commit C: introduce submodule repo at different commit
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious add/add conflict for the submodule 'repo'.  Can
+# git detect it?
+
+test_expect_success 'setup submodule add/add' '
+	test_create_repo submodule-add-add &&
+	(
+		cd submodule-add-add &&
+
+		test_create_repo submod &&
+		(
+			cd submod &&
+			touch file-A &&
+			git add file-A &&
+			git commit -m A &&
+			git tag A &&
+
+			git checkout -b B A &&
+			touch file-B &&
+			git add file-B &&
+			git commit -m B &&
+			git tag B &&
+
+			git checkout -b C A &&
+			touch file-C &&
+			git add file-C &&
+			git commit -m C &&
+			git tag C
+		) &&
+
+		touch irrelevant-file &&
+		git add irrelevant-file &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		git -C submod reset --hard B &&
+		git add submod &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		git -C submod reset --hard C &&
+		git add submod &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check submodule add/add' '
+	(
+		cd submodule-add-add &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 3 out &&
+		git ls-files -u >out &&
+		test_line_count = 2 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] t6036: add a failed conflict detection case with conflicting types
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
                   ` (3 preceding siblings ...)
  2018-07-01  4:11 ` [PATCH 4/6] t6036: add a failed conflict detection case with submodule add/add Elijah Newren
@ 2018-07-01  4:11 ` Elijah Newren
  2018-07-01  4:11 ` [PATCH 6/6] t6036: add a failed conflict detection case: regular files, different modes Elijah Newren
  2018-07-09 17:53 ` [PATCH 0/6] Add merge recursive testcases with undetected conflicts Junio C Hamano
  6 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 75 +++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index e920c7505..8b997d7e5 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1114,4 +1114,79 @@ test_expect_failure 'check submodule add/add' '
 	)
 '
 
+#
+# criss-cross with conflicting entry types:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: nothing of note
+#   Commit B: introduce submodule 'path'
+#   Commit C: introduce symlink 'path'
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious add/add conflict for 'path'.  Can git detect it?
+
+test_expect_success 'setup conflicting entry types (submodule vs symlink)' '
+	test_create_repo submodule-symlink-add-add &&
+	(
+		cd submodule-symlink-add-add &&
+
+		test_create_repo path &&
+		(
+			cd path &&
+			touch file-B &&
+			git add file-B &&
+			git commit -m B &&
+			git tag B
+		) &&
+
+		touch irrelevant-file &&
+		git add irrelevant-file &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		git -C path reset --hard B &&
+		git add path &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		rm -rf path/ &&
+		test_ln_s_add irrelevant-file path &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check conflicting entry types (submodule vs symlink)' '
+	(
+		cd submodule-symlink-add-add &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 3 out &&
+		git ls-files -u >out &&
+		test_line_count = 2 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] t6036: add a failed conflict detection case: regular files, different modes
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
                   ` (4 preceding siblings ...)
  2018-07-01  4:11 ` [PATCH 5/6] t6036: add a failed conflict detection case with conflicting types Elijah Newren
@ 2018-07-01  4:11 ` Elijah Newren
  2018-07-09 17:53 ` [PATCH 0/6] Add merge recursive testcases with undetected conflicts Junio C Hamano
  6 siblings, 0 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-01  4:11 UTC (permalink / raw)
  To: git; +Cc: gitster, Elijah Newren

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t6036-recursive-corner-cases.sh | 67 +++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index 8b997d7e5..f8f7b3046 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1189,4 +1189,71 @@ test_expect_failure 'check conflicting entry types (submodule vs symlink)' '
 	)
 '
 
+#
+# criss-cross with regular files that have conflicting modes:
+#
+#      B   D
+#      o---o
+#     / \ / \
+#  A o   X   ? F
+#     \ / \ /
+#      o---o
+#      C   E
+#
+#   Commit A: nothing of note
+#   Commit B: introduce file source_me.bash, not executable
+#   Commit C: introduce file source_me.bash, executable
+#   Commit D: merge B&C, resolving in favor of B
+#   Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious add/add mode conflict.  Can git detect it?
+
+test_expect_success 'setup conflicting modes for regular file' '
+	test_create_repo regular-file-mode-conflict &&
+	(
+		cd regular-file-mode-conflict &&
+
+		touch irrelevant-file &&
+		git add irrelevant-file &&
+		git commit -m A &&
+		git tag A &&
+
+		git checkout -b B A &&
+		echo "export PATH=~/bin:$PATH" >source_me.bash &&
+		git add source_me.bash &&
+		git commit -m B &&
+
+		git checkout -b C A &&
+		echo "export PATH=~/bin:$PATH" >source_me.bash &&
+		git add source_me.bash &&
+		test_chmod +x source_me.bash &&
+		git commit -m C &&
+
+		git checkout -q B^0 &&
+		git merge -s ours -m D C^0 &&
+		git tag D &&
+
+		git checkout -q C^0 &&
+		git merge -s ours -m E B^0 &&
+		git tag E
+	)
+'
+
+test_expect_failure 'check conflicting modes for regular file' '
+	(
+		cd regular-file-mode-conflict &&
+
+		git checkout D^0 &&
+
+		test_must_fail git merge -s recursive E^0 &&
+
+		git ls-files -s >out &&
+		test_line_count = 3 out &&
+		git ls-files -u >out &&
+		test_line_count = 2 out &&
+		git ls-files -o >out &&
+		test_line_count = 1 out
+	)
+'
+
 test_done
-- 
2.18.0.130.gd703bbb5d


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
                   ` (5 preceding siblings ...)
  2018-07-01  4:11 ` [PATCH 6/6] t6036: add a failed conflict detection case: regular files, different modes Elijah Newren
@ 2018-07-09 17:53 ` Junio C Hamano
  2018-07-09 20:22   ` Elijah Newren
  6 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2018-07-09 17:53 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git

Elijah Newren <newren@gmail.com> writes:

> SPOILER ALERT: This series contains answers to the "fun puzzle" at
>   https://public-inbox.org/git/CABPp-BFc1OLYKzS5rauOehvEugPc0oGMJp-NMEAmVMW7QR=4Eg@mail.gmail.com/
>
> When a merge succeeds, we expect the resulting contents to depend only
> upon the trees and blobs of the branches involved and of their merge
> base(s).  Unfortunately, there are currently about half a dozen cases
> where the contents of a "successful" merge depend on the relative
> commit timestamps of the merge bases.  Document these with testcases.
>
> (This series came out of looking at modifying how file collision
> conflict types are handled, as discussed at [1].  I discovered these
> issues while working on that topic.)

I have a topic branch for this series but not merged to 'pu' as
test-lint gives these:

t6036-recursive-corner-cases.sh:1222: error: "export FOO=bar" is not portable (please use FOO=bar && export FOO): 		echo "export PATH=~/bin:$PATH" >source_me.bash &&
t6036-recursive-corner-cases.sh:1227: error: "export FOO=bar" is not portable (please use FOO=bar && export FOO): 		echo "export PATH=~/bin:$PATH" >source_me.bash &&
Makefile:77: recipe for target 'test-lint-shell-syntax' failed
make: *** [test-lint-shell-syntax] Error 1

Arguably these are false positives because "source_me.bash" file is
a mere payload to go through the merge process to be munged and we
never intend to actually execute its contents with bash, but then
the test payload probably does not even have to be a string that
triggers such a false positive to begin with ;-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-09 17:53 ` [PATCH 0/6] Add merge recursive testcases with undetected conflicts Junio C Hamano
@ 2018-07-09 20:22   ` Elijah Newren
  2018-07-10  4:44     ` Jeff King
  2018-07-11  4:02     ` Elijah Newren
  0 siblings, 2 replies; 14+ messages in thread
From: Elijah Newren @ 2018-07-09 20:22 UTC (permalink / raw)
  To: gitster; +Cc: git, Elijah Newren

On Mon, Jul 9, 2018 at 10:53 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Elijah Newren <newren@gmail.com> writes:
>
>> When a merge succeeds, we expect the resulting contents to depend only
>> upon the trees and blobs of the branches involved and of their merge
>> base(s).  Unfortunately, there are currently about half a dozen cases
>> where the contents of a "successful" merge depend on the relative
>> commit timestamps of the merge bases.  Document these with testcases.
>>
>> (This series came out of looking at modifying how file collision
>> conflict types are handled, as discussed at [1].  I discovered these
>> issues while working on that topic.)
>
> I have a topic branch for this series but not merged to 'pu' as
> test-lint gives these:
>
> t6036-recursive-corner-cases.sh:1222: error: "export FOO=bar" is not portable (please use FOO=bar && export FOO):               echo "export PATH=~/bin:$PATH" >source_me.bash &&
> t6036-recursive-corner-cases.sh:1227: error: "export FOO=bar" is not portable (please use FOO=bar && export FOO):               echo "export PATH=~/bin:$PATH" >source_me.bash &&
> Makefile:77: recipe for target 'test-lint-shell-syntax' failed
> make: *** [test-lint-shell-syntax] Error 1
>
> Arguably these are false positives because "source_me.bash" file is
> a mere payload to go through the merge process to be munged and we
> never intend to actually execute its contents with bash, but then
> the test payload probably does not even have to be a string that
> triggers such a false positive to begin with ;-)

Oh, I didn't know about test-lint.  Is there a place that documents the various checks you run, so I can avoid slowing you down?  Ones I know about:

Already documented:
  * `make DEVELOPER=1` (from CodingGuidelines)
  * running tests (from SubmittingPatches)

Stuff I've seen you mention in emails over time:
  * linux/scripts/checkpatch.pl
  * git grep -e '\<inline\>' --and --not -e 'static inline' -- \*.h
  * make -C t/ test-lint

Are there others?


Also, here's a fixup to the topic; as you pointed out, the exact contents
of the script being written were actually irrelevant; it was just an
input to a merge.

-- 8< --
Subject: [PATCH] fixup! t6036: add a failed conflict detection case: regular
 files, different modes

---
 t/t6036-recursive-corner-cases.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index f8f7b30460..5a8fe061ab 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1219,12 +1219,12 @@ test_expect_success 'setup conflicting modes for regular file' '
 		git tag A &&
 
 		git checkout -b B A &&
-		echo "export PATH=~/bin:$PATH" >source_me.bash &&
+		echo "command_to_run" >source_me.bash &&
 		git add source_me.bash &&
 		git commit -m B &&
 
 		git checkout -b C A &&
-		echo "export PATH=~/bin:$PATH" >source_me.bash &&
+		echo "command_to_run" >source_me.bash &&
 		git add source_me.bash &&
 		test_chmod +x source_me.bash &&
 		git commit -m C &&
-- 
2.18.0.135.gd4ea5491ab


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-09 20:22   ` Elijah Newren
@ 2018-07-10  4:44     ` Jeff King
  2018-07-10 15:42       ` Elijah Newren
  2018-07-11  4:02     ` Elijah Newren
  1 sibling, 1 reply; 14+ messages in thread
From: Jeff King @ 2018-07-10  4:44 UTC (permalink / raw)
  To: Elijah Newren; +Cc: Stefan Beller, gitster, git

On Mon, Jul 09, 2018 at 01:22:29PM -0700, Elijah Newren wrote:

> Oh, I didn't know about test-lint.  Is there a place that documents
> the various checks you run, so I can avoid slowing you down?  Ones I
> know about:
> 
> Already documented:
>   * `make DEVELOPER=1` (from CodingGuidelines)
>   * running tests (from SubmittingPatches)
> 
> Stuff I've seen you mention in emails over time:
>   * linux/scripts/checkpatch.pl
>   * git grep -e '\<inline\>' --and --not -e 'static inline' -- \*.h
>   * make -C t/ test-lint

test-lint is supposed to be run automatically as part of "make test" (or
"make prove"), unless you've specifically disabled it by setting
TEST_LINT. And it does complain for me with your patches. If it doesn't
for you, then we have a bug to fix. :)

I won't be surprised, though, if you just ran "./t6036" manually before
sending, since your patches literally didn't touch any other files.

In theory we could push some of the linting down into the test scripts
themselves (some of it, like the &&-linter, is there already by
necessity). But it might also end up annoying, since usually dropping
down to manual single-test runs means you're trying to debug something,
and extra linting processes could get in the way.

> Are there others?

I like:

  make SANITIZE=address,undefined test

though it's pretty heavy-weight (but not nearly as much as valgrind).
You probably also need BLK_SHA1=Yes, since the default DC_SHA1 has some
unaligned loads that make UBSan complain. We should maybe teach the
Makefile to do that by default.

I've also been playing with clang's scan-build. It _did_ find a real bug
recently, but it has a bunch of false positives.

Stefan runs Coverity against pu periodically. IIRC It's a pain to run
yourself, but the shared results can be mailed to you, or you can poke
around at https://scan.coverity.com/projects/git. That _also_ has a ton
of false positives, but it's good about cataloguing them so the periodic
email usually just mentions the new ones.

-Peff

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-10  4:44     ` Jeff King
@ 2018-07-10 15:42       ` Elijah Newren
  2018-07-10 17:19         ` Jeff King
  0 siblings, 1 reply; 14+ messages in thread
From: Elijah Newren @ 2018-07-10 15:42 UTC (permalink / raw)
  To: Jeff King; +Cc: Stefan Beller, Junio C Hamano, Git Mailing List

On Mon, Jul 9, 2018 at 9:44 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Jul 09, 2018 at 01:22:29PM -0700, Elijah Newren wrote:
>
>> Oh, I didn't know about test-lint.  Is there a place that documents
>> the various checks you run, so I can avoid slowing you down?  Ones I
>> know about:
>>
>> Already documented:
>>   * `make DEVELOPER=1` (from CodingGuidelines)
>>   * running tests (from SubmittingPatches)
>>
>> Stuff I've seen you mention in emails over time:
>>   * linux/scripts/checkpatch.pl
>>   * git grep -e '\<inline\>' --and --not -e 'static inline' -- \*.h
>>   * make -C t/ test-lint
>
> test-lint is supposed to be run automatically as part of "make test" (or
> "make prove"), unless you've specifically disabled it by setting
> TEST_LINT. And it does complain for me with your patches. If it doesn't
> for you, then we have a bug to fix. :)

Oh, this may be my bad.  Years ago someone pointed out that the
testsuite could be run under 'prove', which provided nicer output and
made sure to run the longest tests (e.g. the horrifically slow
t9001-send-email.sh) first.  So my test alias is:

   time prove -j7 --timer --state failed,slow,save t[0-9]*.sh ::
"--root=/dev/shm"

(with possibly different -j settings on different machines) and I just
stopped running make test.  Didn't learn about the 'make prove'
target, even though it's apparently now been there for nearly 8 years.

> I won't be surprised, though, if you just ran "./t6036" manually before
> sending, since your patches literally didn't touch any other files.

That may also be true, though I would have missed it even if I had
code changes due to not being aware of 'make prove'.

> In theory we could push some of the linting down into the test scripts
> themselves (some of it, like the &&-linter, is there already by
> necessity). But it might also end up annoying, since usually dropping
> down to manual single-test runs means you're trying to debug something,
> and extra linting processes could get in the way.
>
>> Are there others?
>
> I like:
>
>   make SANITIZE=address,undefined test
>
> though it's pretty heavy-weight (but not nearly as much as valgrind).
> You probably also need BLK_SHA1=Yes, since the default DC_SHA1 has some
> unaligned loads that make UBSan complain. We should maybe teach the
> Makefile to do that by default.
>
> I've also been playing with clang's scan-build. It _did_ find a real bug
> recently, but it has a bunch of false positives.
>
> Stefan runs Coverity against pu periodically. IIRC It's a pain to run
> yourself, but the shared results can be mailed to you, or you can poke
> around at https://scan.coverity.com/projects/git. That _also_ has a ton
> of false positives, but it's good about cataloguing them so the periodic
> email usually just mentions the new ones.

Cool, thanks for the pointers.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-10 15:42       ` Elijah Newren
@ 2018-07-10 17:19         ` Jeff King
  0 siblings, 0 replies; 14+ messages in thread
From: Jeff King @ 2018-07-10 17:19 UTC (permalink / raw)
  To: Elijah Newren; +Cc: Stefan Beller, Junio C Hamano, Git Mailing List

On Tue, Jul 10, 2018 at 08:42:04AM -0700, Elijah Newren wrote:

> > test-lint is supposed to be run automatically as part of "make test" (or
> > "make prove"), unless you've specifically disabled it by setting
> > TEST_LINT. And it does complain for me with your patches. If it doesn't
> > for you, then we have a bug to fix. :)
> 
> Oh, this may be my bad.  Years ago someone pointed out that the
> testsuite could be run under 'prove', which provided nicer output and
> made sure to run the longest tests (e.g. the horrifically slow
> t9001-send-email.sh) first.  So my test alias is:
> 
>    time prove -j7 --timer --state failed,slow,save t[0-9]*.sh ::
> "--root=/dev/shm"

Heh, OK, that makes sense.

> (with possibly different -j settings on different machines) and I just
> stopped running make test.  Didn't learn about the 'make prove'
> target, even though it's apparently now been there for nearly 8 years.

I have:

  GIT_TEST_OPTS = --root=/var/ram/git-tests
  GIT_PROVE_OPTS = -j16 --state=slow,save
  DEFAULT_TEST_TARGET = prove

in my config.mak. That lets me just do:

  make test

from the top-level to get a build-and-test. It also allows just "make"
from the "t" directory to do the right thing.  Slightly annoyingly,
"make test" in the "t" directory does the wrong thing, which bites me
about once a month. ;)

-Peff

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-09 20:22   ` Elijah Newren
  2018-07-10  4:44     ` Jeff King
@ 2018-07-11  4:02     ` Elijah Newren
  2018-07-11 15:40       ` Junio C Hamano
  1 sibling, 1 reply; 14+ messages in thread
From: Elijah Newren @ 2018-07-11  4:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Mon, Jul 9, 2018 at 1:22 PM, Elijah Newren <newren@gmail.com> wrote:
> On Mon, Jul 9, 2018 at 10:53 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Elijah Newren <newren@gmail.com> writes:
>>
>>> When a merge succeeds, we expect the resulting contents to depend only
>>> upon the trees and blobs of the branches involved and of their merge
>>> base(s).  Unfortunately, there are currently about half a dozen cases
>>> where the contents of a "successful" merge depend on the relative
>>> commit timestamps of the merge bases.  Document these with testcases.
>>>
>>> (This series came out of looking at modifying how file collision
>>> conflict types are handled, as discussed at [1].  I discovered these
>>> issues while working on that topic.)
>>
>> I have a topic branch for this series but not merged to 'pu' as
>> test-lint gives these:
>>
...
>
> ... here's a fixup to the topic; as you pointed out, the exact contents
> of the script being written were actually irrelevant; it was just an
> input to a merge.
>
> -- 8< --
> Subject: [PATCH] fixup! t6036: add a failed conflict detection case: regular
>  files, different modes
>

Does a 'fixup!' commit require a Signed-off-by?  Just realized that
this one didn't have it, though I don't know if it's necessary.  If it
is:

Signed-off-by: Elijah Newren <newren@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add merge recursive testcases with undetected conflicts
  2018-07-11  4:02     ` Elijah Newren
@ 2018-07-11 15:40       ` Junio C Hamano
  0 siblings, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2018-07-11 15:40 UTC (permalink / raw)
  To: Elijah Newren; +Cc: Git Mailing List

Elijah Newren <newren@gmail.com> writes:

> On Mon, Jul 9, 2018 at 1:22 PM, Elijah Newren <newren@gmail.com> wrote:
>> On Mon, Jul 9, 2018 at 10:53 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Elijah Newren <newren@gmail.com> writes:
>>>
>>>> When a merge succeeds, we expect the resulting contents to depend only
>>>> upon the trees and blobs of the branches involved and of their merge
>>>> base(s).  Unfortunately, there are currently about half a dozen cases
>>>> where the contents of a "successful" merge depend on the relative
>>>> commit timestamps of the merge bases.  Document these with testcases.
>>>>
>>>> (This series came out of looking at modifying how file collision
>>>> conflict types are handled, as discussed at [1].  I discovered these
>>>> issues while working on that topic.)
>>>
>>> I have a topic branch for this series but not merged to 'pu' as
>>> test-lint gives these:
>>>
> ...
>>
>> ... here's a fixup to the topic; as you pointed out, the exact contents
>> of the script being written were actually irrelevant; it was just an
>> input to a merge.
>>
>> -- 8< --
>> Subject: [PATCH] fixup! t6036: add a failed conflict detection case: regular
>>  files, different modes
>>
>
> Does a 'fixup!' commit require a Signed-off-by?  Just realized that
> this one didn't have it, though I don't know if it's necessary.  If it
> is:
>
> Signed-off-by: Elijah Newren <newren@gmail.com>

Thanks.  I queued it separately before running out of time Monday,
but will actually squash it in to the main patch.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-07-11 15:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01  4:11 [PATCH 0/6] Add merge recursive testcases with undetected conflicts Elijah Newren
2018-07-01  4:11 ` [PATCH 1/6] t6036: add a failed conflict detection case with symlink modify/modify Elijah Newren
2018-07-01  4:11 ` [PATCH 2/6] t6036: add a failed conflict detection case with symlink add/add Elijah Newren
2018-07-01  4:11 ` [PATCH 3/6] t6036: add a failed conflict detection case with submodule modify/modify Elijah Newren
2018-07-01  4:11 ` [PATCH 4/6] t6036: add a failed conflict detection case with submodule add/add Elijah Newren
2018-07-01  4:11 ` [PATCH 5/6] t6036: add a failed conflict detection case with conflicting types Elijah Newren
2018-07-01  4:11 ` [PATCH 6/6] t6036: add a failed conflict detection case: regular files, different modes Elijah Newren
2018-07-09 17:53 ` [PATCH 0/6] Add merge recursive testcases with undetected conflicts Junio C Hamano
2018-07-09 20:22   ` Elijah Newren
2018-07-10  4:44     ` Jeff King
2018-07-10 15:42       ` Elijah Newren
2018-07-10 17:19         ` Jeff King
2018-07-11  4:02     ` Elijah Newren
2018-07-11 15:40       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).