Thread (14 messages) 14 messages, 2 authors, 2023-10-13

Re: [PATCH v3 1/2] attr: read attributes from HEAD when bare repo

From: Eric Sunshine <hidden>
Date: 2023-10-10 19:58:32

On Tue, Oct 10, 2023 at 3:49 PM John Cai via GitGitGadget
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
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
+'
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help