<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/src/attr.c, branch ethomson/treebuilder_write</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/'/>
<entry>
<title>attr: use GIT_ASSERT</title>
<updated>2020-11-25T11:42:03+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2020-04-05T09:04:52+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=7b2f94bf9452bd11e9f5eb395905479f3f6de0d4'/>
<id>7b2f94bf9452bd11e9f5eb395905479f3f6de0d4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>attr: optionally read attributes from repository</title>
<updated>2019-08-11T19:47:59+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2019-07-21T13:11:03+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=4fd5748c4bbc0fba3db9fb2fb20e01261339b9d9'/>
<id>4fd5748c4bbc0fba3db9fb2fb20e01261339b9d9</id>
<content type='text'>
When `GIT_ATTR_CHECK_INCLUDE_HEAD` is specified, read `gitattribute`
files that are checked into the repository at the HEAD revision.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When `GIT_ATTR_CHECK_INCLUDE_HEAD` is specified, read `gitattribute`
files that are checked into the repository at the HEAD revision.
</pre>
</div>
</content>
</entry>
<entry>
<title>attr_file: ignore macros defined in subdirectories</title>
<updated>2019-07-12T07:26:22+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-07-12T07:03:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=f83469059b73c21dfa5d7861cb883de5fa2c1872'/>
<id>f83469059b73c21dfa5d7861cb883de5fa2c1872</id>
<content type='text'>
Right now, we are unconditionally applying all macros found in a
gitatttributes file. But quoting gitattributes(5):

    Custom macro attributes can be defined only in top-level
    gitattributes files ($GIT_DIR/info/attributes, the .gitattributes
    file at the top level of the working tree, or the global or
    system-wide gitattributes files), not in .gitattributes files in
    working tree subdirectories. The built-in macro attribute "binary"
    is equivalent to:

So gitattribute files in subdirectories of the working tree may
explicitly _not_ contain macro definitions, but we do not currently
enforce this limitation.

This patch introduces a new parameter to the gitattributes parser that
tells whether macros are allowed in the current file or not. If set to
`false`, we will still parse macros, but silently ignore them instead of
adding them to the list of defined macros. Update all callers to
correctly determine whether the to-be-parsed file may contain macros or
not. Most importantly, when walking up the directory hierarchy, we will
only set it to `true` once it reaches the root directory of the repo
itself.

Add a test that verifies that we are indeed not applying macros from
subdirectories. Previous to these changes, the test would've failed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Right now, we are unconditionally applying all macros found in a
gitatttributes file. But quoting gitattributes(5):

    Custom macro attributes can be defined only in top-level
    gitattributes files ($GIT_DIR/info/attributes, the .gitattributes
    file at the top level of the working tree, or the global or
    system-wide gitattributes files), not in .gitattributes files in
    working tree subdirectories. The built-in macro attribute "binary"
    is equivalent to:

So gitattribute files in subdirectories of the working tree may
explicitly _not_ contain macro definitions, but we do not currently
enforce this limitation.

This patch introduces a new parameter to the gitattributes parser that
tells whether macros are allowed in the current file or not. If set to
`false`, we will still parse macros, but silently ignore them instead of
adding them to the list of defined macros. Update all callers to
correctly determine whether the to-be-parsed file may contain macros or
not. Most importantly, when walking up the directory hierarchy, we will
only set it to `true` once it reaches the root directory of the repo
itself.

Add a test that verifies that we are indeed not applying macros from
subdirectories. Previous to these changes, the test would've failed.
</pre>
</div>
</content>
</entry>
<entry>
<title>attr: Don't fail in attr_setup if there exists a system attributes file</title>
<updated>2019-07-04T08:28:33+00:00</updated>
<author>
<name>Sven Strickroth</name>
<email>email@cs-ware.de</email>
</author>
<published>2019-06-29T14:19:08+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=18a6d9f3a82d2363ed45713a47f48ac8f383bb41'/>
<id>18a6d9f3a82d2363ed45713a47f48ac8f383bb41</id>
<content type='text'>
Regression introduced in commit 5452e49fce21f726bec19519da7f012e3f19e736 on PR #4967.

Signed-off-by: Sven Strickroth &lt;email@cs-ware.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Regression introduced in commit 5452e49fce21f726bec19519da7f012e3f19e736 on PR #4967.

Signed-off-by: Sven Strickroth &lt;email@cs-ware.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>attr: fix attribute lookup if repo has no common directory</title>
<updated>2019-06-26T12:49:24+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-06-26T12:49:24+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=82c7a9bcc6801aaa94dd63ab1add230dbc896211'/>
<id>82c7a9bcc6801aaa94dd63ab1add230dbc896211</id>
<content type='text'>
If creating a repository without a common directory (e.g. by
using `git_repository_new`), then `git_repository_item_path` will
return `GIT_ENOTFOUND` for every file that's usually located in
this directory. While we do not care for this case when looking
up the "info/attributes" file, we fail to properly ignore these
errors when setting up or collecting attributes files. Thus, the
gitattributes lookup is broken and will only ever return
`GIT_ENOTFOUND`.

