<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/attr.c, branch v2.45.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-06-28T22:53:10Z</updated>
<entry>
<title>Merge branch 'tb/attr-limits' into maint-2.45</title>
<updated>2024-06-28T22:53:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-06-28T22:53:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6840423c6fa27085aad8b091fc73ea1d9bcdadd6'/>
<id>urn:sha1:6840423c6fa27085aad8b091fc73ea1d9bcdadd6</id>
<content type='text'>
The maximum size of attribute files is enforced more consistently.

* tb/attr-limits:
  attr.c: move ATTR_MAX_FILE_SIZE check into read_attr_from_buf()
</content>
</entry>
<entry>
<title>Merge branch 'jc/no-default-attr-tree-in-bare' into maint-2.45</title>
<updated>2024-05-31T22:28:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-05-31T22:28:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1258fc2b08543bac83aea5ad856b4a64348c3c79'/>
<id>urn:sha1:1258fc2b08543bac83aea5ad856b4a64348c3c79</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>attr.c: move ATTR_MAX_FILE_SIZE check into read_attr_from_buf()</title>
<updated>2024-05-03T19:44:16Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2024-05-03T19:12:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c793f9cb0853b7b173228efa53b32c60e3818598'/>
<id>urn:sha1:c793f9cb0853b7b173228efa53b32c60e3818598</id>
<content type='text'>
Commit 3c50032ff52 (attr: ignore overly large gitattributes files,
2022-12-01) added a defense-in-depth check to ensure that .gitattributes
blobs read from the index do not exceed ATTR_MAX_FILE_SIZE (100 MB).

But there were two cases added shortly after 3c50032ff52 was written
which do not apply similar protections:

  - 47cfc9bd7d0 (attr: add flag `--source` to work with tree-ish,
    2023-01-14)

  - 4723ae1007f (attr.c: read attributes in a sparse directory,
    2023-08-11) added a similar

Ensure that we refuse to process a .gitattributes blob exceeding
ATTR_MAX_FILE_SIZE when reading from either an arbitrary tree object or
a sparse directory. This is done by pushing the ATTR_MAX_FILE_SIZE check
down into the low-level `read_attr_from_buf()`.

In doing so, plug a leak in `read_attr_from_index()` where we would
accidentally leak the large buffer upon detecting it is too large to
process.

(Since `read_attr_from_buf()` handles a NULL buffer input, we can remove
a NULL check before calling it in `read_attr_from_index()` as well).

Co-authored-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stop using HEAD for attributes in bare repository by default</title>
<updated>2024-05-03T16:15:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-05-03T15:34:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=51441e6460b505c07b4a8a6deeaa7de4bf6e8e33'/>
<id>urn:sha1:51441e6460b505c07b4a8a6deeaa7de4bf6e8e33</id>
<content type='text'>
With 23865355 (attr: read attributes from HEAD when bare repo,
2023-10-13), we started to use the HEAD tree as the default
attribute source in a bare repository.  One argument for such a
behaviour is that it would make things like "git archive" run in
bare and non-bare repositories for the same commit consistent.
This changes was merged to Git 2.43 but without an explicit mention
in its release notes.

It turns out that this change destroys performance of shallowly
cloning from a bare repository.  As the "server" installations are
expected to be mostly bare, and "git pack-objects", which is the
core of driving the other side of "git clone" and "git fetch" wants
to see if a path is set not to delta with blobs from other paths via
the attribute system, the change forces the server side to traverse
the tree of the HEAD commit needlessly to find if each and every
paths the objects it sends out has the attribute that controls the
deltification.  Given that (1) most projects do not configure such
an attribute, and (2) it is dubious for the server side to honor
such an end-user supplied attribute anyway, this was a poor choice
of the default.

To mitigate the current situation, let's revert the change that uses
the tree of HEAD in a bare repository by default as the attribute
source.  This will help most people who have been happy with the
behaviour of Git 2.42 and before.

Two things to note:

 * If you are stuck with versions of Git 2.43 or newer, that is
   older than the release this fix appears in, you can explicitly
   set the attr.tree configuration variable to point at an empty
   tree object, i.e.

	$ git config attr.tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904

 * If you like the behaviour we are reverting, you can explicitly
   set the attr.tree configuration variable to HEAD, i.e.

	$ git config attr.tree HEAD

