chiark / gitweb /
test suite: gitattributes: Test that old macros are updated
[dgit.git] / tests / tests / gitattributes
index 83fa6102ef430f7ecc2a3899fac68e6ddeef484a..0b361ada3d99310fec167eaef90c2531d85758cb 100755 (executable)
@@ -22,12 +22,20 @@ badattr1 () {
        printf >>af/$filename 'crlf: \r\n'
        echo >>af/$filename 'id $Id: $'
        echo >>af/$filename 'id $Id: SPLARK $'
+       printf >>af/$filename '\xEF\xBB\xBF <- UTF-8 BOM\n'
        echo >>gitattrs "af/$filename" "$attrspec"
 }
 
 badattr () {
        attrname=$1; shift
-       badattr1 $attrname-set $attrname
+
+       case "$attrname" in
+       working-tree-encoding) ;;
+       *)
+               badattr1 $attrname-set $attrname
+               ;;
+       esac
+
        badattr1 $attrname-unset -$attrname
        badattr1 $attrname-unspec \!$attrname
        local val
@@ -57,6 +65,7 @@ badattr export-ignore
 badattr export-subst
 badattr delta
 badattr encoding no-such-encoding
+badattr working-tree-encoding ISO-8859-1 UTF-16
 
 man gitattributes \
 | perl -ne 'print $1,"\n" if m/^ *(\w[-a-z]*)$/' \
@@ -149,7 +158,7 @@ t-dgit-warn-check () {
        LC_MESSAGES=C t-dgit "$@" 2>&1 |tee ../$err
 
        set +e
-       fgrep 'warning: source tree contains .gitattributes' ../$err
+       egrep 'warning: .* contains \.gitattributes' ../$err
        rc=$?
        set -e
 
@@ -178,6 +187,7 @@ sfmt_import () {
 
        t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch
        git checkout $branch
+       touch af/*
        git reset --hard
 
        sums_check
@@ -229,4 +239,47 @@ sfmt_setup 1.0-1 quilt
 sfmt_import norm
 sfmt_import absurd --force-import-gitapply-absurd
 
-#t-ok
+: ----- 'test clone (with "3.0 (quilt)")' -----
+
+mv $origtar ${dscf%.dsc}.* $tmp/mirror/pool/main/
+t-archive-query sid
+
+t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
+       clone $p sid $p.clone.broken
+cd $p.clone.broken
+
+sums=sums.broken
+sums_check_broken
+
+cd ..
+
+t-dgit-warn-check 1 clone $p sid $p.clone
+
+cd $p.clone
+sums=sums.clone
+branch=dgit/sid
+sums_check
+
+cd ..
+
+t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
+       clone $p sid $p.clone.old
+
+cd $p.clone.old
+
+mkdir -p .git/info
+cat >.git/info/attributes <<'END'
+*       dgit-defuse-attrs
+[attr]dgit-defuse-attrs -text -eol -crlf -ident -filter
+# ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1)
+END
+
+t-dgit setup-gitattributes
+git reset --hard
+
+sums=sums.old
+sums_check
+
+cd ..
+
+t-ok