chiark / gitweb /
Test suite: import-nonnative: Check that .orig contents match imported trees
[dgit.git] / tests / tests / import-nonnative
index d709ab594b353cacd22095bc56638c9f70fd6b6e..a1884e7ac4e6d3acc2187051cf96e3c99de137b8 100755 (executable)
@@ -55,6 +55,19 @@ chk2() {
        t-ref-same refs/heads/first-2nd-import
 
        for orig in ../${p}_${v%-*}.orig*.tar.*; do
+               tar -atf $orig | LC_ALL=C sort >../files.o
+               pfx=$(perl <../files.o -ne '
+                       while (<>) {
+                               m#^([^/]+/)# or exit 0;
+                               $x //= $1;
+                               $x eq $1 or exit 0;
+                       }
+                       print "$x\n";
+               ')
+               perl -i~ -pe '
+                       s#^\Q'"$pfx"'\E##;
+                       $_="" if m/^$/ || m#/$#;
+               ' ../files.o
                orig=${orig#../}
                pat="^Import ${orig//./\\.}\$"
                t-refs-same-start
@@ -65,6 +78,9 @@ chk2() {
                        imp=$(cat ../t.imp)
                        t-ref-same-val "$orig $start" "$imp"
                done
+               git ls-tree -r --name-only "$t_ref_val:" \
+                       | sort >../files.g
+               diff ../files.{o,g}
        done
        cd ..
 }