Fix this issue by properly ignoring `GIT_ENOTFOUND` returned by
`git_repository_item_path`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If creating a repository without a common directory (e.g. by
using `git_repository_new`), then `git_repository_item_path` will
return `GIT_ENOTFOUND` for every file that's usually located in
this directory. While we do not care for this case when looking
up the "info/attributes" file, we fail to properly ignore these
errors when setting up or collecting attributes files. Thus, the
gitattributes lookup is broken and will only ever return
`GIT_ENOTFOUND`.

Fix this issue by properly ignoring `GIT_ENOTFOUND` returned by
`git_repository_item_path`.
</pre>
</div>
</content>
</entry>
<entry>
<title>attr: refactor setup to match current coding style</title>
<updated>2019-06-26T12:49:17+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-06-26T12:49:17+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=5452e49fce21f726bec19519da7f012e3f19e736'/>
<id>5452e49fce21f726bec19519da7f012e3f19e736</id>
<content type='text'>
The code in the `attr_setup` function is not really matching our
current coding style. Besides alignment issues, it's also hard to
see what functions calls depend on one another because they're
split up over multiple conditional statements.

Fix these issues by grouping together dependent function calls
and adjusting the alignment.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The code in the `attr_setup` function is not really matching our
current coding style. Besides alignment issues, it's also hard to
see what functions calls depend on one another because they're
split up over multiple conditional statements.

Fix these issues by grouping together dependent function calls
and adjusting the alignment.
</pre>
</div>
</content>
</entry>
<entry>
<title>attr: rename constants and macros for consistency</title>
<updated>2019-06-16T12:49:03+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2019-06-15T23:46:30+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=91a300b7f0a6b9e6ecaa940268dc9a907e8f7691'/>
<id>91a300b7f0a6b9e6ecaa940268dc9a907e8f7691</id>
<content type='text'>
Our enumeration values are not generally suffixed with `T`.  Further,
our enumeration names are generally more descriptive.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our enumeration values are not generally suffixed with `T`.  Further,
our enumeration names are generally more descriptive.
</pre>
</div>
</content>
</entry>
<entry>
<title>strmap: introduce high-level setter for key/value pairs</title>
<updated>2019-02-15T12:16:48+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-01-23T09:44:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=03555830784a2856e0c9651d2643b3ee5ce2084d'/>
<id>03555830784a2856e0c9651d2643b3ee5ce2084d</id>
<content type='text'>
Currently, one would use the function `git_strmap_insert` to insert key/value
pairs into a map. This function has historically been a macro, which is why its
syntax is kind of weird: instead of returning an error code directly, it instead
has to be passed a pointer to where the return value shall be stored. This does
not match libgit2's common idiom of directly returning error codes.

Introduce a new function `git_strmap_set`, which takes as parameters the map,
key and value and directly returns an error code. Convert all callers of
`git_strmap_insert` to make use of it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, one would use the function `git_strmap_insert` to insert key/value
pairs into a map. This function has historically been a macro, which is why its
syntax is kind of weird: instead of returning an error code directly, it instead
has to be passed a pointer to where the return value shall be stored. This does
not match libgit2's common idiom of directly returning error codes.

Introduce a new function `git_strmap_set`, which takes as parameters the map,
key and value and directly returns an error code. Convert all callers of
`git_strmap_insert` to make use of it.
</pre>
</div>
</content>
</entry>
<entry>
<title>maps: use uniform lifecycle management functions</title>
<updated>2019-02-15T12:16:48+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-01-23T09:42:46+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=351eeff3b2a666b8ead5302c1130629597438df6'/>
<id>351eeff3b2a666b8ead5302c1130629597438df6</id>
<content type='text'>
Currently, the lifecycle functions for maps (allocation, deallocation, resize)
are not named in a uniform way and do not have a uniform function signature.
Rename the functions to fix that, and stick to libgit2's naming scheme of saying
`git_foo_new`. This results in the following new interface for allocation:

- `int git_&lt;t&gt;map_new(git_&lt;t&gt;map **out)` to allocate a new map, returning an
  error code if we ran out of memory

- `void git_&lt;t&gt;map_free(git_&lt;t&gt;map *map)` to free a map

- `void git_&lt;t&gt;map_clear(git&lt;t&gt;map *map)` to remove all entries from a map

This commit also fixes all existing callers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, the lifecycle functions for maps (allocation, deallocation, resize)
are not named in a uniform way and do not have a uniform function signature.
Rename the functions to fix that, and stick to libgit2's naming scheme of saying
`git_foo_new`. This results in the following new interface for allocation:

- `int git_&lt;t&gt;map_new(git_&lt;t&gt;map **out)` to allocate a new map, returning an
  error code if we ran out of memory

- `void git_&lt;t&gt;map_free(git_&lt;t&gt;map *map)` to free a map

- `void git_&lt;t&gt;map_clear(git&lt;t&gt;map *map)` to remove all entries from a map

This commit also fixes all existing callers.
</pre>
</div>
</content>
</entry>
<entry>
<title>git_error: use new names in internal APIs and usage</title>
<updated>2019-01-22T22:30:35+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2018-12-27T19:47:34+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=f673e232afe22eb865cdc915e55a2df6493f0fbb'/>
<id>f673e232afe22eb865cdc915e55a2df6493f0fbb</id>
<content type='text'>
Move to the `git_error` name in the internal API for error-related
functions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move to the `git_error` name in the internal API for error-related
functions.
</pre>
</div>
</content>
</entry>
</feed>
