<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.16.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.16.3</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.16.3'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2018-03-22T21:24:16Z</updated>
<entry>
<title>Merge branch 'nd/shared-index-fix' into maint</title>
<updated>2018-03-22T21:24:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-03-22T21:24:16Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3112c3fa7fdc7209e4c832a9faf4f023e97a4f5e'/>
<id>urn:sha1:3112c3fa7fdc7209e4c832a9faf4f023e97a4f5e</id>
<content type='text'>
Code clean-up.

* nd/shared-index-fix:
  read-cache: don't write index twice if we can't write shared index
  read-cache.c: move tempfile creation/cleanup out of write_shared_index
  read-cache.c: change type of "temp" in write_shared_index()
</content>
</entry>
<entry>
<title>Merge branch 'tg/split-index-fixes' into maint</title>
<updated>2018-03-22T21:24:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-03-22T21:24:10Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b0e0fc267bfb270b0ccf48ff17179c9c315dc2a9'/>
<id>urn:sha1:b0e0fc267bfb270b0ccf48ff17179c9c315dc2a9</id>
<content type='text'>
The split-index mode had a few corner case bugs fixed.

* tg/split-index-fixes:
  travis: run tests with GIT_TEST_SPLIT_INDEX
  split-index: don't write cache tree with null oid entries
  read-cache: fix reading the shared index for other repos
