<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fsmonitor.c, branch v2.30.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.30.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.30.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-08-10T17:23:57Z</updated>
<entry>
<title>Merge branch 'jk/strvec'</title>
<updated>2020-08-10T17:23:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-08-10T17:23:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=46b225f15308c8f77379f864189bed95c273d29f'/>
<id>urn:sha1:46b225f15308c8f77379f864189bed95c273d29f</id>
<content type='text'>
The argv_array API is useful for not just managing argv but any
"vector" (NULL-terminated array) of strings, and has seen adoption
to a certain degree.  It has been renamed to "strvec" to reduce the
barrier to adoption.

* jk/strvec:
  strvec: rename struct fields
  strvec: drop argv_array compatibility layer
  strvec: update documention to avoid argv_array
  strvec: fix indentation in renamed calls
  strvec: convert remaining callers away from argv_array name
  strvec: convert more callers away from argv_array name
  strvec: convert builtin/ callers away from argv_array name
  quote: rename sq_dequote_to_argv_array to mention strvec
  strvec: rename files from argv-array to strvec
  argv-array: rename to strvec
  argv-array: use size_t for count and alloc
</content>
</entry>
<entry>
<title>strvec: convert more callers away from argv_array name</title>
<updated>2020-07-28T22:02:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-07-28T20:24:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ef8d7ac42a6a62d678166fe25ea743315809d2bb'/>
<id>urn:sha1:ef8d7ac42a6a62d678166fe25ea743315809d2bb</id>
<content type='text'>
We eventually want to drop the argv_array name and just use strvec
consistently. There's no particular reason we have to do it all at once,
or care about interactions between converted and unconverted bits.
Because of our preprocessor compat layer, the names are interchangeable
to the compiler (so even a definition and declaration using different
names is OK).

This patch converts remaining files from the first half of the alphabet,
to keep the diff to a manageable size.

The conversion was done purely mechanically with:

  git ls-files '*.c' '*.h' |
  xargs perl -i -pe '
    s/ARGV_ARRAY/STRVEC/g;
    s/argv_array/strvec/g;
  '

and then selectively staging files with "git add '[abcdefghjkl]*'".
We'll deal with any indentation/style fallouts separately.

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>Remove doubled words in various comments</title>
<updated>2020-07-28T21:28:14Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-07-28T20:45:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6d12b533b7791130a0b1ad42a316447e0326ecd1'/>
<id>urn:sha1:6d12b533b7791130a0b1ad42a316447e0326ecd1</id>
<content type='text'>
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: handle version 2 of the hooks that will use opaque token</title>
<updated>2020-01-13T22:58:43Z</updated>
<author>
<name>Kevin Willford</name>
<email>Kevin.Willford@microsoft.com</email>
</author>
<published>2020-01-07T19:04:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8da2c57629a16e148b0f94282ac787c1503e4779'/>
<id>urn:sha1:8da2c57629a16e148b0f94282ac787c1503e4779</id>
<content type='text'>
Some file monitors like watchman will use something other than a timestamp
to keep better track of what changes happen in between calls to query
the fsmonitor. The clockid in watchman is a string. Now that the index
is storing an opaque token for the last update the code needs to be
updated to pass that opaque token to a verion 2 of the fsmonitor hook.

Because there are repos that already have version 1 of the hook and we
want them to continue to work when git is updated, we need to handle
both version 1 and version 2 of the hook. In order to do that a
config value is being added core.fsmonitorHookVersion to force what
version of the hook should be used.  When this is not set it will default
to -1 and then the code will attempt to call version 2 of the hook first.
If that fails it will fallback to trying version 1.

Signed-off-by: Kevin Willford &lt;Kevin.Willford@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: change last update timestamp on the index_state to opaque token</title>
<updated>2020-01-13T22:58:43Z</updated>
<author>
<name>Kevin Willford</name>
<email>Kevin.Willford@microsoft.com</email>
</author>
<published>2020-01-07T19:04:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=56c6910028a0468761b0cd9ee5c0946ce637b586'/>
<id>urn:sha1:56c6910028a0468761b0cd9ee5c0946ce637b586</id>
<content type='text'>
Some file system monitors might not use or take a timestamp for processing
and in the case of watchman could have race conditions with using a
timestamp. Watchman uses something called a clockid that is used for race
free queries to it. The clockid for watchman is simply a string.

Change the fsmonitor_last_update from being a uint64_t to a char pointer
so that any arbitrary data can be stored in it and passed back to the
fsmonitor.

Signed-off-by: Kevin Willford &lt;Kevin.Willford@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>unpack-trees: skip stat on fsmonitor-valid files</title>
<updated>2019-11-21T03:48:18Z</updated>
<author>
<name>Utsav Shah</name>
<email>utsav@dropbox.com</email>
</author>
<published>2019-11-20T08:32:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=679f2f9fdd2173d87251aee357dd0e46ce977f42'/>
<id>urn:sha1:679f2f9fdd2173d87251aee357dd0e46ce977f42</id>
<content type='text'>
The index might be aware that a file hasn't modified via fsmonitor, but
unpack-trees did not pay attention to it and checked via ie_match_stat
which can be inefficient on certain filesystems. This significantly slows
down commands that run oneway_merge, like checkout and reset --hard.

