Skip to content

osxkeychain: define build targets in the top-level Makefile.#2046

Open
KojiNakamaru wants to merge 1 commit intogitgitgadget:masterfrom
KojiNakamaru:fix/osxkeychain-makefile
Open

osxkeychain: define build targets in the top-level Makefile.#2046
KojiNakamaru wants to merge 1 commit intogitgitgadget:masterfrom
KojiNakamaru:fix/osxkeychain-makefile

Conversation

@KojiNakamaru
Copy link

@KojiNakamaru KojiNakamaru commented Feb 10, 2026

Changes since v2:

  • Squash the double spaces after "-C" into one white.
  • Add explicit mkdir -p contrib/credential/osxkeychain/.depend for older
    versions of clang.

cc: Junio C Hamano gitster@pobox.com
cc: "D. Ben Knoble" ben.knoble@gmail.com

@KojiNakamaru
Copy link
Author

/preview

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 10, 2026

Preview email sent as pull.2046.git.1770746103768.gitgitgadget@gmail.com

@KojiNakamaru
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 10, 2026

Submitted as pull.2046.git.1770746461307.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v1

To fetch this version to local tag pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v1

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 10, 2026

Junio C Hamano wrote on the Git mailing list (how to reply to this email):

"Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  Makefile                                | 17 +++++++
>  contrib/credential/osxkeychain/Makefile | 65 +++----------------------
>  2 files changed, 23 insertions(+), 59 deletions(-)

Nice simplification overall.

> diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
> index c68445b82d..ddb29f0563 100644
> --- a/contrib/credential/osxkeychain/Makefile
> +++ b/contrib/credential/osxkeychain/Makefile
> @@ -1,66 +1,13 @@
>  # The default target of this Makefile is...
>  all:: git-credential-osxkeychain
>  
> -include ../../../config.mak.uname
> --include ../../../config.mak.autogen
> --include ../../../config.mak
> +git-credential-osxkeychain:
> +	cd ../../..; make contrib/credential/osxkeychain/git-credential-osxkeychain

Let's not write "make", but stick to $(MAKE), perhaps like

	$(MAKE) -C ../../.. contrib/credential/osxkeychain/$@

> +install:
> +	cd ../../..; make install-git-credential-osxkeychain
>  
>  clean:
> -	$(RM) git-credential-osxkeychain git-credential-osxkeychain.o
> +	cd ../../..; make clean-git-credential-osxkeychain

Likewise.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 10, 2026

This patch series was integrated into seen via git@9d91fc6.

@gitgitgadget gitgitgadget bot added the seen label Feb 10, 2026
@gitgitgadget
Copy link

gitgitgadget bot commented Feb 10, 2026

This patch series was integrated into seen via git@1a1c338.

@KojiNakamaru KojiNakamaru force-pushed the fix/osxkeychain-makefile branch from 0aa80d1 to 8c5d75f Compare February 10, 2026 23:19
@gitgitgadget
Copy link

gitgitgadget bot commented Feb 10, 2026

Koji Nakamaru wrote on the Git mailing list (how to reply to this email):

On Wed, Feb 11, 2026 at 4:50 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> >  Makefile                                | 17 +++++++
> >  contrib/credential/osxkeychain/Makefile | 65 +++----------------------
> >  2 files changed, 23 insertions(+), 59 deletions(-)
>
> Nice simplification overall.
>
> > diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
> > index c68445b82d..ddb29f0563 100644
> > --- a/contrib/credential/osxkeychain/Makefile
> > +++ b/contrib/credential/osxkeychain/Makefile
> > @@ -1,66 +1,13 @@
> >  # The default target of this Makefile is...
> >  all:: git-credential-osxkeychain
> >
> > -include ../../../config.mak.uname
> > --include ../../../config.mak.autogen
> > --include ../../../config.mak
> > +git-credential-osxkeychain:
> > +     cd ../../..; make contrib/credential/osxkeychain/git-credential-osxkeychain
>
> Let's not write "make", but stick to $(MAKE), perhaps like
>
>         $(MAKE) -C ../../.. contrib/credential/osxkeychain/$@
>
> > +install:
> > +     cd ../../..; make install-git-credential-osxkeychain
> >
> >  clean:
> > -     $(RM) git-credential-osxkeychain git-credential-osxkeychain.o
> > +     cd ../../..; make clean-git-credential-osxkeychain
>
> Likewise.

