<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pack-write.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-04-10T23:39:38Z</updated>
<entry>
<title>pack-write: add explanation to promisor file content</title>
<updated>2026-04-10T23:39:38Z</updated>
<author>
<name>LorenzoPegorari</name>
<email>lorenzo.pegorari2002@gmail.com</email>
</author>
<published>2026-04-10T22:54:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=880636fbe5a0df1d6904c89d1697ac13ea568368'/>
<id>urn:sha1:880636fbe5a0df1d6904c89d1697ac13ea568368</id>
<content type='text'>
In the entire codebase there is no explanation as to why the ".promisor"
files may contain the ref names (and their associated hashes) that were
fetched at the time the corresponding packfile was downloaded.

As explained in the log message of commit 5374a290 (fetch-pack: write
fetched refs to .promisor, 2019-10-14), where this loop originally came
from, these ref names (and associated hashes) are not used for anything
in the production, but are solely there to help debugging.

Explain this in a new comment.

Signed-off-by: LorenzoPegorari &lt;lorenzo.pegorari2002@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object-file: get rid of `the_repository` in `finalize_object_file()`</title>
<updated>2025-07-17T05:16:14Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-17T04:56:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbb388f3e53660c88220c40a8dddb976672ae03d'/>
<id>urn:sha1:cbb388f3e53660c88220c40a8dddb976672ae03d</id>
<content type='text'>
We implicitly depend on `the_repository` when moving an object file into
place in `finalize_object_file()`. Get rid of this global dependency by
passing in a repository.

Note that one might be pressed to inject an object database instead of a
repository. But the function doesn't really care about the ODB at all.
All it does is to move a file into place while checking whether there is
any collision. As such, the functionality it provides is independent of
the object database and only needs the repository as parameter so that
it can adjust permissions of the file we are about to finalize.

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>odb: get rid of `the_repository` in `odb_mkstemp()`</title>
<updated>2025-07-01T21:46:35Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-01T12:22:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1b1679c6883f948b19599f11229ff61124b51733'/>
<id>urn:sha1:1b1679c6883f948b19599f11229ff61124b51733</id>
<content type='text'>
Get rid of our dependency on `the_repository` in `odb_mkstemp()` by
passing in the object database as a parameter and adjusting all callers.

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>pack-write: stop depending on `the_repository` and `the_hash_algo`</title>
<updated>2025-03-10T20:16:18Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-03-10T07:13:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2582846f2fe21b23fe7c567e030510960f135160'/>
<id>urn:sha1:2582846f2fe21b23fe7c567e030510960f135160</id>
<content type='text'>
There are a couple of functions in "pack-write.c" that implicitly depend
on `the_repository` or `the_hash_algo`. Remove this dependency by
injecting the repository via a parameter and adapt callers accordingly.

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>csum-file: stop depending on `the_repository`</title>
<updated>2025-03-10T20:16:18Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-03-10T07:13:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=228457c9d9f32f000f5c04c36fcce9002f72965a'/>
<id>urn:sha1:228457c9d9f32f000f5c04c36fcce9002f72965a</id>
<content type='text'>
There are multiple sites in "csum-file.c" where we use the global
`the_repository` variable, either explicitly or implicitly by using
`the_hash_algo`.

Refactor the code to stop using `the_repository` by adapting functions
to receive required data as parameters. Adapt callsites accordingly by
either using `the_repository-&gt;hash_algo`, or by using a context-provided
hash algorithm in case the subsystem already got rid of its dependency
on `the_repository`.

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/path-sans-the-repository'</title>
<updated>2025-03-05T18:37:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-03-05T18:37:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=feffb34257ee8eef18cc6a3a5a4f01d40720bda1'/>
<id>urn:sha1:feffb34257ee8eef18cc6a3a5a4f01d40720bda1</id>
<content type='text'>
The path.[ch] API takes an explicit repository parameter passed
throughout the callchain, instead of relying on the_repository
singleton instance.

