chiark / gitweb /
test suite: gitattributes: wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 14 Jan 2017 23:08:37 +0000 (23:08 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 14 Jan 2017 23:08:37 +0000 (23:08 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/tests/gitattributes [new file with mode: 0755]

diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes
new file mode 100755 (executable)
index 0000000..0584118
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-dependencies bsdgames
+
+t-archive-none example
+t-worktree 1.0
+
+cd $p
+
+mkdir af
+
+: ----- make everything break -----
+
+badattr1 () {
+       local filename=$1
+       local attrspec=$2
+       echo >>af/$filename "Test file with $attrspec"
+       printf >>af/$filename 'crlf: \r\n'
+       echo >>af/$filename 'id $Id: $'
+       echo >>af/$filename 'id $Id: SPLARK $'
+       echo >>.gitattributes "af/$filename" "$attrspec"
+}
+
+badattr () {
+       attrname=$1; shift
+       badattr1 $attrname-set $attrname
+       badattr1 $attrname-unset -$attrname
+       badattr1 $attrname-unspec \!$attrname
+       local val
+       for val in "$@"; do
+               badattr1 $attrname=$val $attrname=$val
+       done
+}
+
+# xxx want to make each of these files into a quilt patch
+
+t-git-config core.eol crlf
+
+badattr        text auto
+badattr eol lf crlf
+badattr ident
+
+t-git-config filter.dgit-test-crazy-f.smudge '/usr/games/rot13 2'
+t-git-config filter.dgit-test-crazy-f.clean  '/usr/games/rot13 24'
+t-git-config filter.dgit-test-crazy-f.requrired true
+
+badattr filter dgit-test-crazy-f
+
+badattr diff
+badattr merge text binary union
+badattr whitespace
+badattr export-ignore
+badattr export-subst
+badattr delta
+badattr encoding no-such-encoding
+
+sha256sum af/* >sums
+
+dpkg-source -b .
+
+t-dgit import-dsc ../${p}_1.0.dsc +import
+
+for f in af/*; do
+       git cat-file blob "import:$f" | sha256sum | \
+               sed -e 's#-$#'$f'#' \
+               >>../sums
+done
+
+diff -U0 sums ../sums
+
+#t-ok