<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.47.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.47.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.47.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-11-20T05:42:59Z</updated>
<entry>
<title>Merge branch 'ps/cache-tree-w-broken-index-entry' into maint-2.47</title>
<updated>2024-11-20T05:42:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-11-20T05:42:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=257f2de9644536964c02eed53271df89e132d4f4'/>
<id>urn:sha1:257f2de9644536964c02eed53271df89e132d4f4</id>
<content type='text'>
Fail gracefully instead of crashing when attempting to write the
contents of a corrupt in-core index as a tree object.

* ps/cache-tree-w-broken-index-entry:
  unpack-trees: detect mismatching number of cache-tree/index entries
  cache-tree: detect mismatching number of index entries
  cache-tree: refactor verification to return error codes
</content>
</entry>
<entry>
<title>cache-tree: refactor verification to return error codes</title>
<updated>2024-10-07T22:08:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-10-07T04:38:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9f119599a69eb11f0712cab3bdbc2000eb91abd7'/>
<id>urn:sha1:9f119599a69eb11f0712cab3bdbc2000eb91abd7</id>
<content type='text'>
The function `cache_tree_verify()` will `BUG()` whenever it finds that
the cache-tree extension of the index is corrupt. The function is thus
inherently untestable because the resulting call to `abort()` will be
detected by our testing framework and labelled an error. And rightfully
so: it shouldn't ever be possible to hit bugs, as they should indicate a
programming error rather than corruption of on-disk state.

Refactor the function to instead return error codes. This also ensures
that the function can be used e.g. by git-fsck(1) without the whole
process dying. Furthermore, this refactoring plugs some memory leaks
when returning early by creating a common exit path.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/read-cache-mempool-leakfix'</title>
<updated>2024-10-04T17:14:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-10-04T17:14:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b4efdfe16555f989eb977f77142a0c60571be34b'/>
<id>urn:sha1:b4efdfe16555f989eb977f77142a0c60571be34b</id>
<content type='text'>
Leakfix.

* ds/read-cache-mempool-leakfix:
  read-cache: free threaded memory pool
</content>
</entry>
<entry>
<title>read-cache: free threaded memory pool</title>
<updated>2024-10-01T18:51:15Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2024-10-01T17:37:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5e6f359f6b7829e3baea888f5489f04eebf745af'/>
<id>urn:sha1:5e6f359f6b7829e3baea888f5489f04eebf745af</id>
<content type='text'>
In load_cache_entries_threaded(), each thread allocates its own memory
pool. This pool needs to be cleaned up while closing the threads down,
or it will be leaked.

This ce_mem_pool pointer could theoretically be converted to an inline
copy of the struct, but the use of a pointer helps with existing lazy-
initialization logic. Adjusting that behavior only to avoid this pointer
would be a much bigger change.

Signed-off-by: Derrick Stolee &lt;stolee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>environment: make `get_git_dir()` accept a repository</title>
<updated>2024-09-12T17:15:39Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-09-12T11:29:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=246deeac9517d6daba89bfcf6de6d290e39af585'/>
<id>urn:sha1:246deeac9517d6daba89bfcf6de6d290e39af585</id>
<content type='text'>
The `get_git_dir()` function retrieves the path to the Git directory for
`the_repository`. Make it accept a `struct repository` such that it can
work on arbitrary repositories and make it part of the repository
subsystem. This reduces our reliance on `the_repository` and clarifies
scope.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ps/maintenance-detach-fix'</title>
<updated>2024-08-26T18:32:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-26T18:32:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1e8962ee082934a60b5fc71fab0e36cb1cab39bd'/>
<id>urn:sha1:1e8962ee082934a60b5fc71fab0e36cb1cab39bd</id>
<content type='text'>
Maintenance tasks other than "gc" now properly go background when
"git maintenance" runs them.

