<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v1.7.8.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v1.7.8.2</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v1.7.8.2'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2011-11-18T19:55:58Z</updated>
<entry>
<title>refresh_index: make porcelain output more specific</title>
<updated>2011-11-18T19:55:58Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2011-11-18T11:13:08Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=73b7eae60c18036eab21a84e42bfa8b5297fe679'/>
<id>urn:sha1:73b7eae60c18036eab21a84e42bfa8b5297fe679</id>
<content type='text'>
If you have a deleted file and a porcelain refreshes the
cache, we print:

  Unstaged changes after reset:
  M	file

This is technically correct, in that the file is modified,
but it's friendlier to the user if we further differentiate
the case of a deleted file (especially because this output
looks a lot like "diff --name-status", which would also make
the distinction).

Similarly, we can distinguish typechanges ("T") and
intent-to-add files ("A"), both of which appear as just "M"
in the current output.

The plumbing output for all cases remains "needs update" for
historical compatibility.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refresh_index: rename format variables</title>
<updated>2011-11-18T19:55:05Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2011-11-18T11:11:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=4bd4e73093eb741a87b7d80bc84469d880f4e2f3'/>
<id>urn:sha1:4bd4e73093eb741a87b7d80bc84469d880f4e2f3</id>
<content type='text'>
When refreshing the index, for modified (or unmerged) files we will print
"needs update" (or "needs merge") for plumbing, or line similar to the
output from "diff --name-status" for porcelain.

The variables holding which type of message to show are named after the
plumbing messages. However, as we begin to differentiate more cases at the
porcelain level (with the plumbing message staying the same), that naming
scheme will become awkward.

Instead, name the variables after which case we found (modified or
unmerged), not what we will output.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: let refresh_cache_ent pass up changed flags</title>
<updated>2011-11-18T19:53:46Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2011-11-18T11:11:08Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=d05e69701053c0cf786e99251879f860702374b7'/>
<id>urn:sha1:d05e69701053c0cf786e99251879f860702374b7</id>
<content type='text'>
This will enable refresh_cache to differentiate more cases
of modification (such as typechange) when telling the user
what isn't fresh.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache.c: fix index memory allocation</title>
<updated>2011-10-26T21:35:16Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2011-10-24T01:01:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=8f41c07f90da5e314cbc428f1e3e936563f7f39d'/>
<id>urn:sha1:8f41c07f90da5e314cbc428f1e3e936563f7f39d</id>
<content type='text'>
estimate_cache_size() tries to guess how much memory is needed for the
in-memory representation of an index file.  It does that by using the
file size, the number of entries and the difference of the sizes of the
on-disk and in-memory structs -- without having to check the length of
the name of each entry, which varies for each entry, but their sums are
the same no matter the representation.

Except there can be a difference.  First of all, the size is really
calculated by ce_size and ondisk_ce_size based on offsetof(..., name),
not sizeof, which can be different.  And entries are padded with 1 to 8
NULs at the end (after the variable name) to make their total length a
multiple of eight.

So in order to allocate enough memory to hold the index, change the
delta calculation to be based on offsetof(..., name) and round up to
the next multiple of eight.

On a 32-bit Linux, this delta was used before:

	sizeof(struct cache_entry)        == 72
	sizeof(struct ondisk_cache_entry) == 64
	                                    ---
	                                      8

The actual difference for an entry with a filename length of one was,
however (find the definitions are in cache.h):

	offsetof(struct cache_entry, name)        == 72
	offsetof(struct ondisk_cache_entry, name) == 62

	ce_size        == (72 + 1 + 8) &amp; ~7 == 80
	ondisk_ce_size == (62 + 1 + 8) &amp; ~7 == 64
	                                      ---
	                                       16

So eight bytes less had been allocated for such entries.  The new
formula yields the correct delta:

	(72 - 62 + 7) &amp; ~7 == 16

Reported-by: John Hsing &lt;tsyj2007@gmail.com&gt;
Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'maint'</title>
<updated>2011-08-25T23:00:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-08-25T23:00:07Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=1952e102b702b977d6bdfcee7cb48b843cb92049'/>
<id>urn:sha1:1952e102b702b977d6bdfcee7cb48b843cb92049</id>
<content type='text'>
* maint:
  whitespace: have SP on both sides of an assignment "="
  update-ref: whitespace fix
</content>
</entry>
<entry>
<title>whitespace: have SP on both sides of an assignment "="</title>
<updated>2011-08-25T21:47:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-08-25T21:46:52Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=cd2b8ae983a277fb3f3c2b2c6747b0a075af1421'/>
<id>urn:sha1:cd2b8ae983a277fb3f3c2b2c6747b0a075af1421</id>
<content type='text'>
I've deliberately excluded the borrowed code in compat/nedmalloc
directory.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ef/maint-win-verify-path'</title>
<updated>2011-06-30T00:09:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-06-30T00:09:17Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=033c2dc4364042b9e6dbd44e82e1974f78a72567'/>
<id>urn:sha1:033c2dc4364042b9e6dbd44e82e1974f78a72567</id>
<content type='text'>
* ef/maint-win-verify-path:
  verify_dotfile(): do not assume '/' is the path seperator
  verify_path(): simplify check at the directory boundary
  verify_path: consider dos drive prefix
  real_path: do not assume '/' is the path seperator
  A Windows path starting with a backslash is absolute
</content>
</entry>
<entry>
<title>verify_dotfile(): do not assume '/' is the path seperator</title>
<updated>2011-06-08T23:34:38Z</updated>
<author>
<name>Theo Niessink</name>
<email>theo@taletn.com</email>
</author>
<published>2011-06-08T12:04:41Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e0f530ff8afbd252170f57e70a8609a83a7cabe1'/>
<id>urn:sha1:e0f530ff8afbd252170f57e70a8609a83a7cabe1</id>
<content type='text'>
verify_dotfile() currently assumes that the path seperator is '/', but on
Windows it can also be '\\', so use is_dir_sep() instead.

Signed-off-by: Theo Niessink &lt;theo@taletn.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>verify_path(): simplify check at the directory boundary</title>
<updated>2011-06-07T19:22:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-06-07T03:49:06Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3bdf09c7f555d553b4fee00c00c760b546812d4f'/>
<id>urn:sha1:3bdf09c7f555d553b4fee00c00c760b546812d4f</id>
<content type='text'>
We simply want to say "At a directory boundary, be careful with a name
that begins with a dot, forbid a name that ends with the boundary
character or has duplicated bounadry characters".

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>verify_path: consider dos drive prefix</title>
<updated>2011-05-27T17:59:18Z</updated>
<author>
<name>Erik Faye-Lund</name>
<email>kusmabite@gmail.com</email>
</author>
<published>2011-05-27T16:00:40Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=56948cb6aa8189e3b77c700119d179172e0f8c4a'/>
<id>urn:sha1:56948cb6aa8189e3b77c700119d179172e0f8c4a</id>
<content type='text'>
If someone manage to create a repo with a 'C:' entry in the
root-tree, files can be written outside of the working-dir. This
opens up a can-of-worms of exploits.

Fix it by explicitly checking for a dos drive prefix when verifying
a paht. While we're at it, make sure that paths beginning with '\' is
considered absolute as well.

Noticed-by: Theo Niessink &lt;theo@taletn.com&gt;
Signed-off-by: Erik Faye-Lund &lt;kusmabite@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
