<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.5.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.5.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.5.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-06-24T19:21:49Z</updated>
<entry>
<title>Merge branch 'nd/untracked-cache'</title>
<updated>2015-06-24T19:21:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-24T19:21:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f59058e490fa72c09faa974addfeeb2868dc648'/>
<id>urn:sha1:6f59058e490fa72c09faa974addfeeb2868dc648</id>
<content type='text'>
Hotfix for the 'untracked-cache' topic that is already in 'master'.

* nd/untracked-cache:
  read-cache: fix untracked cache invalidation when split-index is used
</content>
</entry>
<entry>
<title>Merge branch 'jk/diagnose-config-mmap-failure'</title>
<updated>2015-06-11T16:29:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-11T16:29:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dee47925c1d001947cf9a099e1cb883835f90c64'/>
<id>urn:sha1:dee47925c1d001947cf9a099e1cb883835f90c64</id>
<content type='text'>
The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index
</content>
</entry>
<entry>
<title>read-cache: fix untracked cache invalidation when split-index is used</title>
<updated>2015-06-08T16:45:19Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2015-06-07T10:40:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ffcc9ba763a8591119cb28877c84499a7854bff9'/>
<id>urn:sha1:ffcc9ba763a8591119cb28877c84499a7854bff9</id>
<content type='text'>
Before this change, t7063.17 fails. The actual action though happens at
t7063.16 where the entry "two" is added back to index after being
removed in the .13. Here we expect a directory invalidate at .16 and
none at .17 where untracked cache is refreshed. But things do not go as
expected when GIT_TEST_SPLIT_INDEX is set.

The different behavior that happens at .16 when split index is used: the
entry "two", when deleted at .13, is simply marked "deleted". When .16
executes, the entry resurfaces from the version in base index. This
happens in merge_base_index() where add_index_entry() is called to add
"two" back from the base index.

This is where the bug comes from. The add_index_entry() is called with
ADD_CACHE_KEEP_CACHE_TREE flag because this version of "two" is not new,
it does not break either cache-tree or untracked cache. The code should
check this flag and not invalidate untracked cache. This causes a second
invalidation violates test expectation. The fix is obvious.

Noticed-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
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>read-cache.c: drop PROT_WRITE from mmap of index</title>
<updated>2015-05-28T18:32:04Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-05-28T07:54:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a1293ef7c3690829a6ac47fc45f3f26b96b5c9f5'/>
<id>urn:sha1:a1293ef7c3690829a6ac47fc45f3f26b96b5c9f5</id>
<content type='text'>
Once upon a time, git's in-memory representation of a cache
entry actually pointed to the mmap'd on-disk data. So in
520fc24 (Allow writing to the private index file mapping.,
2005-04-26), we specified PROT_WRITE so that we could tweak
the entries while we run (in our own MAP_PRIVATE copy-on-write
version, of course).

Later, 7a51ed6 (Make on-disk index representation separate
from in-core one, 2008-01-14) stopped doing this; we copy
the data into our in-core representation, and then drop the
mmap immediately. We can therefore drop the PROT_WRITE flag.
It's probably not hurting anything as it is, but it's
potentially confusing.

Note that we could also mark the mapping as "const" to
verify that we never write to it. However, we don't
typically do that for our other maps, as it then requires
casting to munmap() it.

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>Merge branch 'nd/untracked-cache'</title>
<updated>2015-05-26T20:24:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-26T20:24:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=38ccaf93bbf5a99dbff908068292ffaa5bafe25e'/>
<id>urn:sha1:38ccaf93bbf5a99dbff908068292ffaa5bafe25e</id>
<content type='text'>
Teach the index to optionally remember already seen untracked files
to speed up "git status" in a working tree with tons of cruft.