Thank you for the review. I'll apply these changes and submit the next
iteration soon.

--
Koji Nakamaru

@KojiNakamaru
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 11, 2026

Submitted as pull.2046.v2.git.1770775169908.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v2

To fetch this version to local tag pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v2

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 11, 2026

Junio C Hamano wrote on the Git mailing list (how to reply to this email):

"Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes:

>      -+	cd ../../..; make install-git-credential-osxkeychain
>      ++	$(MAKE) -C  ../../.. install-git-credential-osxkeychain

Will replace and mark for 'next'.  Will squash the double spaces
after "-C" into one while doing so.

Thanks.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 11, 2026

Koji Nakamaru wrote on the Git mailing list (how to reply to this email):

On Thu, Feb 12, 2026 at 12:37 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> >      -+       cd ../../..; make install-git-credential-osxkeychain
> >      ++       $(MAKE) -C  ../../.. install-git-credential-osxkeychain
>
> Will replace and mark for 'next'.  Will squash the double spaces
> after "-C" into one while doing so.

Thank you again for the squash and for marking it for 'next'.

--
Koji Nakamaru

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 12, 2026

This branch is now known as kn/osxkeychain-buildfix.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 12, 2026

This patch series was integrated into seen via git@ba5d4e8.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 13, 2026

This patch series was integrated into seen via git@06f3f5c.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 14, 2026

There was a status update in the "Cooking" section about the branch kn/osxkeychain-buildfix on the Git mailing list:

Simplify build procedure for oxskeychain (in contrib/).

Will merge to 'next'?
source: <pull.2046.v2.git.1770775169908.gitgitgadget@gmail.com>

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 16, 2026

"D. Ben Knoble" wrote on the Git mailing list (how to reply to this email):

On Wed, Feb 11, 2026 at 6:06 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
>
> On Thu, Feb 12, 2026 at 12:37 AM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > "Koji Nakamaru via GitGitGadget" <gitgitgadget@gmail.com> writes:
> >
> > >      -+       cd ../../..; make install-git-credential-osxkeychain
> > >      ++       $(MAKE) -C  ../../.. install-git-credential-osxkeychain
> >
> > Will replace and mark for 'next'.  Will squash the double spaces
> > after "-C" into one while doing so.
>
> Thank you again for the squash and for marking it for 'next'.
>
> --
> Koji Nakamaru
>

Homebrew picked this patch on top of 2.53.0, and on a recent build on
older macOS I needed to

    mkdir contrib/credential/osxkeychain/.depend

in order to make their build work, since otherwise:

    error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
    1 error generated.
    make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1


-- 
D. Ben Knoble

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 16, 2026

User "D. Ben Knoble" <ben.knoble@gmail.com> has been added to the cc: list.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 17, 2026

Koji Nakamaru wrote on the Git mailing list (how to reply to this email):

