Re: [PATCH 1/4] add -p: demonstrate failure when running 'edit' after a split

2015-04-14 Thread Eric Sunshine
On Tue, Apr 14, 2015 at 7:32 AM, Matthieu Moy  wrote:
> The test passes if one replaces the 'e' command with a 'y' command in
> the 'add -p' session.
>
> Reported-by: Tanky Woo 
> Signed-off-by: Matthieu Moy 
> ---
> diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
> index 24ddd8a..b48a75c 100755
> --- a/t/t3701-add-interactive.sh
> +++ b/t/t3701-add-interactive.sh
> @@ -335,6 +335,31 @@ test_expect_success 'split hunk "add -p (edit)"' '
> ! grep "^+15" actual
>  '
>
> +test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
> +   cat >test <<-\EOF &&
> +   5
> +   10
> +   20
> +   21
> +   30
> +   31
> +   40
> +   50
> +   60
> +   EOF
> +   git reset &&
> +   # test sequence is s(plit), n(o), y(es), e(dit)
> +   # q n q q is there to make sure we exit at the end.
> +   for a in s n y e   q n q q
> +   do
> +   echo $a
> +   done |

Simplified:

printf '%s\n' s n y e q n q q |

> +   EDITOR=: git add -p 2>error &&
> +   test_must_be_empty error &&
> +   git diff >actual &&
> +   ! grep "^+31" actual
> +'
> +
>  test_expect_success 'patch mode ignores unmerged entries' '
> git reset --hard &&
> test_commit conflict &&
> --
> 2.4.0.rc1.42.g9642cc6
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] add -p: demonstrate failure when running 'edit' after a split

2015-04-14 Thread Matthieu Moy
The test passes if one replaces the 'e' command with a 'y' command in
the 'add -p' session.

Reported-by: Tanky Woo 
Signed-off-by: Matthieu Moy 
---
 t/t3701-add-interactive.sh | 25 +
 1 file changed, 25 insertions(+)

diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 24ddd8a..b48a75c 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -335,6 +335,31 @@ test_expect_success 'split hunk "add -p (edit)"' '
! grep "^+15" actual
 '
 
+test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
+   cat >test <<-\EOF &&
+   5
+   10
+   20
+   21
+   30
+   31
+   40
+   50
+   60
+   EOF
+   git reset &&
+   # test sequence is s(plit), n(o), y(es), e(dit)
+   # q n q q is there to make sure we exit at the end.
+   for a in s n y e   q n q q
+   do
+   echo $a
+   done |
+   EDITOR=: git add -p 2>error &&
+   test_must_be_empty error &&
+   git diff >actual &&
+   ! grep "^+31" actual
+'
+
 test_expect_success 'patch mode ignores unmerged entries' '
git reset --hard &&
test_commit conflict &&
-- 
2.4.0.rc1.42.g9642cc6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html