* nd/untracked-cache: (24 commits)
  git-status.txt: advertisement for untracked cache
  untracked cache: guard and disable on system changes
  mingw32: add uname()
  t7063: tests for untracked cache
  update-index: test the system before enabling untracked cache
  update-index: manually enable or disable untracked cache
  status: enable untracked cache
  untracked-cache: temporarily disable with $GIT_DISABLE_UNTRACKED_CACHE
  untracked cache: mark index dirty if untracked cache is updated
  untracked cache: print stats with $GIT_TRACE_UNTRACKED_STATS
  untracked cache: avoid racy timestamps
  read-cache.c: split racy stat test to a separate function
  untracked cache: invalidate at index addition or removal
  untracked cache: load from UNTR index extension
  untracked cache: save to an index extension
  ewah: add convenient wrapper ewah_serialize_strbuf()
  untracked cache: don't open non-existent .gitignore
  untracked cache: mark what dirs should be recursed/saved
  untracked cache: record/validate dir mtime and reuse cached output
  untracked cache: make a wrapper around {open,read,close}dir()
  ...
</content>
</entry>
<entry>
<title>Merge branch 'sb/leaks'</title>
<updated>2015-03-27T20:02:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-27T20:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=553c622b685f0a7a83c77617377f08019d76c682'/>
<id>urn:sha1:553c622b685f0a7a83c77617377f08019d76c682</id>
<content type='text'>
* sb/leaks:
  http: release the memory of a http pack request as well
  read-cache: fix memleak
  add_to_index(): free unused cache-entry
  commit.c: fix a memory leak
  http-push: remove unneeded cleanup
  merge-recursive: fix memleaks
  merge-blobs.c: fix a memleak
  builtin/apply.c: fix a memleak
  update-index: fix a memleak
  read-cache: free cache entry in add_to_index in case of early return
</content>
</entry>
<entry>
<title>Merge branch 'tg/fix-check-order-with-split-index'</title>
<updated>2015-03-25T19:54:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-25T19:54:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a801bb8c297737d99a0b20d61a3a956f0c92a3b9'/>
<id>urn:sha1:a801bb8c297737d99a0b20d61a3a956f0c92a3b9</id>
<content type='text'>
The split-index mode introduced at v2.3.0-rc0~41 was broken in the
codepath to protect us against a broken reimplementation of Git
that writes an invalid index with duplicated index entries, etc.

* tg/fix-check-order-with-split-index:
  read-cache: fix reading of split index
</content>
</entry>
<entry>
<title>read-cache: fix memleak</title>
<updated>2015-03-23T18:12:59Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2015-03-23T17:57:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=915e44c6357f3bd9d5fa498a201872c4367302d3'/>
<id>urn:sha1:915e44c6357f3bd9d5fa498a201872c4367302d3</id>
<content type='text'>
`ce` is allocated in make_cache_entry and should be freed if it is not
used any more. refresh_cache_entry as a wrapper around refresh_cache_ent
will either return

 - the `ce` given as the parameter, when it was up-to-date;
 - a new updated cache entry which is allocated to new memory; or
 - a NULL when refreshing failed.

In the latter two cases, the original cache-entry `ce` is not used
and needs to be freed.  The rule can be expressed as "if the return
value from refresh is different from the original ce, ce is no
longer used."

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add_to_index(): free unused cache-entry</title>
<updated>2015-03-23T18:12:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-23T17:58:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=067178ed8a7822e6bc88ad606b707fc33658e6fc'/>
<id>urn:sha1:067178ed8a7822e6bc88ad606b707fc33658e6fc</id>
<content type='text'>
We allocate a cache-entry pretty early in the function and then
decide either not to do anything when we are pretending to add, or
add it and then get an error (another possibility is obviously to
succeed).

When pretending or failing to add, we forgot to free the
cache-entry.

Noticed during a discussion on Stefan's patch to change the coding
style without fixing the issue ;-)

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: free cache entry in add_to_index in case of early return</title>
<updated>2015-03-22T19:11:25Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2015-03-21T00:28:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2d9426b049335c1a39be7ea7416094e944bfe63c'/>
<id>urn:sha1:2d9426b049335c1a39be7ea7416094e944bfe63c</id>
<content type='text'>
This frees `ce` would be leaking in the error path.

Additionally a free is moved towards the return. This helps code
readability as we often have this pattern of freeing resources just
before return/exit and not in between the code.

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