On Tue, Feb 17, 2026 at 8:45 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> ...
>
> Homebrew picked this patch on top of 2.53.0, and on a recent build on
> older macOS I needed to
>
>     mkdir contrib/credential/osxkeychain/.depend
>
> in order to make their build work, since otherwise:
>
>     error: error opening
> 'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
> No such file or directory
>     1 error generated.
>     make[1]: ***
> [contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1

I tried to reproduce this using the current Homebrew formula for git [1]
on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following
steps:

  brew tap --force homebrew/core
  cd "$(brew --repository homebrew/core)"
  git checkout -B main origin/main
  git pull
  HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git

In my environment, the build finished successfully. The patch doesn't
seem to trigger any issues during a local "make" either. How exactly are
you performing your build?

[1] https://github.com/Homebrew/homebrew-core/blob/9ec3da0dcd3ccd1cd4d892a71377b251770212d7/Formula/g/git.rb

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 17, 2026

"D. Ben Knoble" wrote on the Git mailing list (how to reply to this email):

On Mon, Feb 16, 2026 at 8:09 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
>
> On Tue, Feb 17, 2026 at 8:45 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > ...
> >
> > Homebrew picked this patch on top of 2.53.0, and on a recent build on
> > older macOS I needed to
> >
> >     mkdir contrib/credential/osxkeychain/.depend
> >
> > in order to make their build work, since otherwise:
> >
> >     error: error opening
> > 'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
> > No such file or directory
> >     1 error generated.
> >     make[1]: ***
> > [contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
>
> I tried to reproduce this using the current Homebrew formula for git [1]
> on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following
> steps:
>
>   brew tap --force homebrew/core
>   cd "$(brew --repository homebrew/core)"
>   git checkout -B main origin/main
>   git pull
>   HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
>
> In my environment, the build finished successfully. The patch doesn't
> seem to trigger any issues during a local "make" either. How exactly are
> you performing your build?
>
> [1] https://github.com/Homebrew/homebrew-core/blob/9ec3da0dcd3ccd1cd4d892a71377b251770212d7/Formula/g/git.rb

macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build
from source. So just

    brew upgrade git

built 2.53.0 + patches from source. "brew --version" says I have
"Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line,
so I'm not sure off-hand if that includes the core tap version or not
anymore.

I ended up having to use `brew upgrade --debug git`, fix the build
error ("mkdir …") and manually perform a few steps when it arose, etc.

-- 
D. Ben Knoble

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 17, 2026

"D. Ben Knoble" wrote on the Git mailing list (how to reply to this email):

On Tue, Feb 17, 2026 at 8:10 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>
> On Mon, Feb 16, 2026 at 8:09 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
> >
> > On Tue, Feb 17, 2026 at 8:45 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > > ...
> > >
> > > Homebrew picked this patch on top of 2.53.0, and on a recent build on
> > > older macOS I needed to
> > >
> > >     mkdir contrib/credential/osxkeychain/.depend
> > >
> > > in order to make their build work, since otherwise:
> > >
> > >     error: error opening
> > > 'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
> > > No such file or directory
> > >     1 error generated.
> > >     make[1]: ***
> > > [contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
> >
> > I tried to reproduce this using the current Homebrew formula for git [1]
> > on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following
> > steps:
> >
> >   brew tap --force homebrew/core
> >   cd "$(brew --repository homebrew/core)"
> >   git checkout -B main origin/main
> >   git pull
> >   HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
> >
> > In my environment, the build finished successfully. The patch doesn't
> > seem to trigger any issues during a local "make" either. How exactly are
> > you performing your build?
> >
> > [1] https://github.com/Homebrew/homebrew-core/blob/9ec3da0dcd3ccd1cd4d892a71377b251770212d7/Formula/g/git.rb
>
> macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build
> from source. So just
>
>     brew upgrade git
>
> built 2.53.0 + patches from source. "brew --version" says I have
> "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line,
> so I'm not sure off-hand if that includes the core tap version or not
> anymore.

To rule out differing versions, I also diff'd the Homebrew formula
from GitHub against "brew edit git", and the only difference is the
bottle stanza on GitHub.

> I ended up having to use `brew upgrade --debug git`, fix the build
> error ("mkdir …") and manually perform a few steps when it arose, etc.

-- 
D. Ben Knoble

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 17, 2026

Koji Nakamaru wrote on the Git mailing list (how to reply to this email):

On Tue, Feb 17, 2026 at 10:12 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>
> On Tue, Feb 17, 2026 at 8:10 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> >
> > On Mon, Feb 16, 2026 at 8:09 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
> > >
> > > On Tue, Feb 17, 2026 at 8:45 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > > > ...
> > > >
> > > > Homebrew picked this patch on top of 2.53.0, and on a recent build on
> > > > older macOS I needed to
> > > >
> > > >     mkdir contrib/credential/osxkeychain/.depend
> > > >
> > > > in order to make their build work, since otherwise:
> > > >
> > > >     error: error opening
> > > > 'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
> > > > No such file or directory
> > > >     1 error generated.
> > > >     make[1]: ***
> > > > [contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
> > >
> > > I tried to reproduce this using the current Homebrew formula for git [1]
> > > on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following
> > > steps:
> > >
> > >   brew tap --force homebrew/core
> > >   cd "$(brew --repository homebrew/core)"
> > >   git checkout -B main origin/main
> > >   git pull
> > >   HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
> > >
> > > In my environment, the build finished successfully. The patch doesn't
> > > seem to trigger any issues during a local "make" either. How exactly are
> > > you performing your build?
> > >
> > > [1] https://github.com/Homebrew/homebrew-core/blob/9ec3da0dcd3ccd1cd4d892a71377b251770212d7/Formula/g/git.rb
> >
> > macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build
> > from source. So just
> >
> >     brew upgrade git
> >
> > built 2.53.0 + patches from source. "brew --version" says I have
> > "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line,
> > so I'm not sure off-hand if that includes the core tap version or not
> > anymore.
>
> To rule out differing versions, I also diff'd the Homebrew formula
> from GitHub against "brew edit git", and the only difference is the
> bottle stanza on GitHub.
>
> > I ended up having to use `brew upgrade --debug git`, fix the build
> > error ("mkdir …") and manually perform a few steps when it arose, etc.

Thank you for the details. The current Makefile rule performs the
following to generate dependency files

  contrib/credential/osxkeychain/git-credential-osxkeychain.o:
contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
          $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<

where the compiler implicitly creates
contrib/credential/osxkeychain/.depend/ if it doesn't exist. This
behavior seems to be supported at least since Apple clang 15.0.0. The
following should work for older versions of clang that might not support
this behavior.

  contrib/credential/osxkeychain/git-credential-osxkeychain.o:
contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
          @mkdir -p contrib/credential/osxkeychain/.depend
          $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<

Can you try this modification in your environment? You can confirm
whether this works as below.

  git clone https://github.com/git/git.git
  cd git
  git checkout v2.53.0
  curl https://raw.githubusercontent.com/Homebrew/homebrew-core/46d746f92167fd0559af22f4ccb79c9ff35fbe33/Patches/git/2.53.0-osxkeychain-top-level-makefile.patch
| patch

  # The next should fail in your environment.
  make contrib/credential/osxkeychain/git-credential-osxkeychain

  # Please edit Makefile as described and try again. This should
  # succeed.
  make contrib/credential/osxkeychain/git-credential-osxkeychain

--
Koji Nakamaru

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 17, 2026

"D. Ben Knoble" wrote on the Git mailing list (how to reply to this email):

On Tue, Feb 17, 2026 at 1:05 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
>
> On Tue, Feb 17, 2026 at 10:12 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> >
> > On Tue, Feb 17, 2026 at 8:10 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > >
> > > On Mon, Feb 16, 2026 at 8:09 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
> > > >
> > > > On Tue, Feb 17, 2026 at 8:45 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > > > > ...
> > > > >
> > > > > Homebrew picked this patch on top of 2.53.0, and on a recent build on
> > > > > older macOS I needed to
> > > > >
> > > > >     mkdir contrib/credential/osxkeychain/.depend
> > > > >
> > > > > in order to make their build work, since otherwise:
> > > > >
> > > > >     error: error opening
> > > > > 'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
> > > > > No such file or directory
> > > > >     1 error generated.
> > > > >     make[1]: ***
> > > > > [contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
> > > >
> > > > I tried to reproduce this using the current Homebrew formula for git [1]
> > > > on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following
> > > > steps:
> > > >
> > > >   brew tap --force homebrew/core
> > > >   cd "$(brew --repository homebrew/core)"
> > > >   git checkout -B main origin/main
> > > >   git pull
> > > >   HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
> > > >
> > > > In my environment, the build finished successfully. The patch doesn't
> > > > seem to trigger any issues during a local "make" either. How exactly are
> > > > you performing your build?
> > > >
> > > > [1] https://github.com/Homebrew/homebrew-core/blob/9ec3da0dcd3ccd1cd4d892a71377b251770212d7/Formula/g/git.rb
> > >
> > > macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build
> > > from source. So just
> > >
> > >     brew upgrade git
> > >
> > > built 2.53.0 + patches from source. "brew --version" says I have
> > > "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line,
> > > so I'm not sure off-hand if that includes the core tap version or not
> > > anymore.
> >
> > To rule out differing versions, I also diff'd the Homebrew formula
> > from GitHub against "brew edit git", and the only difference is the
> > bottle stanza on GitHub.
> >
> > > I ended up having to use `brew upgrade --debug git`, fix the build
> > > error ("mkdir …") and manually perform a few steps when it arose, etc.
>
> Thank you for the details. The current Makefile rule performs the
> following to generate dependency files
>
>   contrib/credential/osxkeychain/git-credential-osxkeychain.o:
> contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
>           $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
> $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
>
> where the compiler implicitly creates
> contrib/credential/osxkeychain/.depend/ if it doesn't exist. This
> behavior seems to be supported at least since Apple clang 15.0.0.

Aha! I have clang 13. That probably explains it.

> The
> following should work for older versions of clang that might not support
> this behavior.
>
>   contrib/credential/osxkeychain/git-credential-osxkeychain.o:
> contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
>           @mkdir -p contrib/credential/osxkeychain/.depend
>           $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
> $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
>
> Can you try this modification in your environment? You can confirm
> whether this works as below.
>
>   git clone https://github.com/git/git.git
>   cd git
>   git checkout v2.53.0
>   curl https://raw.githubusercontent.com/Homebrew/homebrew-core/46d746f92167fd0559af22f4ccb79c9ff35fbe33/Patches/git/2.53.0-osxkeychain-top-level-makefile.patch
> | patch

Using git-am worked (patch doesn't apply it)

>   # The next should fail in your environment.
>   make contrib/credential/osxkeychain/git-credential-osxkeychain

Fails as stated.

>   # Please edit Makefile as described and try again. This should
>   # succeed.
>   make contrib/credential/osxkeychain/git-credential-osxkeychain

With the (now obvious!) proposal, indeed succeeds.

Thanks!

-- 
D. Ben Knoble

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 17, 2026

This patch series was integrated into seen via git@3c2cbc0.

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 18, 2026

There was a status update in the "Cooking" section about the branch kn/osxkeychain-buildfix on the Git mailing list:

Simplify build procedure for oxskeychain (in contrib/).

Will merge to 'next'?
source: <pull.2046.v2.git.1770775169908.gitgitgadget@gmail.com>

The fix for git-credential-osxkeychain in 4580bcd (osxkeychain: avoid
incorrectly skipping store operation) introduced linkage with libgit.a,
and its Makefile was adjusted accordingly. However, the build fails as
of 864f55e because several macOS-specific refinements were applied to
the top-level Makefile and config.mak.uname, such as:

  - 363837a (macOS: make Homebrew use configurable, 2025-12-24)
  - cee341e (macOS: use iconv from Homebrew if needed and present,
    2025-12-24)
  - d281241 (utf8.c: enable workaround for iconv under macOS 14/15,
    2026-01-12)

Since libgit.a and its corresponding header files depend on many flags
defined in the top-level Makefile, these flags must be consistently
defined when building git-credential-osxkeychain. Continuing to manually
adjust the git-credential-osxkeychain Makefile is cumbersome and
fragile.

Define the build targets for git-credential-osxkeychain in the top-level
Makefile and modify its local Makefile to simply rely on those targets.

Helped-by: Junio C Hamano <gitster@pobox.com>
Reported-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Koji Nakamaru <koji.nakamaru@gree.net>
@KojiNakamaru KojiNakamaru force-pushed the fix/osxkeychain-makefile branch from 8c5d75f to 25a66e1 Compare February 18, 2026 04:28
@gitgitgadget
Copy link

gitgitgadget bot commented Feb 18, 2026

Koji Nakamaru wrote on the Git mailing list (how to reply to this email):

On Wed, Feb 18, 2026 at 6:54 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
>
> On Tue, Feb 17, 2026 at 1:05 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
> >
> > On Tue, Feb 17, 2026 at 10:12 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > >
> > > On Tue, Feb 17, 2026 at 8:10 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > > >
> > > > On Mon, Feb 16, 2026 at 8:09 PM Koji Nakamaru <koji.nakamaru@gree.net> wrote:
> > > > >
> > > > > On Tue, Feb 17, 2026 at 8:45 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > > > > > ...
> > > > > >
> > > > > > Homebrew picked this patch on top of 2.53.0, and on a recent build on
> > > > > > older macOS I needed to
> > > > > >
> > > > > >     mkdir contrib/credential/osxkeychain/.depend
> > > > > >
> > > > > > in order to make their build work, since otherwise:
> > > > > >
> > > > > >     error: error opening
> > > > > > 'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
> > > > > > No such file or directory
> > > > > >     1 error generated.
> > > > > >     make[1]: ***
> > > > > > [contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
> > > > >
> > > > > I tried to reproduce this using the current Homebrew formula for git [1]
> > > > > on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following
> > > > > steps:
> > > > >
> > > > >   brew tap --force homebrew/core
> > > > >   cd "$(brew --repository homebrew/core)"
> > > > >   git checkout -B main origin/main
> > > > >   git pull
> > > > >   HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
> > > > >
> > > > > In my environment, the build finished successfully. The patch doesn't
> > > > > seem to trigger any issues during a local "make" either. How exactly are
> > > > > you performing your build?
> > > > >
> > > > > [1] https://github.com/Homebrew/homebrew-core/blob/9ec3da0dcd3ccd1cd4d892a71377b251770212d7/Formula/g/git.rb
> > > >
> > > > macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build
> > > > from source. So just
> > > >
> > > >     brew upgrade git
> > > >
> > > > built 2.53.0 + patches from source. "brew --version" says I have
> > > > "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line,
> > > > so I'm not sure off-hand if that includes the core tap version or not
> > > > anymore.
> > >
> > > To rule out differing versions, I also diff'd the Homebrew formula
> > > from GitHub against "brew edit git", and the only difference is the
> > > bottle stanza on GitHub.
> > >
> > > > I ended up having to use `brew upgrade --debug git`, fix the build
> > > > error ("mkdir …") and manually perform a few steps when it arose, etc.
> >
> > Thank you for the details. The current Makefile rule performs the
> > following to generate dependency files
> >
> >   contrib/credential/osxkeychain/git-credential-osxkeychain.o:
> > contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
> >           $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
> > $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
> >
> > where the compiler implicitly creates
> > contrib/credential/osxkeychain/.depend/ if it doesn't exist. This
> > behavior seems to be supported at least since Apple clang 15.0.0.
>
> Aha! I have clang 13. That probably explains it.
>
> > The
> > following should work for older versions of clang that might not support
> > this behavior.
> >
> >   contrib/credential/osxkeychain/git-credential-osxkeychain.o:
> > contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
> >           @mkdir -p contrib/credential/osxkeychain/.depend
> >           $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
> > $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
> >
> > Can you try this modification in your environment? You can confirm
> > whether this works as below.
> >
> >   git clone https://github.com/git/git.git
> >   cd git
> >   git checkout v2.53.0
> >   curl https://raw.githubusercontent.com/Homebrew/homebrew-core/46d746f92167fd0559af22f4ccb79c9ff35fbe33/Patches/git/2.53.0-osxkeychain-top-level-makefile.patch
> > | patch
>
> Using git-am worked (patch doesn't apply it)
>
> >   # The next should fail in your environment.
> >   make contrib/credential/osxkeychain/git-credential-osxkeychain
>
> Fails as stated.
>
> >   # Please edit Makefile as described and try again. This should
> >   # succeed.
> >   make contrib/credential/osxkeychain/git-credential-osxkeychain
>
> With the (now obvious!) proposal, indeed succeeds.
>
> Thanks!

Thank you for testing the modification. I'll submit an updated patch
later and also submit it to homebrew (for the current 2.53.0).

--
Koji Nakamaru

@KojiNakamaru
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 18, 2026

Submitted as pull.2046.v3.git.1771391650713.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v3

To fetch this version to local tag pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v3:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant