Skip to content

Commit b077cf2

Browse files
committed
Merge branch 'jc/no-default-attr-tree-in-bare'
Git 2.43 started using the tree of HEAD as the source of attributes in a bare repository, which has severe performance implications. For now, revert the change, without ripping out a more explicit support for the attr.tree configuration variable. * jc/no-default-attr-tree-in-bare: stop using HEAD for attributes in bare repository by default
2 parents dddddea + 51441e6 commit b077cf2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

attr.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,13 +1222,6 @@ static void compute_default_attr_source(struct object_id *attr_source)
12221222
ignore_bad_attr_tree = 1;
12231223
}
12241224

1225-
if (!default_attr_source_tree_object_name &&
1226-
startup_info->have_repository &&
1227-
is_bare_repository()) {
1228-
default_attr_source_tree_object_name = "HEAD";
1229-
ignore_bad_attr_tree = 1;
1230-
}
1231-
12321225
if (!default_attr_source_tree_object_name || !is_null_oid(attr_source))
12331226
return;
12341227

t/t0003-attributes.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,19 @@ test_expect_success 'bad attr source defaults to reading .gitattributes file' '
398398
)
399399
'
400400

401-
test_expect_success 'bare repo defaults to reading .gitattributes from HEAD' '
401+
test_expect_success 'bare repo no longer defaults to reading .gitattributes from HEAD' '
402402
test_when_finished rm -rf test bare_with_gitattribute &&
403403
git init test &&
404404
test_commit -C test gitattributes .gitattributes "f/path test=val" &&
405405
git clone --bare test bare_with_gitattribute &&
406-
echo "f/path: test: val" >expect &&
406+
407+
echo "f/path: test: unspecified" >expect &&
407408
git -C bare_with_gitattribute check-attr test -- f/path >actual &&
409+
test_cmp expect actual &&
410+
411+
echo "f/path: test: val" >expect &&
412+
git -C bare_with_gitattribute -c attr.tree=HEAD \
413+
check-attr test -- f/path >actual &&
408414
test_cmp expect actual
409415
'
410416

t/t5001-archive-attr.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ test_expect_success 'git archive vs. bare' '
133133
'
134134

135135
test_expect_success 'git archive with worktree attributes, bare' '
136-
(cd bare && git archive --worktree-attributes HEAD) >bare-worktree.tar &&
136+
(cd bare &&
137+
git -c attr.tree=HEAD archive --worktree-attributes HEAD) >bare-worktree.tar &&
137138
(mkdir bare-worktree && cd bare-worktree && "$TAR" xf -) <bare-worktree.tar
138139
'
139140

0 commit comments

Comments
 (0)