<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/tests/status/ignore.c, branch cmn/https-cap-no-hardcode</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>ignore: allow unignoring basenames in subdirectories</title>
<updated>2016-08-12T12:47:54+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2016-08-12T07:06:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=fcb2c1c8956200f49263e6e0b3c681d100af4734'/>
<id>fcb2c1c8956200f49263e6e0b3c681d100af4734</id>
<content type='text'>
The .gitignore file allows for patterns which unignore previous
ignore patterns. When unignoring a previous pattern, there are
basically three cases how this is matched when no globbing is
used:

1. when a previous file has been ignored, it can be unignored by
   using its exact name, e.g.

   foo/bar
   !foo/bar

2. when a file in a subdirectory has been ignored, it can be
   unignored by using its basename, e.g.

   foo/bar
   !bar

3. when all files with a basename are ignored, a specific file
   can be unignored again by specifying its path in a
   subdirectory, e.g.

   bar
   !foo/bar

The first problem in libgit2 is that we did not correctly treat
the second case. While we verified that the negative pattern
matches the tail of the positive one, we did not verify if it
only matches the basename of the positive pattern. So e.g. we
would have also negated a pattern like

    foo/fruz_bar
    !bar

Furthermore, we did not check for the third case, where a
basename is being unignored in a certain subdirectory again.

Both issues are fixed with this commit.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The .gitignore file allows for patterns which unignore previous
ignore patterns. When unignoring a previous pattern, there are
basically three cases how this is matched when no globbing is
used:

1. when a previous file has been ignored, it can be unignored by
   using its exact name, e.g.

   foo/bar
   !foo/bar

2. when a file in a subdirectory has been ignored, it can be
   unignored by using its basename, e.g.

   foo/bar
   !bar

3. when all files with a basename are ignored, a specific file
   can be unignored again by specifying its path in a
   subdirectory, e.g.

   bar
   !foo/bar

The first problem in libgit2 is that we did not correctly treat
the second case. While we verified that the negative pattern
matches the tail of the positive one, we did not verify if it
only matches the basename of the positive pattern. So e.g. we
would have also negated a pattern like

    foo/fruz_bar
    !bar

Furthermore, we did not check for the third case, where a
basename is being unignored in a certain subdirectory again.

Both issues are fixed with this commit.
</pre>
</div>
</content>
</entry>
<entry>
<title>git_futils_mkdir_*: make a relative-to-base mkdir</title>
<updated>2015-09-17T14:00:35+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@microsoft.com</email>
</author>
<published>2015-09-16T19:07:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=ac2fba0ecd68e8eae348dec688cbcd0828432cdf'/>
<id>ac2fba0ecd68e8eae348dec688cbcd0828432cdf</id>
<content type='text'>
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
assumes that we own everything beneath the base, as if it were
being called with a base of the repository or working directory,
and is tailored towards checkout and ensuring that there is no
bogosity beneath the base that must be cleaned up.

This is (at best) slow and (at worst) unsafe in the larger context
of a filesystem where we do not own things and cannot do things like
unlink symlinks that are in our way.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
assumes that we own everything beneath the base, as if it were
being called with a base of the repository or working directory,
and is tailored towards checkout and ensuring that there is no
bogosity beneath the base that must be cleaned up.

This is (at best) slow and (at worst) unsafe in the larger context
of a filesystem where we do not own things and cannot do things like
unlink symlinks that are in our way.
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: add test and adjust style and comment for dir with wildmatch</title>
<updated>2015-09-13T04:18:49+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2015-09-13T04:18:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=657afd359e0e49627addb092c05ddd00117614de'/>
<id>657afd359e0e49627addb092c05ddd00117614de</id>
<content type='text'>
The previous commit left the comment referencing the earlier state of
the code, change it to explain the current logic. While here, change the
logic to avoid repeating the copy of the base pattern.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous commit left the comment referencing the earlier state of
the code, change it to explain the current logic. While here, change the
logic to avoid repeating the copy of the base pattern.
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: clear the error when matching a pattern negation</title>
<updated>2015-05-20T19:49:02+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2015-05-20T19:18:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=2c57114f1117ea94e3023d989018748be76d52eb'/>
<id>2c57114f1117ea94e3023d989018748be76d52eb</id>
<content type='text'>
When we discover that we want to keep a negative rule, make sure to
clear the error variable, as it we otherwise return whatever was left by
the previous loop iteration.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we discover that we want to keep a negative rule, make sure to
clear the error variable, as it we otherwise return whatever was left by
the previous loop iteration.
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: fix negative ignores without wildcards.</title>
<updated>2015-04-17T07:59:16+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2015-03-24T15:33:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=4f3586034b3db317d360de87bd962de1ef3d524e'/>
<id>4f3586034b3db317d360de87bd962de1ef3d524e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: adjust test for negating inside a dir</title>
<updated>2014-12-05T18:43:36+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-12-05T15:31:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=e0a97416d417895cb94d519ad0f16942051d302b'/>
<id>e0a97416d417895cb94d519ad0f16942051d302b</id>
<content type='text'>
Given

    top
    !top/foo

