<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.37.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-08-26T18:13:13Z</updated>
<entry>
<title>Merge branch 'vd/sparse-reset-checkout-fixes' into maint</title>
<updated>2022-08-26T18:13:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-08-26T18:13:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7be9f3f3353acc1e9478aaed5afe2b0778388a69'/>
<id>urn:sha1:7be9f3f3353acc1e9478aaed5afe2b0778388a69</id>
<content type='text'>
Fixes to sparse index compatibility work for "reset" and "checkout"
commands.
source: &lt;pull.1312.v3.git.1659985672.gitgitgadget@gmail.com&gt;

* vd/sparse-reset-checkout-fixes:
  unpack-trees: unpack new trees as sparse directories
  cache.h: create 'index_name_pos_sparse()'
  oneway_diff: handle removed sparse directories
  checkout: fix nested sparse directory diff in sparse index
</content>
</entry>
<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>cache.h: create 'index_name_pos_sparse()'</title>
<updated>2022-08-08T20:21:50Z</updated>
<author>
<name>Victoria Dye</name>
<email>vdye@github.com</email>
</author>
<published>2022-08-08T19:07:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9553aa0f6c844085b3fbf05da5440dd7096dd764'/>
<id>urn:sha1:9553aa0f6c844085b3fbf05da5440dd7096dd764</id>
<content type='text'>
Add 'index_name_pos_sparse()', which behaves the same as 'index_name_pos()',
except that it does not expand a sparse index to search for an entry inside
a sparse directory.

'index_entry_exists()' was originally implemented in 20ec2d034c (reset: make
sparse-aware (except --mixed), 2021-11-29) as an alternative to
'index_name_pos()' to allow callers to search for an index entry without
expanding a sparse index. However, that particular use case only required
knowing whether the requested entry existed, so 'index_entry_exists()' does
not return the index positioning information provided by 'index_name_pos()'.

This patch implements 'index_name_pos_sparse()' to accommodate callers that
need the positioning information of 'index_name_pos()', but do not want to
expand the index.

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>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>
</feed>
