On Tue, Oct 10, 2023 at 3:49 PM John Cai via GitGitGadget <gitgitgadget@xxxxxxxxx> wrote: > The motivation for 44451a2e5e (attr: teach "--attr-source=<tree>" global > option to "git" , 2023-05-06), was to make it possible to use > gitattributes with bare repositories. > > To make it easier to read gitattributes in bare repositories however, > let's just make HEAD:.gitattributes the default. This is in line with > how mailmap works, 8c473cecfd (mailmap: default mailmap.blob in bare > repositories, 2012-12-13). > > Signed-off-by: John Cai <johncai86@xxxxxxxxx> > --- > diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh > @@ -342,6 +342,20 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' ' > +test_expect_success 'bare repo defaults to reading .gitattributes from HEAD' ' > + test_when_finished rm -rf test bare_with_gitattribute && > + git init test && > + ( > + cd test && > + test_commit gitattributes .gitattributes "f/path test=val" > + ) && Not at all worth a reroll, rather just for future reference... these days test_commit() supports -C, so the same could be accomplished without the subshell or `cd`: test_commit -C test gitattributes .gitattributes "f/path test=val" && > + git clone --bare test bare_with_gitattribute && > + echo "f/path: test: val" >expect && > + git -C bare_with_gitattribute check-attr test -- f/path >actual && > + test_cmp expect actual > +'