in an ignore file, we should not unignore top/foo. This is an
implementation detail of the git code leaking, but that's the behaviour
we should show.

A negation rule can only negate an exact rule it has seen before.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Given

    top
    !top/foo

in an ignore file, we should not unignore top/foo. This is an
implementation detail of the git code leaking, but that's the behaviour
we should show.

A negation rule can only negate an exact rule it has seen before.
</pre>
</div>
</content>
</entry>
<entry>
<title>Plug leaks</title>
<updated>2014-11-23T14:51:31+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-11-23T13:12:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=f7fcb18f8a7541bfc0228967fcbd916a9f515638'/>
<id>f7fcb18f8a7541bfc0228967fcbd916a9f515638</id>
<content type='text'>
Valgrind is now clean except for libssl and libgcrypt.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Valgrind is now clean except for libssl and libgcrypt.
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: add failing test for a file mentioning the parent</title>
<updated>2014-11-06T09:10:26+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-10-04T09:48:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=0798b01400315db85715277d00f7a1262a5ed125'/>
<id>0798b01400315db85715277d00f7a1262a5ed125</id>
<content type='text'>
When we mention "src" in src/.gitignore, we wrongly consider src/ itself
to be ignored.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we mention "src" in src/.gitignore, we wrongly consider src/ itself
to be ignored.
</pre>
</div>
</content>
</entry>
<entry>
<title>ignore: consider files with a CR in their names</title>
<updated>2014-11-05T15:22:01+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2014-11-05T15:07:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=5c54e2162a21cb909e961c62f53e7d4c64f80cb0'/>
<id>5c54e2162a21cb909e961c62f53e7d4c64f80cb0</id>
<content type='text'>
We currently consider CR to start the end of the line, but that means
that we miss cases with CR CR LF which can be used with git to match
files whose names have CR at the end of their names.

The fix from the patch comes from Russell's comment in the issue.

This fixes #2536.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We currently consider CR to start the end of the line, but that means
that we miss cases with CR CR LF which can be used with git to match
files whose names have CR at the end of their names.

The fix from the patch comes from Russell's comment in the issue.

This fixes #2536.
</pre>
</div>
</content>
</entry>
<entry>
<title>Demonstrate a trailing slash failure.</title>
<updated>2014-08-08T22:19:16+00:00</updated>
<author>
<name>Rob Rix</name>
<email>rob.rix@github.com</email>
</author>
<published>2014-06-12T18:19:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=bbe13802b7f85343d3db1aeb799662ee11461e6b'/>
<id>bbe13802b7f85343d3db1aeb799662ee11461e6b</id>
<content type='text'>
`git help ignore` has this to say about trailing slashes:

&gt; If the pattern ends with a slash, it is removed for the purpose of
&gt; the following description, but it would only find a match with a
&gt; directory. In other words, foo/ will match a directory foo and
&gt; paths underneath it, but will not match a regular file or a
&gt; symbolic link foo (this is consistent with the way how pathspec
&gt; works in general in Git).

Sure enough, having manually performed the same steps as this test,
`git status` tells us the following:

	# On branch master
	#
	# Initial commit
	#
	# Changes to be committed:
	#   (use "git rm --cached &lt;file&gt;..." to unstage)
	#
	#	new file:   force.txt
	#
	# Untracked files:
	#   (use "git add &lt;file&gt;..." to include in what will be committed)
	#
	#	../.gitignore
	#	child1/
	#	child2/

i.e. neither child1 nor child2 is ignored.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`git help ignore` has this to say about trailing slashes:

&gt; If the pattern ends with a slash, it is removed for the purpose of
&gt; the following description, but it would only find a match with a
&gt; directory. In other words, foo/ will match a directory foo and
&gt; paths underneath it, but will not match a regular file or a
&gt; symbolic link foo (this is consistent with the way how pathspec
&gt; works in general in Git).

Sure enough, having manually performed the same steps as this test,
`git status` tells us the following:

	# On branch master
	#
	# Initial commit
	#
	# Changes to be committed:
	#   (use "git rm --cached &lt;file&gt;..." to unstage)
	#
	#	new file:   force.txt
	#
	# Untracked files:
	#   (use "git add &lt;file&gt;..." to include in what will be committed)
	#
	#	../.gitignore
	#	child1/
	#	child2/

i.e. neither child1 nor child2 is ignored.
</pre>
</div>
</content>
</entry>
</feed>