This patch makes oneway_merge check whether a file is considered
unchanged through fsmonitor and skips ie_match_stat on it. unpack-trees
also now correctly copies over fsmonitor validity state from the source
index. Finally, for correctness, we force a refresh of fsmonitor state in
tweak_fsmonitor.

After this change, commands like stash (that use reset --hard
internally) go from 8s or more to ~2s on a 250k file repository on a
mac.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Kevin Willford &lt;Kevin.Willford@microsoft.com&gt;
Signed-off-by: Utsav Shah &lt;utsav@dropbox.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: do not compare bitmap size with size of split index</title>
<updated>2019-11-13T01:30:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-11-13T01:30:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=61eea521fef11c6878a4157bcc0fca6e981a58b2'/>
<id>urn:sha1:61eea521fef11c6878a4157bcc0fca6e981a58b2</id>
<content type='text'>
3444ec2e ("fsmonitor: don't fill bitmap with entries to be removed",
2019-10-11) added a handful of sanity checks that make sure that a
bit position in fsmonitor bitmap does not go beyond the end of the
index.  As each bit in the bitmap corresponds to a path in the
index, this is the right check most of the time.

Except for the case when we are in the split-index mode and looking
at a delta index that is to be overlayed on the base index but
before the base index has actually been merged in, namely in read_
and write_fsmonitor_extension().  In these codepaths, the entries in
the split/delta index is typically a small subset of the entire set
of paths (otherwise why would we be using split-index?), so the
bitmap used by the fsmonitor is almost always larger than the number
of entries in the partial index, and the incorrect comparison would
trigger the BUG().

Reported-by: Utsav Shah &lt;ukshah2@illinois.edu&gt;
Helped-by: Kevin Willford &lt;Kevin.Willford@microsoft.com&gt;
Helped-by: William Baker &lt;William.Baker@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: don't fill bitmap with entries to be removed</title>
<updated>2019-10-12T01:16:11Z</updated>
<author>
<name>William Baker</name>
<email>William.Baker@microsoft.com</email>
</author>
<published>2019-10-11T20:11:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3444ec2eb2be58c285d2bf04f39e6e9ea5eda9a2'/>
<id>urn:sha1:3444ec2eb2be58c285d2bf04f39e6e9ea5eda9a2</id>
<content type='text'>
While doing some testing with fsmonitor enabled I found
that git commands would segfault after staging and
unstaging an untracked file.  Looking at the crash it
appeared that fsmonitor_ewah_callback was attempting to
adjust bits beyond the bounds of the index cache.

Digging into how this could happen it became clear that
the fsmonitor extension must have been written with
more bits than there were entries in the index.  The
root cause ended up being that fill_fsmonitor_bitmap was
populating fsmonitor_dirty with bits for all entries in
the index, even those that had been marked for removal.

To solve this problem fill_fsmonitor_bitmap has been
updated to skip entries with the the CE_REMOVE flag set.
With this change the bits written for the fsmonitor
extension will be consistent with the index entries
written by do_write_index.  Additionally, BUG checks
have been added to detect if the number of bits in
fsmonitor_dirty should ever exceed the number of
entries in the index again.

Another option that was considered was moving the call
to fill_fsmonitor_bitmap closer to where the index is
written (and where the fsmonitor extension itself is
written).  However, that did not work as the
fsmonitor_dirty bitmap must be filled before the index
is split during writing.

Signed-off-by: William Baker &lt;William.Baker@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cb/fsmonitor-intfix'</title>
<updated>2019-07-09T22:25:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-07-09T22:25:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ceca45541d0046544cc95acb6b849c14637e0e3e'/>
<id>urn:sha1:ceca45541d0046544cc95acb6b849c14637e0e3e</id>
<content type='text'>
Variable type fix.

* cb/fsmonitor-intfix:
  fsmonitor: avoid signed integer overflow / infinite loop
</content>
</entry>
<entry>
<title>fsmonitor: avoid signed integer overflow / infinite loop</title>
<updated>2019-06-18T01:14:29Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2019-06-15T16:11:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d137fc2c7ba08455b2734c8e2ca9b9a284f3706'/>
<id>urn:sha1:5d137fc2c7ba08455b2734c8e2ca9b9a284f3706</id>
<content type='text'>
883e248b8a ("fsmonitor: teach git to optionally utilize a file system
monitor to speed up detecting new or changed files.", 2017-09-22) uses
an int in a loop that would wrap if index_state-&gt;cache_nr (unsigned)
is bigger than INT_MAX

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
