<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-08-11T04:52:34Z</updated>
<entry>
<title>Merge branch 'tk/untracked-cache-with-uall' into maint</title>
<updated>2022-08-11T04:52:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-08-11T04:52:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4f049a16bf47c97639cb78b3ede3c6888fe91987'/>
<id>urn:sha1:4f049a16bf47c97639cb78b3ede3c6888fe91987</id>
<content type='text'>
Fix for a bug that makes write-tree to fail to write out a
non-existent index as a tree, introduced in 2.37.
source: &lt;20220722212232.833188-1-martin.agren@gmail.com&gt;

* tk/untracked-cache-with-uall:
  read-cache: make `do_read_index()` always set up `istate-&gt;repo`
</content>
</entry>
<entry>
<title>read-cache: make `do_read_index()` always set up `istate-&gt;repo`</title>
<updated>2022-07-22T21:51:00Z</updated>
<author>
<name>Martin Ågren</name>
<email>martin.agren@gmail.com</email>
</author>
<published>2022-07-22T21:22:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4447d4129d944eb136fd5c35014cc2b370a2d752'/>
<id>urn:sha1:4447d4129d944eb136fd5c35014cc2b370a2d752</id>
<content type='text'>
If there is no index file, e.g., because the repository has just been
created, we return zero early (unless `must_exist` makes us die
instead.)

