]> git.ipfire.org Git - thirdparty/git.git/commit - attr.c
attr: add builtin objectmode values support
authorJoanna Wang <jojwang@google.com>
Thu, 16 Nov 2023 05:44:37 +0000 (05:44 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Dec 2023 21:21:52 +0000 (13:21 -0800)
commit2232a88ab6bfbe41faf73f85912937e20bf8b4ee
tree3d22b1259ebf48d218296579a34eabc945c9cc57
parentcfb8a6e9a93adbe81efca66e6110c9b4d2e57169
attr: add builtin objectmode values support

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 <jojwang@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/gitattributes.txt
attr.c
neue [new file with mode: 0644]
t/t0003-attributes.sh
t/t6135-pathspec-with-attrs.sh