</content>
</entry>
<entry>
<title>read-cache: don't write index twice if we can't write shared index</title>
<updated>2018-01-24T18:09:18Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-24T09:38:29Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ef5b3a6c5e24c54ba4436e225b9431c63ab163f0'/>
<id>urn:sha1:ef5b3a6c5e24c54ba4436e225b9431c63ab163f0</id>
<content type='text'>
In a0a967568e ("update-index --split-index: do not split if $GIT_DIR is
read only", 2014-06-13), we tried to make sure we can still write an
index, even if the shared index can not be written.

We did so by just calling 'do_write_locked_index()' just before
'write_shared_index()'.  'do_write_locked_index()' always at least
closes the tempfile nowadays, and used to close or commit the lockfile
if COMMIT_LOCK or CLOSE_LOCK were given at the time this feature was
introduced.  COMMIT_LOCK or CLOSE_LOCK is passed in by most callers of
'write_locked_index()'.

After calling 'write_shared_index()', we call 'write_split_index()',
which calls 'do_write_locked_index()' again, which then tries to use the
closed lockfile again, but in fact fails to do so as it's already
closed. This eventually leads to a segfault.

Make sure to write the main index only once.

[nd: most of the commit message and investigation done by Thomas, I only
tweaked the solution a bit]

Helped-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>split-index: don't write cache tree with null oid entries</title>
<updated>2018-01-19T18:36:39Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-01-07T22:30:14Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=4bddd98311f249e9ed8a9b6379c7a097201612d1'/>
<id>urn:sha1:4bddd98311f249e9ed8a9b6379c7a097201612d1</id>
<content type='text'>
In a96d3cc3f6 ("cache-tree: reject entries with null sha1", 2017-04-21)
we made sure that broken cache entries do not get propagated to new
trees.  Part of that was making sure not to re-use an existing cache
tree that includes a null oid.

It did so by dropping the cache tree in 'do_write_index()' if one of
the entries contains a null oid.  In split index mode however, there
are two invocations to 'do_write_index()', one for the shared index
and one for the split index.  The cache tree is only written once, to
the split index.

As we only loop through the elements that are effectively being
written by the current invocation, that may not include the entry with
a null oid in the split index (when it is already written to the
shared index), where we write the cache tree.  Therefore in split
index mode we may still end up writing the cache tree, even though
there is an entry with a null oid in the index.

Fix this by checking for null oids in prepare_to_write_split_index,
where we loop the entries of the shared index as well as the entries for
the split index.

This fixes t7009 with GIT_TEST_SPLIT_INDEX.  Also add a new test that's
more specifically showing the problem.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: fix reading the shared index for other repos</title>
<updated>2018-01-19T18:36:34Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2018-01-07T22:30:13Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a125a223347a8d43fffc1b7ec2bec93d88ec17b7'/>
<id>urn:sha1:a125a223347a8d43fffc1b7ec2bec93d88ec17b7</id>
<content type='text'>
read_index_from() takes a path argument for the location of the index
file.  For reading the shared index in split index mode however it just
ignores that path argument, and reads it from the gitdir of the current
repository.

This works as long as an index in the_repository is read.  Once that
changes, such as when we read the index of a submodule, or of a
different working tree than the current one, the gitdir of
the_repository will no longer contain the appropriate shared index,
and git will fail to read it.

For example t3007-ls-files-recurse-submodules.sh was broken with
GIT_TEST_SPLIT_INDEX set in 188dce131f ("ls-files: use repository
object", 2017-06-22), and t7814-grep-recurse-submodules.sh was also
broken in a similar manner, probably by introducing struct repository
there, although I didn't track down the exact commit for that.

be489d02d2 ("revision.c: --indexed-objects add objects from all
worktrees", 2017-08-23) breaks with split index mode in a similar
manner, not erroring out when it can't read the index, but instead
carrying on with pruning, without taking the index of the worktree into
account.

Fix this by passing an additional gitdir parameter to read_index_from,
to indicate where it should look for and read the shared index from.

read_cache_from() defaults to using the gitdir of the_repository.  As it
is mostly a convenience macro, having to pass get_git_dir() for every
call seems overkill, and if necessary users can have more control by
using read_index_from().

Helped-by: Brandon Williams &lt;bmwill@google.com&gt;
Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache.c: move tempfile creation/cleanup out of write_shared_index</title>
<updated>2018-01-16T21:12:07Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-14T10:18:19Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=59f9d2dd60f97c55c92c3273903f64048a27e513'/>
<id>urn:sha1:59f9d2dd60f97c55c92c3273903f64048a27e513</id>
<content type='text'>
For one thing, we have more consistent cleanup procedure now and always
keep errno intact.

The real purpose is the ability to break out of write_locked_index()
early when mks_tempfile() fails in the next patch. It's more awkward to
do it if this mks_tempfile() is still inside write_shared_index().

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: change type of "temp" in write_shared_index()</title>
<updated>2018-01-16T21:12:02Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-01-14T10:18:18Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12'/>
<id>urn:sha1:7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12</id>
<content type='text'>
This local variable 'temp' will be passed in from the caller in the next
patch. To reduce patch noise, let's change its type now while it's still
a local variable and get all the trival conversion out of the next patch.

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 'tb/add-renormalize'</title>
<updated>2017-11-27T02:06:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-11-27T02:06:37Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=af6e0fe3a589d58bfd508c1c6ccbeb38586eb06b'/>
<id>urn:sha1:af6e0fe3a589d58bfd508c1c6ccbeb38586eb06b</id>
<content type='text'>
"git add --renormalize ." is a new and safer way to record the fact
that you are correcting the end-of-line convention and other
"convert_to_git()" glitches in the in-repository data.

* tb/add-renormalize:
  add: introduce "--renormalize"
</content>
</entry>
<entry>
<title>Merge branch 'av/fsmonitor'</title>
<updated>2017-11-21T05:07:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-11-21T05:07:51Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c9fdbca92c66b93f95a19bf1f38ab9088db78540'/>
<id>urn:sha1:c9fdbca92c66b93f95a19bf1f38ab9088db78540</id>
<content type='text'>
Various fixes to bp/fsmonitor topic.

* av/fsmonitor:
  fsmonitor: simplify determining the git worktree under Windows
  fsmonitor: store fsmonitor bitmap before splitting index
  fsmonitor: read from getcwd(), not the PWD environment variable
  fsmonitor: delay updating state until after split index is merged
  fsmonitor: document GIT_TRACE_FSMONITOR
  fsmonitor: don't bother pretty-printing JSON from watchman
  fsmonitor: set the PWD to the top of the working tree
</content>
</entry>
<entry>
<title>Merge branch 'bp/fsmonitor'</title>
<updated>2017-11-21T05:07:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-11-21T05:07:50Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e05336bddacb90cf243aacc0f7b7f34f900453d7'/>
<id>urn:sha1:e05336bddacb90cf243aacc0f7b7f34f900453d7</id>
<content type='text'>
We learned to talk to watchman to speed up "git status" and other
operations that need to see which paths have been modified.

* bp/fsmonitor:
  fsmonitor: preserve utf8 filenames in fsmonitor-watchman log
  fsmonitor: read entirety of watchman output
  fsmonitor: MINGW support for watchman integration
  fsmonitor: add a performance test
  fsmonitor: add a sample integration script for Watchman
  fsmonitor: add test cases for fsmonitor extension
  split-index: disable the fsmonitor extension when running the split index test
  fsmonitor: add a test tool to dump the index extension
  update-index: add fsmonitor support to update-index
  ls-files: Add support in ls-files to display the fsmonitor valid bit
  fsmonitor: add documentation for the fsmonitor extension.
  fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files.
  update-index: add a new --force-write-index option
  preload-index: add override to enable testing preload-index
  bswap: add 64 bit endianness helper get_be64
</content>
</entry>
</feed>