* ps/maintenance-detach-fix:
  run-command: fix detaching when running auto maintenance
  builtin/maintenance: add a `--detach` flag
  builtin/gc: add a `--detach` flag
  builtin/gc: stop processing log file on signal
  builtin/gc: fix leaking config values
  builtin/gc: refactor to read config into structure
  config: fix constness of out parameter for `git_config_get_expiry()`
</content>
</entry>
<entry>
<title>Merge branch 'ps/config-wo-the-repository'</title>
<updated>2024-08-23T16:02:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-08-23T16:02:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5e56a39e6a9b8621e62f7a18ed027777a095dba7'/>
<id>urn:sha1:5e56a39e6a9b8621e62f7a18ed027777a095dba7</id>
<content type='text'>
Use of API functions that implicitly depend on the_repository
object in the config subsystem has been rewritten to pass a
repository object through the callchain.

* ps/config-wo-the-repository:
  config: hide functions using `the_repository` by default
  global: prepare for hiding away repo-less config functions
  config: don't depend on `the_repository` with branch conditions
  config: don't have setters depend on `the_repository`
  config: pass repo to functions that rename or copy sections
  config: pass repo to `git_die_config()`
  config: pass repo to `git_config_get_expiry_in_days()`
  config: pass repo to `git_config_get_expiry()`
  config: pass repo to `git_config_get_max_percent_split_change()`
  config: pass repo to `git_config_get_split_index()`
  config: pass repo to `git_config_get_index_threads()`
  config: expose `repo_config_clear()`
  config: introduce missing setters that take repo as parameter
  path: hide functions using `the_repository` by default
  path: stop relying on `the_repository` in `worktree_git_path()`
  path: stop relying on `the_repository` when reporting garbage
  hooks: remove implicit dependency on `the_repository`
  editor: do not rely on `the_repository` for interactive edits
  path: expose `do_git_common_path()` as `repo_common_pathv()`
  path: expose `do_git_path()` as `repo_git_pathv()`
</content>
</entry>
<entry>
<title>config: fix constness of out parameter for `git_config_get_expiry()`</title>
<updated>2024-08-16T16:46:24Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-08-16T10:44:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a70a9bf6eec832b808a805de318601684b19f18e'/>
<id>urn:sha1:a70a9bf6eec832b808a805de318601684b19f18e</id>
<content type='text'>
The type of the out parameter of `git_config_get_expiry()` is a pointer
to a constant string, which creates the impression that ownership of the
returned data wasn't transferred to the caller. This isn't true though
and thus quite misleading.

Adapt the parameter to be of type `char **` and adjust callers
accordingly. While at it, refactor `get_shared_index_expire_date()` to
drop the static `shared_index_expire` variable. It is only used in that
function, and furthermore we would only hit the code where we parse the
expiry date a single time because we already use a static `prepared`
variable to track whether we did parse it.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: fix leaking hashfile when writing index fails</title>
<updated>2024-08-14T17:07:58Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-08-14T06:52:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d1c53f6703f34eeb3442070016db6e4d1f5676d2'/>
<id>urn:sha1:d1c53f6703f34eeb3442070016db6e4d1f5676d2</id>
<content type='text'>
In `do_write_index()`, we use a `struct hashfile` to write the index
with a trailer hash. In case the write fails though, we never clean up
the allocated `hashfile` state and thus leak memory.

Refactor the code to have a common exit path where we can free this and
other allocated memory. While at it, refactor our use of `strbuf`s such
that we reuse the same buffer to avoid some unneeded allocations.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: pass repo to `git_config_get_expiry()`</title>
<updated>2024-08-13T17:01:03Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-08-13T09:13:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=87aace129ef39fc52ca26e8d31c356c8d05ea910'/>
<id>urn:sha1:87aace129ef39fc52ca26e8d31c356c8d05ea910</id>
<content type='text'>
Refactor `git_config_get_expiry()` to accept a `struct repository` such
that we can get rid of the implicit dependency on `the_repository`.
Rename the function accordingly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
