chiark / gitweb /
test suite: gitattributes: try to guess some attr names from manpage
[dgit.git] / tests / tests / gitattributes
index 7452082e5edfbe4e7ae9563f69c210c802485d8e..0f71c335b8657c957a92cea4627483874f8020da 100755 (executable)
@@ -3,6 +3,7 @@ set -e
 . tests/lib
 
 t-dependencies bsdgames
+t-dependencies man-db git-man
 t-tstunt-parsechangelog
 
 t-archive-none example
@@ -56,6 +57,15 @@ badattr export-subst
 badattr delta
 badattr encoding no-such-encoding
 
+man gitattributes \
+| perl -ne 'print $1,"\n" if m/^ *(\w[-a-z]*)$/' \
+> grepped-attrs
+
+exec <grepped-attrs
+while read attr; do
+       badattr $attr
+done
+
 sha256sum af/* >sums
 
 # ----- common to source formats -----
@@ -96,10 +106,29 @@ sfmt_import () {
        inst=$1
        dgitargs=$2
        refname="import.$sfmt-$inst"
+       brkerr=stderr.$sfmt-$inst.broken
 
        mkdir $pdb-import-$inst
        cd $pdb-import-$inst
        git init
+
+       LC_MESSAGES=C \
+       t-dgit $dgitargs import-dsc ../${p}_${v}.dsc +$refname.broken \
+               2>&1 |tee ../$brkerr
+       fgrep 'warning: source tree contains .gitattributes' ../$brkerr
+       git checkout $refname.broken
+       sha256sum af/* >../$sums.broken
+
+       for s in ../sums ../$sums.broken; do
+               sed 's/[0-9a-f]* //' $s >$s.nosums
+       done
+       diff -U0 ../sums.nosums ../$sums.broken.nosums
+       set +e
+       diff -U0 ../sums ../$sums.broken
+       rc=$?
+       set -e
+       test $rc = 1
+
        t-dgit setup-new-tree
 
        t-dgit $dgitargs import-dsc ../${p}_${v}.dsc +$refname
@@ -108,9 +137,10 @@ sfmt_import () {
        sums=sums.$sfmt-$inst
 
        for f in af/*; do
-               git cat-file blob "refs/heads/$refname:$f" | sha256sum | \
-                       sed -e 's#-$#'$f'#' \
-                       >>../$sums
+               git cat-file blob "refs/heads/$refname:$f" \
+                       | sha256sum \
+                       | sed -e 's#-$#'$f'#' \
+               >>../$sums
        done
 
        cd ..
@@ -119,7 +149,7 @@ sfmt_import () {
 
 : ----- generate the orig -----
 
-tar --exclude=debian -zcf ${p}_${bv}.orig.tar.gz $p
+tar --exclude=debian --exclude=.git -zcf ${p}_${bv}.orig.tar.gz $p
 
 : ----- test 1.0 native -----
 
@@ -129,6 +159,14 @@ native_convert () { :; }
 sfmt_setup 1.1 native
 sfmt_import norm
 
+: ----- test 1.0 diff -----
+
+diff_addpatch () { :; }
+diff_convert () { :; }
+
+sfmt_setup 1.1 diff
+sfmt_import norm
+
 : ----- test "3.0 (quilt)"
 
 quilt_addpatch () {