<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/entry.c, branch v1.6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.6.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2009-04-20T19:14:02Z</updated>
<entry>
<title>Windows: Skip fstat/lstat optimization in write_entry()</title>
<updated>2009-04-20T19:14:02Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2009-04-20T08:17:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=34779c535c4e121414197ab08b4b502a22a75433'/>
<id>urn:sha1:34779c535c4e121414197ab08b4b502a22a75433</id>
<content type='text'>
Commit e4c72923 (write_entry(): use fstat() instead of lstat() when file
is open, 2009-02-09) introduced an optimization of write_entry().
Unfortunately, we cannot take advantage of this optimization on Windows
because there is no guarantee that the time stamps are updated before the
file is closed:

  "The only guarantee about a file timestamp is that the file time is
   correctly reflected when the handle that makes the change is closed."

(http://msdn.microsoft.com/en-us/library/ms724290(VS.85).aspx)

The failure of this optimization on Windows can be observed most easily by
running a 'git checkout' that has to update several large files. In this
case, 'git checkout' will report modified files, but infact only the
timestamps were incorrectly recorded in the index, as can be verified by a
subsequent 'git diff', which shows no change.

Dmitry Potapov reports the same fix needs on Cygwin; this commit contains
his updates for that.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_entry(): use fstat() instead of lstat() when file is open</title>
<updated>2009-02-10T04:59:26Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-02-09T20:54:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e4c7292353dbef39feac1c6a60c5cde9140520a6'/>
<id>urn:sha1:e4c7292353dbef39feac1c6a60c5cde9140520a6</id>
<content type='text'>
Currently inside write_entry() we do an lstat(path, &amp;st) call on a
file which have just been opened inside the exact same function.  It
should be better to call fstat(fd, &amp;st) on the file while it is open,
and it should be at least as fast as the lstat() method.

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_entry(): cleanup of some duplicated code</title>
<updated>2009-02-10T04:59:26Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-02-09T20:54:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4857c761e35b07c12ff2ef1140e93b071b8ac4e7'/>
<id>urn:sha1:4857c761e35b07c12ff2ef1140e93b071b8ac4e7</id>
<content type='text'>
The switch-cases for S_IFREG and S_IFLNK was so similar that it will
be better to do some cleanup and use the common parts of it.

And the entry.c file should now be clean for 'gcc -Wextra' warnings.

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>create_directories(): remove some memcpy() and strchr() calls</title>
<updated>2009-02-10T04:59:26Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-02-09T20:54:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=81a9aa60a193f1181149b69920930e15c4e34059'/>
<id>urn:sha1:81a9aa60a193f1181149b69920930e15c4e34059</id>
<content type='text'>
Remove the call to memcpy() and strchr() for each path component
tested, and instead add each path component as we go forward inside
the while-loop.

Impact: small optimisation

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lstat_cache(): swap func(length, string) into func(string, length)</title>
<updated>2009-02-10T04:59:26Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-02-09T20:54:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=571998921d8fd4ee674545406aabb86987921252'/>
<id>urn:sha1:571998921d8fd4ee674545406aabb86987921252</id>
<content type='text'>
Swap function argument pair (length, string) into (string, length) to
conform with the commonly used order inside the GIT source code.

Also, add a note about this fact into the coding guidelines.

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'kb/lstat-cache'</title>
<updated>2009-01-26T01:13:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-01-26T01:13:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0990e7aaaa63ca908dbdfc379af132068e4b066f'/>
<id>urn:sha1:0990e7aaaa63ca908dbdfc379af132068e4b066f</id>
<content type='text'>
* kb/lstat-cache:
  lstat_cache(): introduce clear_lstat_cache() function
  lstat_cache(): introduce invalidate_lstat_cache() function
  lstat_cache(): introduce has_dirs_only_path() function
  lstat_cache(): introduce has_symlink_or_noent_leading_path() function
  lstat_cache(): more cache effective symlink/directory detection
</content>
</entry>
<entry>
<title>lstat_cache(): introduce has_dirs_only_path() function</title>
<updated>2009-01-18T21:54:54Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-01-18T15:14:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bad4a54fa6fe8a9bbdfb5c3e413268eefde69b75'/>
<id>urn:sha1:bad4a54fa6fe8a9bbdfb5c3e413268eefde69b75</id>
<content type='text'>
The create_directories() function in entry.c currently calls stat()
or lstat() for each path component of the pathname 'path' each and every
time.  For the 'git checkout' command, this function is called on each
file for which we must do an update (ce-&gt;ce_flags &amp; CE_UPDATE), so we get
lots and lots of calls.

To fix this, we make a new wrapper to the lstat_cache() function, and
call the wrapper function instead of the calls to the stat() or the
lstat() functions.  Since the paths given to the create_directories()
function, is sorted alphabetically, the new wrapper would be very
cache effective in this situation.

To support it we must update the lstat_cache() function to be able to
say that "please test the complete length of 'name'", and also to give
it the length of a prefix, where the cache should use the stat()
function instead of the lstat() function to test each path component.

Thanks to Junio C Hamano, Linus Torvalds and Rene Scharfe for valuable
comments to this patch!

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add is_dot_or_dotdot inline function</title>
<updated>2009-01-11T21:21:57Z</updated>
<author>
<name>Alexander Potashev</name>
<email>aspotashev@gmail.com</email>
</author>
<published>2009-01-10T12:07:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8ca12c0d62c0be4a4987c4a936467ea2a92e915a'/>
<id>urn:sha1:8ca12c0d62c0be4a4987c4a936467ea2a92e915a</id>
<content type='text'>
A new inline function is_dot_or_dotdot is used to check if the
directory name is either "." or "..". It returns a non-zero value if
the given string is "." or "..". It's applicable to a lot of Git
source code.

Signed-off-by: Alexander Potashev &lt;aspotashev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>'git foo' program identifies itself without dash in die() messages</title>
<updated>2008-08-31T16:39:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-08-31T16:39:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7e44c93558e7c0b12624d76cf07753d0480ed96a'/>
<id>urn:sha1:7e44c93558e7c0b12624d76cf07753d0480ed96a</id>
<content type='text'>
This is a mechanical conversion of all '*.c' files with:

	s/((?:die|error|warning)\("git)-(\S+:)/$1 $2/;

The result was manually inspected and no false positive was found.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Fix possible Solaris problem in 'checkout_entry()'</title>
<updated>2008-03-19T05:18:57Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-03-17T15:56:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=971f229c50aeace83d6fd30de1de755f419d4cb8'/>
<id>urn:sha1:971f229c50aeace83d6fd30de1de755f419d4cb8</id>
<content type='text'>
Currently when checking out an entry "path", we try to unlink(2) it first
(because there could be stale file), and if there is a directory there,
try to deal with it (typically we run recursive rmdir).  We ignore the
error return from this unlink because there may not even be any file
there.

However if you are root on Solaris, you can unlink(2) a directory
successfully and corrupt your filesystem.

This moves the code around and check the directory first, and then
unlink(2).  Also we check the error code from it.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
