<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/tests/attr/macro.c, branch ethomson/commit_create_cb</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: Update definition of binary macro</title>
<updated>2019-12-12T10:58:56+00:00</updated>
<author>
<name>Laurence McGlashan</name>
<email>Laurence.McGlashan@mathworks.co.uk</email>
</author>
<published>2019-12-12T10:58:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=cf286d5e0e604fd25c67c138ca5a3cd880a7e892'/>
<id>cf286d5e0e604fd25c67c138ca5a3cd880a7e892</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</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>tests: attr: verify that in-memory macros are respected</title>
<updated>2019-07-12T07:26:02+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-07-12T07:02:16+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=df417a4325ddcc209bd208be197faf53a21e52d7'/>
<id>df417a4325ddcc209bd208be197faf53a21e52d7</id>
<content type='text'>
Add some tests to ensure that the `git_attr_add_macro` function works as
expected.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add some tests to ensure that the `git_attr_add_macro` function works as
expected.
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: attr: implement tests to verify attribute rewriting behaviour</title>
<updated>2019-07-12T07:01:57+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-07-05T06:10:33+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=4a7f704fdb4f8dc2fa59eb664558c9a6d60ebad4'/>
<id>4a7f704fdb4f8dc2fa59eb664558c9a6d60ebad4</id>
<content type='text'>
Implement some tests that verify that we are correctly updating
gitattributes when rewriting or unlinking the corresponding files.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement some tests that verify that we are correctly updating
gitattributes when rewriting or unlinking the corresponding files.
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: attr: extract macro tests into their own suite</title>
<updated>2019-07-12T07:01:57+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-07-05T05:45:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/libgit2.git/commit/?id=ed854aa0953b7f10a34841f776ccb5b6c915c7d6'/>
<id>ed854aa0953b7f10a34841f776ccb5b6c915c7d6</id>
<content type='text'>
As macros are a specific functionality in the gitattributes code, it
makes sense to extract them into their own test suite, too. This makes
finding macro-related tests easier.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As macros are a specific functionality in the gitattributes code, it
makes sense to extract them into their own test suite, too. This makes
finding macro-related tests easier.
</pre>
</div>
</content>
</entry>
</feed>
