<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/dir.h, branch v2.4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.4.9</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-03-26T18:57:13Z</updated>
<entry>
<title>Merge branch 'jc/report-path-error-to-dir'</title>
<updated>2015-03-26T18:57:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-26T18:57:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=574ee8ae8636ffad8146e0f8e648b866dad725e6'/>
<id>urn:sha1:574ee8ae8636ffad8146e0f8e648b866dad725e6</id>
<content type='text'>
Code clean-up.

* jc/report-path-error-to-dir:
  report_path_error(): move to dir.c
</content>
</entry>
<entry>
<title>report_path_error(): move to dir.c</title>
<updated>2015-03-24T21:12:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-24T21:12:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=777c55a61615837d4391facd75cf334b96635801'/>
<id>urn:sha1:777c55a61615837d4391facd75cf334b96635801</id>
<content type='text'>
The expected call sequence is for the caller to use match_pathspec()
repeatedly on a set of pathspecs, accumulating the "hits" in a
separate array, and then call this function to diagnose a pathspec
that never matched anything, as that can indicate a typo from the
command line, e.g. "git commit Maekfile".

Many builtin commands use this function from builtin/ls-files.c,
which is not a very healthy arrangement.  ls-files might have been
the first command to feel the need for such a helper, but the need
is shared by everybody who uses the "match and then report" pattern.

Move it to dir.c where match_pathspec() is defined.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>prep_exclude: remove the artificial PATH_MAX limit</title>
<updated>2014-07-14T22:24:34Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-07-14T09:50:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aceb9429b37a4a36e91f9eeb60e7ba488f73604b'/>
<id>urn:sha1:aceb9429b37a4a36e91f9eeb60e7ba488f73604b</id>
<content type='text'>
This fixes a segfault in git-status with long paths on Windows,
where PATH_MAX is only 260.

This also fixes the problem of silently ignoring .gitignore if the
full path exceeds PATH_MAX. Now add_excludes_from_file() will report
if it gets ENAMETOOLONG.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>dir.h: move struct exclude declaration to top level</title>
<updated>2014-07-14T22:24:34Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-07-14T09:48:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=709359c85cf366df68a1cabf9d68978c05c541c5'/>
<id>urn:sha1:709359c85cf366df68a1cabf9d68978c05c541c5</id>
<content type='text'>
There is no actual nested struct here. Move it out for clarity.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Karsten Blees &lt;blees@dcon.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec: pass directory indicator to match_pathspec_item()</title>
<updated>2014-02-24T22:37:19Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-01-24T13:40:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ae8d0824217bdf97c69ead49568cd03fc140627b'/>
<id>urn:sha1:ae8d0824217bdf97c69ead49568cd03fc140627b</id>
<content type='text'>
This patch activates the DO_MATCH_DIRECTORY code in m_p_i(), which
makes "git diff HEAD submodule/" and "git diff HEAD submodule" produce
the same output. Previously only the version without trailing slash
returns the difference (if any).

That's the effect of new ce_path_match(). dir_path_match() is not
executed by the new tests. And it should not introduce regressions.

Previously if path "dir/" is passed in with pathspec "dir/", they
obviously match. With new dir_path_match(), the path becomes
_directory_ "dir" vs pathspec "dir/", which is not executed by the old
code path in m_p_i(). The new code path is executed and produces the
same result.

The other case is pathspec "dir" and path "dir/" is now turned to
"dir" (with DO_MATCH_DIRECTORY). Still the same result before or after
the patch.

