<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/tests/attr, branch ethomson/codeql</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/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://git.baserock.org/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>fileops: rename to "futils.h" to match function signatures</title>
<updated>2019-07-20T17:11:20+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-06-29T07:17:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=e54343a4024e75dfaa940e652c2c9799d33634b2'/>
<id>e54343a4024e75dfaa940e652c2c9799d33634b2</id>
<content type='text'>
Our file utils functions all have a "futils" prefix, e.g.
`git_futils_touch`. One would thus naturally guess that their
definitions and implementation would live in files "futils.h" and
"futils.c", respectively, but in fact they live in "fileops.h".

Rename the files to match expectations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our file utils functions all have a "futils" prefix, e.g.
`git_futils_touch`. One would thus naturally guess that their
definitions and implementation would live in files "futils.h" and
"futils.c", respectively, but in fact they live in "fileops.h".

Rename the files to match expectations.
</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://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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>
<entry>
<title>tests: attr: add tests for system-level attributes</title>
<updated>2019-07-04T09:49:16+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-07-04T09:45:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=c87abeca9ee68a89fa3a6776aa7d44f9d14de6e7'/>
<id>c87abeca9ee68a89fa3a6776aa7d44f9d14de6e7</id>
<content type='text'>
There were no tests that verified that system-level gitattributes files
get handled correctly. In fact, we have recently introduced a regression
that caused us to abort if there was a system-level gitattributes file
available.

Add two tests that verify that we're able to handle system-level
gitattributes files. The test attr::repo::sysdir_with_session would've
failed without the fix to the described regression.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There were no tests that verified that system-level gitattributes files
get handled correctly. In fact, we have recently introduced a regression
that caused us to abort if there was a system-level gitattributes file
available.

Add two tests that verify that we're able to handle system-level
gitattributes files. The test attr::repo::sysdir_with_session would've
failed without the fix to the described regression.
</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://git.baserock.org/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>tests: unify ignore tests into their own dir</title>
<updated>2019-06-07T08:33:41+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-06-07T06:29:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=01dda5fffcc8527d20eb65045f68c8f30697cba9'/>
<id>01dda5fffcc8527d20eb65045f68c8f30697cba9</id>
<content type='text'>
We had several occasions where tests for the gitignore had been
added to status::ignore instead of the easier-to-handle
attr::ignore test suite. This most likely resulted from the fact
that the attr::ignore test suite is not easy to discover inside
of the attr folder. Furthermore, ignore being part of the
attributes code is an implementation detail, only, and thus
shouldn't be stressed as much.

Improve this by moving both attr::ignore and status::ignore tests
into a new ignore test suite.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We had several occasions where tests for the gitignore had been
added to status::ignore instead of the easier-to-handle
attr::ignore test suite. This most likely resulted from the fact
that the attr::ignore test suite is not easy to discover inside
of the attr folder. Furthermore, ignore being part of the
attributes code is an implementation detail, only, and thus
shouldn't be stressed as much.

Improve this by moving both attr::ignore and status::ignore tests
into a new ignore test suite.
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: handle escaped trailing whitespace</title>
<updated>2019-06-06T12:44:43+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-06-06T12:11:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=d81e7866aba52625aa3100764d77c73adba58c8e'/>
<id>d81e7866aba52625aa3100764d77c73adba58c8e</id>
<content type='text'>
The gitignore's pattern format specifies that "Trailing spaces
are ignored unless they are quoted with backslash ("\")". We do
not honor this currently and will treat a pattern "foo\ " as if
it was "foo\" only and a pattern "foo\ \ " as "foo\ \".

Fix our code to handle those special cases and add tests to avoid
regressions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The gitignore's pattern format specifies that "Trailing spaces
are ignored unless they are quoted with backslash ("\")". We do
not honor this currently and will treat a pattern "foo\ " as if
it was "foo\" only and a pattern "foo\ \ " as "foo\ \".

Fix our code to handle those special cases and add tests to avoid
regressions.
</pre>
</div>
</content>
</entry>
</feed>
