Re: [PATCH v3 2/2] t3200: verify "branch --list" sanity when rebasing from detached HEAD

2018-04-04 Thread Eric Sunshine
On Tue, Apr 3, 2018 at 10:47 AM, Kaartic Sivaraam
 wrote:
> From: Eric Sunshine 
>
> "git branch --list" shows an in-progress rebase as:
>
>   * (no branch, rebasing )
> master
> ...
>
> However, if the rebase is started from a detached HEAD, then there is no
> , and it would attempt to print a NULL pointer. The previous
> commit fixed this problem, so add a test to verify that the output is
> sane in this situation.
>
> Signed-off-by: Eric Sunshine 
> Signed-off-by: Kaartic Sivaraam 

Thanks. This re-roll looks fine.

> ---
>  t/t3200-branch.sh | 24 
>  1 file changed, 24 insertions(+)
>
> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
> index 503a88d02..89fff3fa9 100755
> --- a/t/t3200-branch.sh
> +++ b/t/t3200-branch.sh
> @@ -6,6 +6,7 @@
>  test_description='git branch assorted tests'
>
>  . ./test-lib.sh
> +. "$TEST_DIRECTORY"/lib-rebase.sh
>
>  test_expect_success 'prepare a trivial repository' '
> echo Hello >A &&
> @@ -1246,6 +1247,29 @@ test_expect_success '--merged is incompatible with 
> --no-merged' '
> test_must_fail git branch --merged HEAD --no-merged HEAD
>  '
>
> +test_expect_success '--list during rebase' '
> +   test_when_finished "reset_rebase" &&
> +   git checkout master &&
> +   FAKE_LINES="1 edit 2" &&
> +   export FAKE_LINES &&
> +   set_fake_editor &&
> +   git rebase -i HEAD~2 &&
> +   git branch --list >actual &&
> +   test_i18ngrep "rebasing master" actual
> +'
> +
> +test_expect_success '--list during rebase from detached HEAD' '
> +   test_when_finished "reset_rebase && git checkout master" &&
> +   git checkout master^0 &&
> +   oid=$(git rev-parse --short HEAD) &&
> +   FAKE_LINES="1 edit 2" &&
> +   export FAKE_LINES &&
> +   set_fake_editor &&
> +   git rebase -i HEAD~2 &&
> +   git branch --list >actual &&
> +   test_i18ngrep "rebasing detached HEAD $oid" actual
> +'
> +
>  test_expect_success 'tracking with unexpected .fetch refspec' '
> rm -rf a b c d &&
> git init a &&
> --
> 2.17.0.484.g0c8726318


[PATCH v3 2/2] t3200: verify "branch --list" sanity when rebasing from detached HEAD

2018-04-03 Thread Kaartic Sivaraam
From: Eric Sunshine 

"git branch --list" shows an in-progress rebase as:

  * (no branch, rebasing )
master
...

However, if the rebase is started from a detached HEAD, then there is no
, and it would attempt to print a NULL pointer. The previous
commit fixed this problem, so add a test to verify that the output is
sane in this situation.

Signed-off-by: Eric Sunshine 
Signed-off-by: Kaartic Sivaraam 
---
 t/t3200-branch.sh | 24 
 1 file changed, 24 insertions(+)

diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 503a88d02..89fff3fa9 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -6,6 +6,7 @@
 test_description='git branch assorted tests'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
 
 test_expect_success 'prepare a trivial repository' '
echo Hello >A &&
@@ -1246,6 +1247,29 @@ test_expect_success '--merged is incompatible with 
--no-merged' '
test_must_fail git branch --merged HEAD --no-merged HEAD
 '
 
+test_expect_success '--list during rebase' '
+   test_when_finished "reset_rebase" &&
+   git checkout master &&
+   FAKE_LINES="1 edit 2" &&
+   export FAKE_LINES &&
+   set_fake_editor &&
+   git rebase -i HEAD~2 &&
+   git branch --list >actual &&
+   test_i18ngrep "rebasing master" actual
+'
+
+test_expect_success '--list during rebase from detached HEAD' '
+   test_when_finished "reset_rebase && git checkout master" &&
+   git checkout master^0 &&
+   oid=$(git rev-parse --short HEAD) &&
+   FAKE_LINES="1 edit 2" &&
+   export FAKE_LINES &&
+   set_fake_editor &&
+   git rebase -i HEAD~2 &&
+   git branch --list >actual &&
+   test_i18ngrep "rebasing detached HEAD $oid" actual
+'
+
 test_expect_success 'tracking with unexpected .fetch refspec' '
rm -rf a b c d &&
git init a &&
-- 
2.17.0.484.g0c8726318