Re: [PATCH 1/2] t3420: never change upstream branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ben

On 18/08/2019 10:53, Ben Wijen wrote:
When using `git rebase --autostash <upstream> <branch>` and
the workarea is dirty, the active branch is incorrectly reset
to the rebase <upstream> branch.

This test will check for such behavior.

Signed-off-by: Ben Wijen <ben@xxxxxxxxx>
---
  t/t3420-rebase-autostash.sh | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index b8f4d03467..867e4e0b17 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -306,4 +306,13 @@ test_expect_success 'branch is left alone when possible' '
  	test unchanged-branch = "$(git rev-parse --abbrev-ref HEAD)"
  '
+test_expect_success 'never change upstream branch' '
+	test_when_finished "git reset --hard && git branch -D upstream" &&
+	git checkout -b upstream unrelated-onto-branch &&
+	echo changed >file0 &&
+	git add file0 &&
+	git rebase --autostash upstream feature-branch &&
+	test $(git rev-parse upstream) = $(git rev-parse unrelated-onto-branch)

In addition to Junio's suggestions I'd add using
	test_cmp_rev upstream unrelated-onto-branch
for the last line.

Best Wishes

Phillip

+'
+
  test_done




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux