@@ -867,7 +867,7 @@ func TestDiffTar(t *testing.T) {
867867 fileEntry ("d2/l1" , []byte ("link me" ), 0644 ),
868868 // d1/f1 and its parent is included after the new link,
869869 // before the new link was included, these files would
870- // not habe needed
870+ // not have been needed
871871 dirEntry ("d1/" , 0755 ),
872872 linkEntry ("d1/f1" , "d2/l1" ),
873873 dirEntry ("d3/" , 0755 ),
@@ -898,6 +898,55 @@ func TestDiffTar(t *testing.T) {
898898 fstest .Remove ("/d6/l2" ),
899899 ),
900900 },
901+ {
902+ name : "UpdateDirectoryPermission" ,
903+ validators : []tarEntryValidator {
904+ dirEntry ("d1/" , 0777 ),
905+ dirEntry ("d1/d/" , 0700 ),
906+ dirEntry ("d2/" , 0770 ),
907+ fileEntry ("d2/f" , []byte ("ok" ), 0644 ),
908+ },
909+ a : fstest .Apply (
910+ fstest .CreateDir ("/d1/" , 0755 ),
911+ fstest .CreateDir ("/d2/" , 0770 ),
912+ ),
913+ b : fstest .Apply (
914+ fstest .Chmod ("/d1" , 0777 ),
915+ fstest .CreateDir ("/d1/d" , 0700 ),
916+ fstest .CreateFile ("/d2/f" , []byte ("ok" ), 0644 ),
917+ ),
918+ },
919+ {
920+ name : "HardlinkUpdatedParent" ,
921+ validators : []tarEntryValidator {
922+ dirEntry ("d1/" , 0777 ),
923+ dirEntry ("d2/" , 0755 ),
924+ fileEntry ("d2/l1" , []byte ("link me" ), 0644 ),
925+ // d1/f1 is included after the new link, its
926+ // parent has already changed and therefore
927+ // only the linked file is included
928+ linkEntry ("d1/f1" , "d2/l1" ),
929+ dirEntry ("d4/" , 0777 ),
930+ fileEntry ("d4/l1" , []byte ("link me" ), 0644 ),
931+ dirEntry ("d3/" , 0755 ),
932+ linkEntry ("d3/f1" , "d4/l1" ),
933+ },
934+ a : fstest .Apply (
935+ fstest .CreateDir ("/d1/" , 0755 ),
936+ fstest .CreateFile ("/d1/f1" , []byte ("link me" ), 0644 ),
937+ fstest .CreateDir ("/d2/" , 0755 ),
938+ fstest .CreateFile ("/d2/f1" , []byte ("link me" ), 0644 ),
939+ fstest .CreateDir ("/d3/" , 0755 ),
940+ fstest .CreateFile ("/d3/f1" , []byte ("link me" ), 0644 ),
941+ fstest .CreateDir ("/d4/" , 0755 ),
942+ ),
943+ b : fstest .Apply (
944+ fstest .Chmod ("/d1" , 0777 ),
945+ fstest .Link ("/d1/f1" , "/d2/l1" ),
946+ fstest .Chmod ("/d4" , 0777 ),
947+ fstest .Link ("/d3/f1" , "/d4/l1" ),
948+ ),
949+ },
901950 }
902951
903952 for _ , at := range tests {
0 commit comments