@@ -874,6 +874,7 @@ func TestDiffTar(t *testing.T) {
874874 fileEntry("d3/l1", []byte("link me"), 0644),
875875 dirEntry("d4/", 0755),
876876 linkEntry("d4/f1", "d3/l1"),
877+ dirEntry("d6/", 0755),
877878 whiteoutEntry("d6/l1"),
878879 whiteoutEntry("d6/l2"),
879880 },
@@ -947,6 +948,46 @@ func TestDiffTar(t *testing.T) {
947948 fstest.Link("/d3/f1", "/d4/l1"),
948949 ),
949950 },
951+ {
952+ name: "WhiteoutIncludesParents",
953+ validators: []tarEntryValidator{
954+ dirEntry("d1/", 0755),
955+ whiteoutEntry("d1/f1"),
956+ dirEntry("d2/", 0755),
957+ whiteoutEntry("d2/f1"),
958+ fileEntry("d2/f2", []byte("content"), 0777),
959+ dirEntry("d3/", 0755),
960+ whiteoutEntry("d3/f1"),
961+ fileEntry("d3/f2", []byte("content"), 0644),
962+ dirEntry("d4/", 0755),
963+ fileEntry("d4/f0", []byte("content"), 0644),
964+ whiteoutEntry("d4/f1"),
965+ whiteoutEntry("d5"),
966+ },
967+ a: fstest.Apply(
968+ fstest.CreateDir("/d1/", 0755),
969+ fstest.CreateFile("/d1/f1", []byte("content"), 0644),
970+ fstest.CreateDir("/d2/", 0755),
971+ fstest.CreateFile("/d2/f1", []byte("content"), 0644),
972+ fstest.CreateFile("/d2/f2", []byte("content"), 0644),
973+ fstest.CreateDir("/d3/", 0755),
974+ fstest.CreateFile("/d3/f1", []byte("content"), 0644),
975+ fstest.CreateDir("/d4/", 0755),
976+ fstest.CreateFile("/d4/f1", []byte("content"), 0644),
977+ fstest.CreateDir("/d5/", 0755),
978+ fstest.CreateFile("/d5/f1", []byte("content"), 0644),
979+ ),
980+ b: fstest.Apply(
981+ fstest.Remove("/d1/f1"),
982+ fstest.Remove("/d2/f1"),
983+ fstest.Chmod("/d2/f2", 0777),
984+ fstest.Remove("/d3/f1"),
985+ fstest.CreateFile("/d3/f2", []byte("content"), 0644),
986+ fstest.Remove("/d4/f1"),
987+ fstest.CreateFile("/d4/f0", []byte("content"), 0644),
988+ fstest.RemoveAll("/d5"),
989+ ),
990+ },
950991 }
951992
952993 for _, at := range tests {
0 commit comments