<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/setup.c, branch v2.50.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.50.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.50.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-03-06T22:06:31Z</updated>
<entry>
<title>Merge branch 'tz/doc-txt-to-adoc-fixes'</title>
<updated>2025-03-06T22:06:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-03-06T22:06:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=62c58891e177bb3860ab19d2dc2e23909759c6ed'/>
<id>urn:sha1:62c58891e177bb3860ab19d2dc2e23909759c6ed</id>
<content type='text'>
Fallouts from recent renaming of documentation files from .txt
suffix to the new .adoc suffix have been corrected.

* tz/doc-txt-to-adoc-fixes: (38 commits)
  xdiff: *.txt -&gt; *.adoc fixes
  unpack-trees.c: *.txt -&gt; *.adoc fixes
  transport.h: *.txt -&gt; *.adoc fixes
  trace2/tr2_sysenv.c: *.txt -&gt; *.adoc fixes
  trace2.h: *.txt -&gt; *.adoc fixes
  t6434: *.txt -&gt; *.adoc fixes
  t6012: *.txt -&gt; *.adoc fixes
  t/helper/test-rot13-filter.c: *.txt -&gt; *.adoc fixes
  simple-ipc.h: *.txt -&gt; *.adoc fixes
  setup.c: *.txt -&gt; *.adoc fixes
  refs.h: *.txt -&gt; *.adoc fixes
  pseudo-merge.h: *.txt -&gt; *.adoc fixes
  parse-options.h: *.txt -&gt; *.adoc fixes
  object-name.c: *.txt -&gt; *.adoc fixes
  list-objects-filter-options.h: *.txt -&gt; *.adoc fixes
  fsck.h: *.txt -&gt; *.adoc fixes
  diffcore.h: *.txt -&gt; *.adoc fixes
  diff.h: *.txt -&gt; *.adoc fixes
  contrib/long-running-filter: *.txt -&gt; *.adoc fixes
  config.c: *.txt -&gt; *.adoc fixes
  ...
</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>setup.c: *.txt -&gt; *.adoc fixes</title>
<updated>2025-03-03T21:49:25Z</updated>
<author>
<name>Todd Zullinger</name>
<email>tmz@pobox.com</email>
</author>
<published>2025-03-03T20:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0543300b594eb1337ce33415997b47594bf29056'/>
<id>urn:sha1:0543300b594eb1337ce33415997b47594bf29056</id>
<content type='text'>
Signed-off-by: Todd Zullinger &lt;tmz@pobox.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</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>environment: move access to "core.sharedRepository" into repo settings</title>
<updated>2025-02-28T21:54:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-07T11:03:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f1ce861c34bffbc02998173016b0bca0f6d9f6c4'/>
<id>urn:sha1:f1ce861c34bffbc02998173016b0bca0f6d9f6c4</id>
<content type='text'>
Similar as with the preceding commit, we track "core.sharedRepository"
via a pair of global variables. Move them into `struct repo_settings` so
that we can instead track them per-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>path: drop `git_path_buf()` in favor of `repo_git_path_replace()`</title>
<updated>2025-02-07T17:59:22Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-07T11:03:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3859e3965993493defd39cd54a2ab2097957e270'/>
<id>urn:sha1:3859e3965993493defd39cd54a2ab2097957e270</id>
<content type='text'>
Remove `git_path_buf()` in favor of `repo_git_path_replace()`. The
latter does essentially the same, with the only exception that it does
not rely on `the_repository` but takes the repo as separate parameter.

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>path: refactor `repo_common_path()` family of functions</title>
<updated>2025-02-07T17:59:21Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-02-07T11:03:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=70a16ff8a162ad0b6a39d17a1699a2949e2a2674'/>
<id>urn:sha1:70a16ff8a162ad0b6a39d17a1699a2949e2a2674</id>
<content type='text'>
The functions provided by the "path" subsystem to derive repository
paths for the commondir, gitdir, worktrees and submodules are quite
inconsistent. Some functions have a `strbuf_` prefix, others have
different return values, some don't provide a variant working on top of
`strbuf`s.

We're thus about to refactor all of these family of functions so that
they follow a common pattern:

  - `repo_*_path()` returns an allocated string.

  - `repo_*_path_append()` appends the path to the caller-provided
    buffer while returning a constant pointer to the buffer. This
    clarifies whether the buffer is being appended to or rewritten,
    which otherwise wasn't immediately obvious.

  - `repo_*_path_replace()` replaces contents of the buffer with the
    computed path, again returning a pointer to the buffer contents.

