From 969f9d73228f233aff071a0d07ba28afdb79dbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m?= Date: Tue, 6 Apr 2010 14:46:43 +0200 Subject: attr: Allow multiple changes to an attribute on the same line. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using macros it isn't inconceivable to have an attribute being set by a macro, and then being reset explicitly. Signed-off-by: Henrik Grubbström Signed-off-by: Junio C Hamano --- t/t0003-attributes.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't/t0003-attributes.sh') diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 1c77192eb3..bd9c8deb4c 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -22,6 +22,8 @@ test_expect_success 'setup' ' ( echo "f test=f" echo "a/i test=a/i" + echo "onoff test -test" + echo "offon -test test" ) >.gitattributes && ( echo "g test=a/g" && @@ -44,6 +46,8 @@ test_expect_success 'attribute test' ' attr_check b/g unspecified && attr_check a/b/h a/b/h && attr_check a/b/d/g "a/b/d/*" + attr_check onoff unset + attr_check offon set ' @@ -58,6 +62,8 @@ a/b/g: test: a/b/g b/g: test: unspecified a/b/h: test: a/b/h a/b/d/g: test: a/b/d/* +onoff: test: unset +offon: test: set EOF sed -e "s/:.*//" < expect | git check-attr --stdin test > actual && -- cgit v1.2.3 From ec775c41dc4bb7382ebbbb61ede59e63846b3644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m?= Date: Tue, 6 Apr 2010 14:46:44 +0200 Subject: attr: Expand macros immediately when encountered. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using macros it is otherwise hard to know whether an attribute set by the macro should override an already set attribute. Consider the following .gitattributes file: [attr]mybinary binary -ident * ident foo.bin mybinary bar.bin mybinary ident Without this patch both foo.bin and bar.bin will have the ident attribute set, which is probably not what the user expects. With this patch foo.bin will have an unset ident attribute, while bar.bin will have it set. Signed-off-by: Henrik Grubbström Signed-off-by: Junio C Hamano --- t/t0003-attributes.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't/t0003-attributes.sh') diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index bd9c8deb4c..53bd7fcc4a 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -20,10 +20,12 @@ test_expect_success 'setup' ' mkdir -p a/b/d a/c && ( + echo "[attr]notest !test" echo "f test=f" echo "a/i test=a/i" echo "onoff test -test" echo "offon -test test" + echo "no notest" ) >.gitattributes && ( echo "g test=a/g" && @@ -32,6 +34,7 @@ test_expect_success 'setup' ' ( echo "h test=a/b/h" && echo "d/* test=a/b/d/*" + echo "d/yes notest" ) >a/b/.gitattributes ' @@ -48,6 +51,9 @@ test_expect_success 'attribute test' ' attr_check a/b/d/g "a/b/d/*" attr_check onoff unset attr_check offon set + attr_check no unspecified + attr_check a/b/d/no "a/b/d/*" + attr_check a/b/d/yes unspecified ' @@ -64,6 +70,9 @@ a/b/h: test: a/b/h a/b/d/g: test: a/b/d/* onoff: test: unset offon: test: set +no: test: unspecified +a/b/d/no: test: a/b/d/* +a/b/d/yes: test: unspecified EOF sed -e "s/:.*//" < expect | git check-attr --stdin test > actual && -- cgit v1.2.3 From 520ea857e66f25a681401fd534b2f0d099fd2d31 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sat, 28 Aug 2010 20:18:36 +0200 Subject: t0003: add missing && at end of lines Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/t0003-attributes.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 't/t0003-attributes.sh') diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 53bd7fcc4a..de38c7f7aa 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -48,11 +48,11 @@ test_expect_success 'attribute test' ' attr_check a/b/g a/b/g && attr_check b/g unspecified && attr_check a/b/h a/b/h && - attr_check a/b/d/g "a/b/d/*" - attr_check onoff unset - attr_check offon set - attr_check no unspecified - attr_check a/b/d/no "a/b/d/*" + attr_check a/b/d/g "a/b/d/*" && + attr_check onoff unset && + attr_check offon set && + attr_check no unspecified && + attr_check a/b/d/no "a/b/d/*" && attr_check a/b/d/yes unspecified ' -- cgit v1.2.3 From 6df42ab98480dcac473ca7d701cfca4a0051d0c1 Mon Sep 17 00:00:00 2001 From: Petr Onderka Date: Wed, 1 Sep 2010 00:42:43 +0200 Subject: Add global and system-wide gitattributes Allow gitattributes to be set globally and system wide. This way, settings for particular file types can be set in one place and apply for all user's repositories. The location of system-wide attributes file is $(prefix)/etc/gitattributes. The location of the global file can be configured by setting core.attributesfile. Some parts of the code were copied from the implementation of the same functionality in config.c. Signed-off-by: Petr Onderka Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/t0003-attributes.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't/t0003-attributes.sh') diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 53bd7fcc4a..a7e24edf5b 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -36,6 +36,9 @@ test_expect_success 'setup' ' echo "d/* test=a/b/d/*" echo "d/yes notest" ) >a/b/.gitattributes + ( + echo "global test=global" + ) >$HOME/global-gitattributes ' @@ -57,6 +60,16 @@ test_expect_success 'attribute test' ' ' +test_expect_success 'core.attributesfile' ' + attr_check global unspecified && + git config core.attributesfile "$HOME/global-gitattributes" && + attr_check global global && + git config core.attributesfile "~/global-gitattributes" && + attr_check global global && + echo "global test=precedence" >> .gitattributes && + attr_check global precedence +' + test_expect_success 'attribute test: read paths from stdin' ' cat < expect -- cgit v1.2.3 From e806c43537e2e9b5ab96d03b777a5759ef57b13d Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Mon, 18 Oct 2010 11:09:54 +0200 Subject: t0003: properly quote $HOME 6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot to quote one instance of $HOME in the tests. This would be valid according to POSIX, but bash 4 helpfully declines to execute the command in question with an "ambiguous redirection" error. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t0003-attributes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t0003-attributes.sh') diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 25205ac0ee..e75153bdea 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -38,7 +38,7 @@ test_expect_success 'setup' ' ) >a/b/.gitattributes ( echo "global test=global" - ) >$HOME/global-gitattributes + ) >"$HOME"/global-gitattributes ' -- cgit v1.2.3 From a48fcd836971d065b9bf16b8cd046fd1aff9b279 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 30 Oct 2010 20:46:54 -0500 Subject: tests: add missing && Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- t/t0003-attributes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t0003-attributes.sh') diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index de38c7f7aa..7590b453db 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -59,7 +59,7 @@ test_expect_success 'attribute test' ' test_expect_success 'attribute test: read paths from stdin' ' - cat < expect + cat < expect && f: test: f a/f: test: f a/c/f: test: f -- cgit v1.2.3