Skip to content

Commit 8d5232b

Browse files
committed
squash! feat(move): add test for move --reparent
1 parent 2d74615 commit 8d5232b

File tree

1 file changed

+20
-105
lines changed

1 file changed

+20
-105
lines changed

git-branchless/tests/test_move.rs

Lines changed: 20 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -6381,28 +6381,11 @@ fn test_move_reparent() -> eyre::Result<()> {
63816381

63826382
git.branchless("prev", &[])?;
63836383
{
6384-
let (stdout, _stderr) = git.run(&["show"])?;
6384+
let (stdout, _stderr) = git.run(&["show", "--pretty=format:", "--stat", "HEAD"])?;
63856385
insta::assert_snapshot!(stdout, @r"
6386-
commit 40ca3815e2167cd8a464493414ea4340d65230a7
6387-
Author: Testy McTestface <test@example.com>
6388-
Date: Thu Oct 29 12:34:56 2020 -0200
6389-
6390-
create test2_will_also_contain_test1_when_reparented.txt
6391-
6392-
diff --git a/test1.txt b/test1.txt
6393-
new file mode 100644
6394-
index 0000000..7432a8f
6395-
--- /dev/null
6396-
+++ b/test1.txt
6397-
@@ -0,0 +1 @@
6398-
+test1 contents
6399-
diff --git a/test2_will_also_contain_test1_when_reparented.txt b/test2_will_also_contain_test1_when_reparented.txt
6400-
new file mode 100644
6401-
index 0000000..1619c31
6402-
--- /dev/null
6403-
+++ b/test2_will_also_contain_test1_when_reparented.txt
6404-
@@ -0,0 +1 @@
6405-
+test2_will_also_contain_test1_when_reparented contents
6386+
test1.txt | 1 +
6387+
test2_will_also_contain_test1_when_reparented.txt | 1 +
6388+
2 files changed, 2 insertions(+)
64066389
");
64076390
}
64086391

@@ -6443,82 +6426,31 @@ fn test_move_reparent() -> eyre::Result<()> {
64436426
// the reparented test3 contains everything, including test1 and test2
64446427
git.branchless("prev", &[])?;
64456428
{
6446-
let (stdout, _stderr) = git.run(&["show"])?;
6429+
let (stdout, _stderr) = git.run(&["show", "--pretty=format:", "--stat", "HEAD"])?;
64476430
insta::assert_snapshot!(stdout, @r"
6448-
commit 3f0558d435e63ebdfd1e81f5dbd3ddfaca387864
6449-
Author: Testy McTestface <test@example.com>
6450-
Date: Thu Oct 29 12:34:56 2020 -0300
6451-
6452-
create test3_will_also_contain_test2_when_reparented.txt
6453-
6454-
diff --git a/test1.txt b/test1.txt
6455-
new file mode 100644
6456-
index 0000000..7432a8f
6457-
--- /dev/null
6458-
+++ b/test1.txt
6459-
@@ -0,0 +1 @@
6460-
+test1 contents
6461-
diff --git a/test2_will_also_contain_test1_when_reparented.txt b/test2_will_also_contain_test1_when_reparented.txt
6462-
new file mode 100644
6463-
index 0000000..1619c31
6464-
--- /dev/null
6465-
+++ b/test2_will_also_contain_test1_when_reparented.txt
6466-
@@ -0,0 +1 @@
6467-
+test2_will_also_contain_test1_when_reparented contents
6468-
diff --git a/test3_will_also_contain_test2_when_reparented.txt b/test3_will_also_contain_test2_when_reparented.txt
6469-
new file mode 100644
6470-
index 0000000..0829100
6471-
--- /dev/null
6472-
+++ b/test3_will_also_contain_test2_when_reparented.txt
6473-
@@ -0,0 +1 @@
6474-
+test3_will_also_contain_test2_when_reparented contents
6431+
test1.txt | 1 +
6432+
test2_will_also_contain_test1_when_reparented.txt | 1 +
6433+
test3_will_also_contain_test2_when_reparented.txt | 1 +
6434+
3 files changed, 3 insertions(+)
64756435
");
64766436
}
64776437

64786438
// the descendant test2 should come without test3 like before
64796439
{
6480-
let (stdout, _stderr) = git.run(&["show", "e1e0b99"])?;
6440+
let (stdout, _stderr) = git.run(&["show", "--pretty=format:", "--stat", "e1e0b99"])?;
64816441
insta::assert_snapshot!(stdout, @r"
6482-
commit e1e0b9952583334793f781ef25a6ce8d861cf85f
6483-
Author: Testy McTestface <test@example.com>
6484-
Date: Thu Oct 29 12:34:56 2020 -0200
6485-
6486-
create test2_will_also_contain_test1_when_reparented.txt
6487-
6488-
diff --git a/test3_will_also_contain_test2_when_reparented.txt b/test3_will_also_contain_test2_when_reparented.txt
6489-
deleted file mode 100644
6490-
index 0829100..0000000
6491-
--- a/test3_will_also_contain_test2_when_reparented.txt
6492-
+++ /dev/null
6493-
@@ -1 +0,0 @@
6494-
-test3_will_also_contain_test2_when_reparented contents
6442+
test3_will_also_contain_test2_when_reparented.txt | 1 -
6443+
1 file changed, 1 deletion(-)
64956444
");
64966445
}
64976446

64986447
// similarly the descendant test1 should come without test1 and test2
64996448
{
6500-
let (stdout, _stderr) = git.run(&["show", "fee6ba0"])?;
6449+
let (stdout, _stderr) = git.run(&["show", "--pretty=format:", "--stat", "fee6ba0"])?;
65016450
insta::assert_snapshot!(stdout, @r"
6502-
commit fee6ba034168cd7e83a93784c6c62cd9fb682d5a
6503-
Author: Testy McTestface <test@example.com>
6504-
Date: Thu Oct 29 12:34:56 2020 -0100
6505-
6506-
create test1.txt
6507-
6508-
diff --git a/test2_will_also_contain_test1_when_reparented.txt b/test2_will_also_contain_test1_when_reparented.txt
6509-
deleted file mode 100644
6510-
index 1619c31..0000000
6511-
--- a/test2_will_also_contain_test1_when_reparented.txt
6512-
+++ /dev/null
6513-
@@ -1 +0,0 @@
6514-
-test2_will_also_contain_test1_when_reparented contents
6515-
diff --git a/test3_will_also_contain_test2_when_reparented.txt b/test3_will_also_contain_test2_when_reparented.txt
6516-
deleted file mode 100644
6517-
index 0829100..0000000
6518-
--- a/test3_will_also_contain_test2_when_reparented.txt
6519-
+++ /dev/null
6520-
@@ -1 +0,0 @@
6521-
-test3_will_also_contain_test2_when_reparented contents
6451+
test2_will_also_contain_test1_when_reparented.txt | 1 -
6452+
test3_will_also_contain_test2_when_reparented.txt | 1 -
6453+
2 files changed, 2 deletions(-)
65226454
");
65236455
}
65246456

@@ -6553,28 +6485,11 @@ fn test_move_reparent() -> eyre::Result<()> {
65536485
}
65546486

65556487
{
6556-
let (stdout, _stderr) = git.run(&["show", "40ca381"])?;
6488+
let (stdout, _stderr) = git.run(&["show", "--pretty=format:", "--stat", "40ca381"])?;
65576489
insta::assert_snapshot!(stdout, @r"
6558-
commit 40ca3815e2167cd8a464493414ea4340d65230a7
6559-
Author: Testy McTestface <test@example.com>
6560-
Date: Thu Oct 29 12:34:56 2020 -0200
6561-
6562-
create test2_will_also_contain_test1_when_reparented.txt
6563-
6564-
diff --git a/test1.txt b/test1.txt
6565-
new file mode 100644
6566-
index 0000000..7432a8f
6567-
--- /dev/null
6568-
+++ b/test1.txt
6569-
@@ -0,0 +1 @@
6570-
+test1 contents
6571-
diff --git a/test2_will_also_contain_test1_when_reparented.txt b/test2_will_also_contain_test1_when_reparented.txt
6572-
new file mode 100644
6573-
index 0000000..1619c31
6574-
--- /dev/null
6575-
+++ b/test2_will_also_contain_test1_when_reparented.txt
6576-
@@ -0,0 +1 @@
6577-
+test2_will_also_contain_test1_when_reparented contents
6490+
test1.txt | 1 +
6491+
test2_will_also_contain_test1_when_reparented.txt | 1 +
6492+
2 files changed, 2 insertions(+)
65786493
");
65796494
}
65806495

0 commit comments

Comments
 (0)