From 37dc8e5f1c9aec0d5b517a36ab465fc6c64155db Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 20 Jun 2018 13:31:36 +0100 Subject: test suite: gitattributes: Test working-tree-encoding suppression Put a UTF-8 BOM in the middle of the test files, and some gitattribute settings for working-tree-encoding. `ISO-8859-1' produces file corruption. `UTF-16' produces an error since it doesn't specify BE or LE, and the file lacks a BOM at the start. Part of the fix to #901900. This introduces the desired test failure. Signed-off-by: Ian Jackson --- tests/tests/gitattributes | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/tests/gitattributes') diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 9e1c246..5be7d01 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -22,6 +22,7 @@ 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" } @@ -57,6 +58,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]*)$/' \ -- cgit v1.2.3 From 61016923b2a47b0550e36ed5f5a929d401811b42 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 20 Jun 2018 13:18:19 +0100 Subject: test suite: gitattributes: Do not try to set working-tree-encoding to true Part of the fix to #901900. This suppresses the sort-of-spurious test failure which occurs because the working-tree-encoding attribute is discovered and then set to an inappropriate value. Signed-off-by: Ian Jackson --- tests/tests/gitattributes | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/tests/gitattributes') diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 5be7d01..04c6b87 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -28,7 +28,14 @@ badattr1 () { 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 -- cgit v1.2.3 From 663d79cdcc8fe536350c05fc681b445502be4cfe Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 20 Jun 2018 14:13:13 +0100 Subject: test suite: gitattributes: Rename a sums file to the right name Signed-off-by: Ian Jackson --- tests/tests/gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/tests/gitattributes') diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 04c6b87..416206b 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -248,7 +248,7 @@ t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \ clone $p sid $p.clone.broken cd $p.clone.broken -sums=$p.clone.broken +sums=sums.broken sums_check_broken cd .. -- cgit v1.2.3 From 0de90d6589a4e11bdae9a6f8f1bab65156ea7c19 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 20 Jun 2018 14:13:24 +0100 Subject: test suite: gitattributes: Test that old macros are updated Signed-off-by: Ian Jackson --- tests/tests/gitattributes | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/tests/gitattributes') diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 416206b..0b361ad 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -262,4 +262,24 @@ 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 -- cgit v1.2.3 From 47d5cc045b10fc6993e9cfa7c9b6dfd61873702b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 20 Jun 2018 14:28:00 +0100 Subject: test suite: gitattributes: check that dotfiles work properly too Signed-off-by: Ian Jackson --- tests/tests/gitattributes | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tests/tests/gitattributes') diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 0b361ad..bdc61f8 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -48,6 +48,9 @@ badattr () { t-git-config core.eol crlf +printf >>.dotfile-attr 'dotfiles too?\n' +echo >>gitattrs '.dotfile-attr filter=dgit-test-crazy-f' + badattr text auto badattr eol lf crlf badattr ident @@ -76,7 +79,7 @@ while read attr; do badattr $attr done -sha256sum af/* >sums +sha256sum .dotfile-attr af/* >sums # ----- common to source formats ----- @@ -101,7 +104,7 @@ sfmt_setup () { cp ../gitattrs .gitattributes $addpatch gitattrs - cp -a ../af . + cp -a ../af ../.dotfile-attr . $addpatch files cp ../sums . @@ -117,10 +120,10 @@ sums_check () { # $sums $branch # and check out $branch - sha256sum af/* >../$sums.checkout + sha256sum .dotfile-attr af/* >../$sums.checkout diff -U0 ../sums ../$sums.checkout - for f in af/*; do + for f in .dotfile-attr af/*; do git cat-file blob "refs/heads/$branch:$f" \ | sha256sum \ | sed -e 's#-$#'$f'#' \ @@ -135,7 +138,7 @@ sums_check_broken () { # $sums # and check out the broken branch - sha256sum af/* >../$sums.broken + sha256sum .dotfile-attr af/* >../$sums.broken for s in ../sums ../$sums.broken; do sed 's/[0-9a-f]* //' $s >$s.nosums @@ -187,7 +190,7 @@ sfmt_import () { t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch git checkout $branch - touch af/* + touch .dotfile-attr af/* git reset --hard sums_check -- cgit v1.2.3