aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2011-09-22 17:44:20 -0400
committerJunio C Hamano <gitster@pobox.com>2011-09-22 16:38:22 -0700
commitb2b3e9c2d623359ed680a5eef850ef2fd313b73c (patch)
tree8a8417ac565eba8fd0776367375e73d230597ed5 /t
parent167a5800cb707ed489c3cb88174ee21e95a610ae (diff)
downloadgit-b2b3e9c2d623359ed680a5eef850ef2fd313b73c.tar.gz
git-b2b3e9c2d623359ed680a5eef850ef2fd313b73c.tar.xz
Teach '--cached' option to check-attr
This option causes check-attr to consider .gitattributes only from the index, ignoring .gitattributes from the working tree. This allows the command to be used in situations where a working tree does not exist. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t0003-attributes.sh25
1 files changed, 21 insertions, 4 deletions
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index ae2f1da28..c0a45630b 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -134,10 +134,20 @@ test_expect_success 'attribute test: read paths from stdin' '
test_expect_success 'attribute test: --all option' '
- grep -v unspecified < expect-all | sort > expect &&
- sed -e "s/:.*//" < expect-all | uniq |
- git check-attr --stdin --all | sort > actual &&
- test_cmp expect actual
+ grep -v unspecified <expect-all | sort >specified-all &&
+ sed -e "s/:.*//" <expect-all | uniq >stdin-all &&
+ git check-attr --stdin --all <stdin-all | sort >actual &&
+ test_cmp specified-all actual
+'
+
+test_expect_success 'attribute test: --cached option' '
+
+ : >empty &&
+ git check-attr --cached --stdin --all <stdin-all | sort >actual &&
+ test_cmp empty actual &&
+ git add .gitattributes a/.gitattributes a/b/.gitattributes &&
+ git check-attr --cached --stdin --all <stdin-all | sort >actual &&
+ test_cmp specified-all actual
'
test_expect_success 'root subdir attribute test' '
@@ -168,6 +178,13 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' '
'
+test_expect_success 'bare repository: check that --cached honors index' '
+ GIT_INDEX_FILE=../.git/index \
+ git check-attr --cached --stdin --all <../stdin-all |
+ sort >actual &&
+ test_cmp ../specified-all actual
+'
+
test_expect_success 'bare repository: test info/attributes' '
(