The right fix for this is to optimize the code paths that allow
accesses to attributes in tree objects, but that is a much more
involved change and is left as a longer-term project, outside the
scope of this "first step" fix.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>attr: add builtin objectmode values support</title>
<updated>2023-12-28T21:21:52Z</updated>
<author>
<name>Joanna Wang</name>
<email>jojwang@google.com</email>
</author>
<published>2023-11-16T05:44:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2232a88ab6bfbe41faf73f85912937e20bf8b4ee'/>
<id>urn:sha1:2232a88ab6bfbe41faf73f85912937e20bf8b4ee</id>
<content type='text'>
Gives all paths builtin objectmode values based on the paths' modes
(one of 100644, 100755, 120000, 040000, 160000). Users may use
this feature to filter by file types. For example a pathspec such as
':(attr:builtin_objectmode=160000)' could filter for submodules without
needing to have `builtin_objectmode=160000` to be set in .gitattributes
for every submodule path.

These values are also reflected in `git check-attr` results.
If the git_attr_direction is set to GIT_ATTR_INDEX or GIT_ATTR_CHECKIN
and a path is not found in the index, the value will be unspecified.

This patch also reserves the builtin_* attribute namespace for objectmode
and any future builtin attributes. Any user defined attributes using this
reserved namespace will result in a warning. This is a breaking change for
any existing builtin_* attributes.
Pathspecs with some builtin_* attribute name (excluding builtin_objectmode)
will behave like any attribute where there are no user specified values.

Signed-off-by: Joanna Wang &lt;jojwang@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/attr-tree-config'</title>
<updated>2023-10-29T22:09:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-10-29T22:09:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26dd307cfaabe3d3f0b01aad64969e76a317811a'/>
<id>urn:sha1:26dd307cfaabe3d3f0b01aad64969e76a317811a</id>
<content type='text'>
The attribute subsystem learned to honor `attr.tree` configuration
that specifies which tree to read the .gitattributes files from.

* jc/attr-tree-config:
  attr: add attr.tree for setting the treeish to read attributes from
  attr: read attributes from HEAD when bare repo
</content>
</entry>
<entry>
<title>attr: add attr.tree for setting the treeish to read attributes from</title>
<updated>2023-10-13T18:43:29Z</updated>
<author>
<name>John Cai</name>
<email>johncai86@gmail.com</email>
</author>
<published>2023-10-13T17:39:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9f9c40cf34c29d4ad700d9869435d159056fa6fb'/>
<id>urn:sha1:9f9c40cf34c29d4ad700d9869435d159056fa6fb</id>
<content type='text'>
44451a2 (attr: teach "--attr-source=&lt;tree&gt;" global option to "git",
2023-05-06) provided the ability to pass in a treeish as the attr
source. In the context of serving Git repositories as bare repos like we
do at GitLab however, it would be easier to point --attr-source to HEAD
for all commands by setting it once.

Add a new config attr.tree that allows this.

Signed-off-by: John Cai &lt;johncai86@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>attr: read attributes from HEAD when bare repo</title>
<updated>2023-10-13T18:43:29Z</updated>
<author>
<name>John Cai</name>
<email>johncai86@gmail.com</email>
</author>
<published>2023-10-13T17:39:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2386535511d1181afd4e892e2a866ffe5e1d7d21'/>
<id>urn:sha1:2386535511d1181afd4e892e2a866ffe5e1d7d21</id>
<content type='text'>
The motivation for 44451a2e5e (attr: teach "--attr-source=&lt;tree&gt;" 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 &lt;johncai86@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse: separate out parsing functions from config.h</title>
<updated>2023-09-29T22:14:57Z</updated>
<author>
<name>Calvin Wan</name>
<email>calvinwan@google.com</email>
</author>
<published>2023-09-29T21:20:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b1bda751739d90e1a94b47397676bcb8eebf16d5'/>
<id>urn:sha1:b1bda751739d90e1a94b47397676bcb8eebf16d5</id>
<content type='text'>
The files config.{h,c} contain functions that have to do with parsing,
but not config.

In order to further reduce all-in-one headers, separate out functions in
config.c that do not operate on config into its own file, parse.h,
and update the include directives in the .c files that need only such
functions accordingly.

Signed-off-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sl/sparse-check-attr'</title>
<updated>2023-08-29T20:51:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-08-29T20:51:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=354356feffed7b3c72d62cd78fc7575efd5bad42'/>
<id>urn:sha1:354356feffed7b3c72d62cd78fc7575efd5bad42</id>
<content type='text'>
Teach "git check-attr" work better with sparse-index.

* sl/sparse-check-attr:
  check-attr: integrate with sparse-index
  attr.c: read attributes in a sparse directory
  t1092: add tests for 'git check-attr'
</content>
</entry>
</feed>