* ps/path-sans-the-repository:
  path: adjust last remaining users of `the_repository`
  environment: move access to "core.sharedRepository" into repo settings
  environment: move access to "core.hooksPath" into repo settings
  repo-settings: introduce function to clear struct
  path: drop `git_path()` in favor of `repo_git_path()`
  rerere: let `rerere_path()` write paths into a caller-provided buffer
  path: drop `git_common_path()` in favor of `repo_common_path()`
  worktree: return allocated string from `get_worktree_git_dir()`
  path: drop `git_path_buf()` in favor of `repo_git_path_replace()`
  path: drop `git_pathdup()` in favor of `repo_git_path()`
  path: drop unused `strbuf_git_path()` function
  path: refactor `repo_submodule_path()` family of functions
  submodule: refactor `submodule_to_gitdir()` to accept a repo
  path: refactor `repo_worktree_path()` family of functions
  path: refactor `repo_git_path()` family of functions
  path: refactor `repo_common_path()` family of functions
</content>
</entry>
<entry>
<title>path: adjust last remaining users of `the_repository`</title>
<updated>2025-02-28T21:54:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-07T11:03:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=028f618658e34230e1d65678f14b6876e0f9856d'/>
<id>urn:sha1:028f618658e34230e1d65678f14b6876e0f9856d</id>
<content type='text'>
With the preceding refactorings we now only have a couple of implicit
users of `the_repository` left in the "path" subsystem, all of which
depend on global state via `calc_shared_perm()`. Make the dependency on
`the_repository` explicit by passing the repo as a parameter instead and
adjust callers accordingly.

Note that this change bubbles up into a couple of subsystems that were
previously declared as free from `the_repository`. Instead of marking
all of them as `the_repository`-dependent again, we instead use the
repository that is available in the calling context. There are three
exceptions though with "copy.c", "pack-write.c" and "tempfile.c".
Adjusting these would require us to adapt callsites all over the place,
so this is left for a future iteration.

Mark "path.c" as free from `the_repository`.

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/hash-cleanup'</title>
<updated>2025-02-10T18:18:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-02-10T18:18:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=246569bf83f2a586268d26559c7d6ea54c9316b6'/>
<id>urn:sha1:246569bf83f2a586268d26559c7d6ea54c9316b6</id>
<content type='text'>
Further code clean-up on the use of hash functions.  Now the
context object knows what hash function it is working with.

* ps/hash-cleanup:
  global: adapt callers to use generic hash context helpers
  hash: provide generic wrappers to update hash contexts
  hash: stop typedeffing the hash context
  hash: convert hashing context to a structure
</content>
</entry>
<entry>
<title>global: adapt callers to use generic hash context helpers</title>
<updated>2025-01-31T18:06:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-01-31T12:55:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0578f1e66aa381356bfe2f53decf3864d88d23d3'/>
<id>urn:sha1:0578f1e66aa381356bfe2f53decf3864d88d23d3</id>
<content type='text'>
Adapt callers to use generic hash context helpers instead of using the
hash algorithm to update them. This makes the callsites easier to reason
about and removes the possibility that the wrong hash algorithm is used
to update the hash context's state. And as a nice side effect this also
gets rid of a bunch of users of `the_hash_algo`.

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>hash: stop typedeffing the hash context</title>
<updated>2025-01-31T18:06:10Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-01-31T12:55:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7346e340f147131ca32089f61f7d0f502f80d19d'/>
<id>urn:sha1:7346e340f147131ca32089f61f7d0f502f80d19d</id>
<content type='text'>
We generally avoid using `typedef` in the Git codebase. One exception
though is the `git_hash_ctx`, likely because it used to be a union
rather than a struct until the preceding commit refactored it. But now
that it is a normal `struct` there isn't really a need for a typedef
anymore.

Drop the typedef and adapt all callers 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>