The returned constant pointer isn't being used anywhere yet, but it will
be used in subsequent commits. Its intent is to allow calling patterns
like the following somewhat contrived example:

    if (!stat(&amp;st, repo_common_path_replace(repo, &amp;buf, ...)) &amp;&amp;
        !unlink(repo_common_path_replace(repo, &amp;buf, ...)))
            ...

Refactor the commondir family of functions accordingly and adapt all
callers.

Note that `repo_common_pathv()` is converted into an internal
implementation detail. It is only used to implement `the_repository`
compatibility shims and will eventually be removed from the public
interface.

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>setup: fix reinit of repos with incompatible GIT_DEFAULT_HASH</title>
<updated>2025-01-30T22:36:41Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-01-30T16:24:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7e88640cd1801b6fe0288f744da7310b4749c0c8'/>
<id>urn:sha1:7e88640cd1801b6fe0288f744da7310b4749c0c8</id>
<content type='text'>
The exact same issue as described in the preceding commit also exists
for GIT_DEFAULT_HASH. Thus, reinitializing a repository that e.g. uses
SHA1 with `GIT_DEFAULT_HASH=sha256 git init` will cause the object
format of that repository to change to SHA256. This is of course bogus
as any existing objects and refs will not be converted, thus causing
repository corruption:

    $ git init repo
    Initialized empty Git repository in /tmp/repo/.git/
    $ cd repo/
    $ git commit --allow-empty -m message
    [main (root-commit) 35a7344] message
    $ GIT_DEFAULT_HASH=sha256 git init
    Reinitialized existing Git repository in /tmp/repo/.git/
    $ git show
    fatal: your current branch appears to be broken

Fix the issue by ignoring the environment variable in case the repo has
already been initialized with an object hash.

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>setup: fix reinit of repos with incompatible GIT_DEFAULT_REF_FORMAT</title>
<updated>2025-01-30T22:36:40Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-01-30T16:24:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=796fda3f786b3cd5518462b46895244dfecad63c'/>
<id>urn:sha1:796fda3f786b3cd5518462b46895244dfecad63c</id>
<content type='text'>
The GIT_DEFAULT_REF_FORMAT environment variable can be set to influence
the default ref format that new repostiories shall be initialized with.
While this is the expected behaviour when creating a new repository, it
is not when reinitializing a repository: we should retain the ref format
currently used by it in that case.

This doesn't work correctly right now:

    $ git init --ref-format=files repo
    Initialized empty Git repository in /tmp/repo/.git/
    $ GIT_DEFAULT_REF_FORMAT=reftable git init repo
    fatal: could not open '/tmp/repo/.git/refs/heads' for writing: Is a directory

Instead of retaining the current ref format, the reinitialization tries
to reinitialize the repository with the different format. This action
fails when git-init(1) tries to write the ".git/refs/heads" stub, which
in the context of the reftable backend is always written as a file so
that we can detect clients which inadvertently try to access the repo
with the wrong ref format. Seems like the protection mechanism works for
this case, as well.

Fix the issue by ignoring the environment variable in case the repo has
already been initialized with a ref storage format.

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/build-sign-compare'</title>
<updated>2024-12-23T17:32:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-12-23T17:32:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4156b6a741c7fb15a4eccb320612fb6e453f439c'/>
<id>urn:sha1:4156b6a741c7fb15a4eccb320612fb6e453f439c</id>
<content type='text'>
Start working to make the codebase buildable with -Wsign-compare.

* ps/build-sign-compare:
  t/helper: don't depend on implicit wraparound
  scalar: address -Wsign-compare warnings
  builtin/patch-id: fix type of `get_one_patchid()`
  builtin/blame: fix type of `length` variable when emitting object ID
  gpg-interface: address -Wsign-comparison warnings
  daemon: fix type of `max_connections`
  daemon: fix loops that have mismatching integer types
  global: trivial conversions to fix `-Wsign-compare` warnings
  pkt-line: fix -Wsign-compare warning on 32 bit platform
  csum-file: fix -Wsign-compare warning on 32-bit platform
  diff.h: fix index used to loop through unsigned integer
  config.mak.dev: drop `-Wno-sign-compare`
  global: mark code units that generate warnings with `-Wsign-compare`
  compat/win32: fix -Wsign-compare warning in "wWinMain()"
  compat/regex: explicitly ignore "-Wsign-compare" warnings
  git-compat-util: introduce macros to disable "-Wsign-compare" warnings
</content>
</entry>
</feed>