So why change? Because of the next patch about clean.c.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec: rename match_pathspec_depth() to match_pathspec()</title>
<updated>2014-02-24T22:37:14Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-01-24T13:40:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=854b09592ce9a497f56f35d973c4abe43af84cd1'/>
<id>urn:sha1:854b09592ce9a497f56f35d973c4abe43af84cd1</id>
<content type='text'>
A long time ago, for some reason I was not happy with
match_pathspec(). I created a better version, match_pathspec_depth()
that was suppose to replace match_pathspec()
eventually. match_pathspec() has finally been gone since 6 months
ago. Use the shorter name for match_pathspec_depth().

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec: convert some match_pathspec_depth() to dir_path_match()</title>
<updated>2014-02-24T22:37:09Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-01-24T13:40:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ebb32893bad46bf5edae881552672a47dd2684b8'/>
<id>urn:sha1:ebb32893bad46bf5edae881552672a47dd2684b8</id>
<content type='text'>
This helps reduce the number of match_pathspec_depth() call sites and
show how m_p_d() is used. And it usage is:

 - match against an index entry (ce_path_match or match_pathspec_depth
   in ls-files)

 - match against a dir_entry from read_directory (dir_path_match and
   match_pathspec_depth in clean.c, which will be converted later)

 - resolve-undo (rerere.c and ls-files.c)

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pathspec: convert some match_pathspec_depth() to ce_path_match()</title>
<updated>2014-02-24T22:36:52Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-01-24T13:40:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=429bb40abdb5b42ffdde5b1a58f9a37da723d179'/>
<id>urn:sha1:429bb40abdb5b42ffdde5b1a58f9a37da723d179</id>
<content type='text'>
This helps reduce the number of match_pathspec_depth() call sites and
show how match_pathspec_depth() is used.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/ls-files-killed-optim'</title>
<updated>2013-09-11T22:03:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-09-11T22:03:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4c4d9d9b654db3eecb6e1107e814a737eafce0d6'/>
<id>urn:sha1:4c4d9d9b654db3eecb6e1107e814a737eafce0d6</id>
<content type='text'>
"git ls-files -k" needs to crawl only the part of the working tree
that may overlap the paths in the index to find killed files, but
shared code with the logic to find all the untracked files, which
made it unnecessarily inefficient.

* jc/ls-files-killed-optim:
  dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage
  t3010: update to demonstrate "ls-files -k" optimization pitfalls
  ls-files -k: a directory only can be killed if the index has a non-directory
  dir.c: use the cache_* macro to access the current index
</content>
</entry>
<entry>
<title>ls-files -k: a directory only can be killed if the index has a non-directory</title>
<updated>2013-08-15T20:50:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-08-15T19:13:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2eac2a4cc4bdc8d77b31204bc20751cb56f0d575'/>
<id>urn:sha1:2eac2a4cc4bdc8d77b31204bc20751cb56f0d575</id>
<content type='text'>
"ls-files -o" and "ls-files -k" both traverse the working tree down
to find either all untracked paths or those that will be "killed"
(removed from the working tree to make room) when the paths recorded
in the index are checked out.  It is necessary to traverse the
working tree fully when enumerating all the "other" paths, but when
we are only interested in "killed" paths, we can take advantage of
the fact that paths that do not overlap with entries in the index
can never be killed.

The treat_one_path() helper function, which is called during the
recursive traversal, is the ideal place to implement an
optimization.

When we are looking at a directory P in the working tree, there are
three cases:

 (1) P exists in the index.  Everything inside the directory P in
     the working tree needs to go when P is checked out from the
     index.

 (2) P does not exist in the index, but there is P/Q in the index.
     We know P will stay a directory when we check out the contents
     of the index, but we do not know yet if there is a directory
     P/Q in the working tree to be killed, so we need to recurse.

 (3) P does not exist in the index, and there is no P/Q in the index
     to require P to be a directory, either.  Only in this case, we
     know that everything inside P will not be killed without
     recursing.

Note that this helper is called by treat_leading_path() that decides
if we need to traverse only subdirectories of a single common
leading directory, which is essential for this optimization to be
correct.  This caller checks each level of the leading path
component from shallower directory to deeper ones, and that is what
allows us to only check if the path appears in the index.  If the
call to treat_one_path() weren't there, given a path P/Q/R, the real
traversal may start from directory P/Q/R, even when the index
records P as a regular file, and we would end up having to check if
any leading subpath in P/Q/R, e.g. P, appears in the index.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