This early return means we do not set up `istate-&gt;repo`. With
`core.untrackedCache=true`, the recent e6a653554b ("untracked-cache:
support '--untracked-files=all' if configured", 2022-03-31) will
eventually pass down `istate-&gt;repo` as a null pointer to
`repo_config_get_string()`, causing a segmentation fault.

If we do hit this early return, set up `istate-&gt;repo` similar to when we
actually read the index.

Reported-by: Joey Hess &lt;id@joeyh.name&gt;
Signed-off-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read_index_from(): avoid memory leak</title>
<updated>2022-06-16T20:22:03Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-06-15T23:35:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=652891de4ff164d545daa5472ab67f4f9d41319b'/>
<id>urn:sha1:652891de4ff164d545daa5472ab67f4f9d41319b</id>
<content type='text'>
In 998330ac2e7c (read-cache: look for shared index files next to the
index, too, 2021-08-26), we added code that allocates memory to store
the base path of a shared index, but we never released that memory.

Reported by Coverity.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'zh/read-cache-copy-name-entry-fix'</title>
<updated>2022-06-13T22:53:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-06-13T22:53:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=113656eca6c58b8db61c3c8e8218f7debe33708a'/>
<id>urn:sha1:113656eca6c58b8db61c3c8e8218f7debe33708a</id>
<content type='text'>
Remove redundant copying (with index v3 and older) or possible
over-reading beyond end of mmapped memory (with index v4) has been
corrected.

* zh/read-cache-copy-name-entry-fix:
  read-cache.c: reduce unnecessary cache entry name copying
</content>
</entry>
<entry>
<title>read-cache.c: reduce unnecessary cache entry name copying</title>
<updated>2022-06-06T17:37:06Z</updated>
<author>
<name>ZheNing Hu</name>
<email>adlternative@gmail.com</email>
</author>
<published>2022-06-05T13:37:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6d858341d284e08320dc2dbf1952d7a37884e5f3'/>
<id>urn:sha1:6d858341d284e08320dc2dbf1952d7a37884e5f3</id>
<content type='text'>
575fa8a3 (read-cache: read data in a hash-independent way,
2019-02-19) added a new code to copy from the on-disk data into the
name member of the in-core cache entry, which is already done
immediately after that in a way that takes prefix-compression into
account.

Remove this code, as it is not just unnecessary, but also can be
reading beyond the on-disk data, when we are copying very long
prefix string from the previous entry.

Signed-off-by: ZheNing Hu &lt;adlternative@gmail.com&gt;
[jc: rewrote the log message with Réne's findings]
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/sparse-sparse-checkout'</title>
<updated>2022-06-03T21:30:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-06-03T21:30:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c276c21da6d055060b1c216de1b1c04fb058425f'/>
<id>urn:sha1:c276c21da6d055060b1c216de1b1c04fb058425f</id>
<content type='text'>
"sparse-checkout" learns to work well with the sparse-index
feature.

* ds/sparse-sparse-checkout:
  sparse-checkout: integrate with sparse index
  p2000: add test for 'git sparse-checkout [add|set]'
  sparse-index: complete partial expansion
  sparse-index: partially expand directories
  sparse-checkout: --no-sparse-index needs a full index
  cache-tree: implement cache_tree_find_path()
  sparse-index: introduce partially-sparse indexes
  sparse-index: create expand_index()
  t1092: stress test 'git sparse-checkout set'
  t1092: refactor 'sparse-index contents' test
</content>
</entry>
<entry>
<title>sparse-index: introduce partially-sparse indexes</title>
<updated>2022-05-23T18:08:21Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2022-05-23T13:48:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9fadb373dd4a670e761776560d3c40f6fcc80360'/>
<id>urn:sha1:9fadb373dd4a670e761776560d3c40f6fcc80360</id>
<content type='text'>
A future change will present a temporary, in-memory mode where the index
can both contain sparse directory entries but also not be completely
collapsed to the smallest possible sparse directories. This will be
necessary for modifying the sparse-checkout definition while using a
sparse index.

For now, convert the single-bit member 'sparse_index' in 'struct
index_state' to be a an 'enum sparse_index_mode' with three modes:

* INDEX_EXPANDED (0): No sparse directories exist. This is always the
  case for repositories that do not use cone-mode sparse-checkout.

* INDEX_COLLAPSED: Sparse directories may exist. Files outside the
  sparse-checkout cone are reduced to sparse directory entries whenever
  possible.

* INDEX_PARTIALLY_SPARSE: Sparse directories may exist. Some file
  entries outside the sparse-checkout cone may exist. Running
  convert_to_sparse() may further reduce those files to sparse directory
  entries.

The main reason to store this extra information is to allow
convert_to_sparse() to short-circuit when the index is already in
INDEX_EXPANDED mode but to actually do the necessary work when in
INDEX_PARTIALLY_SPARSE mode.

The INDEX_PARTIALLY_SPARSE mode will be used in an upcoming change.

Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: set sparsity when index is new</title>
<updated>2022-05-10T23:45:12Z</updated>
<author>
<name>Victoria Dye</name>
<email>vdye@github.com</email>
</author>
<published>2022-05-10T23:32:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=491df5f679f0381f529b967df25476ab944406ab'/>
<id>urn:sha1:491df5f679f0381f529b967df25476ab944406ab</id>
<content type='text'>
When the index read in 'do_read_index()' does not exist on-disk, mark the
index "sparse" if the executing command does not require a full index and
sparse index is otherwise enabled.

Some commands (such as 'git stash -u') implicitly create a new index (when
the 'GIT_INDEX_FILE' variable points to a non-existent file) and perform
some operation on it. However, when this index is created, it isn't created
with the same sparsity settings as the repo index. As a result, while these
indexes may be sparse during the operation, they are always expanded before
being written to disk. We can avoid that expansion by defaulting the index
to "sparse", in which case it will only be expanded if the full index is
needed.

Note that the function 'set_new_index_sparsity()' is created despite having
only a single caller because additional callers will be added in a
subsequent patch.

Signed-off-by: Victoria Dye &lt;vdye@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'vd/mv-refresh-stat'</title>
<updated>2022-04-04T17:56:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-04-04T17:56:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=909d5b646e9bb49c9c242c82d68e29c451988541'/>
<id>urn:sha1:909d5b646e9bb49c9c242c82d68e29c451988541</id>
<content type='text'>
"git mv" failed to refresh the cached stat information for the
entry it moved.

* vd/mv-refresh-stat:
  mv: refresh stat info for moved entry
</content>
</entry>
<entry>
<title>mv: refresh stat info for moved entry</title>
<updated>2022-03-29T16:45:02Z</updated>
<author>
<name>Victoria Dye</name>
<email>vdye@github.com</email>
</author>
<published>2022-03-29T01:07:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b7f9130a06a9960144bb9c145e62dac792328c20'/>
<id>urn:sha1:b7f9130a06a9960144bb9c145e62dac792328c20</id>
<content type='text'>
Update the stat info of the moved index entry in 'rename_index_entry_at()'
if the entry is up-to-date with the index. Internally, 'git mv' uses
'rename_index_entry_at()' to move the source index entry to the destination.
However, it directly copies the stat info of the original cache entry, which
will not reflect the 'ctime' of the file renaming operation that happened as
part of the move. If a file is otherwise up-to-date with the index, that
difference in 'ctime' will make the entry appear out-of-date until the next
index-refreshing operation (e.g., 'git status').

Some commands, such as 'git reset', use the cached stat information to
determine whether a file is up-to-date; if this information is incorrect,
the command will fail when it should pass. In order to ensure a moved entry
is evaluated as 'up-to-date' when appropriate, refresh the destination index
entry's stat info in 'git mv' if and only if the file is up-to-date.

Note that the test added in 't7001-mv.sh' requires a "sleep 1" to ensure the
'ctime' of the file creation will be definitively older than the 'ctime' of
the renamed file in 'git mv'.

Reported-by: Maximilian Reichel &lt;reichemn@icloud.com&gt;
Signed-off-by: Victoria Dye &lt;vdye@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
