Compare

843047f8613da2f38f024c5b69e7e89a4ff175fb..0d5ce137ec59e124540fbae4d2c7488d73c5c1a0

windows: skip linking `git-<command>` for built-ins

It is merely a historical wart that, say, `git-commit` exists in the
`libexec/git-core/` directory, a tribute to the original idea to let Git
be essentially a bunch of Unix shell scripts revolving around very few
"plumbing" (AKA low-level) commands.

Git has evolved a lot from there. These days, most of Git's
functionality is contained within the `git` executable, in the form of
"built-in" commands.

To accommodate for scripts that use the "dashed" form of Git commands,
even today, Git provides hard-links that make the `git` executable
available as, say, `git-commit`, just in case that an old script has not
been updated to invoke `git commit`.

Those hard-links do not come cheap: they take about half a minute for
every build of Git on Windows, they are mistaken for taking up huge
amounts of space by some Windows Explorer versions that do not
understand hard-links, and therefore many a "bug" report had to be
addressed.

The "dashed form" has been officially deprecated in Git version 1.5.4,
which was released on February 2nd, 2008, i.e. a very long time ago.
This deprecation was never finalized by skipping these hard-links, but
we can start the process now, in Git for Windows.

Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin <johannes.schindelin@gmx.de> · 2026-09-10 06:05 UTC · committed by Junio C Hamano

Browse files
1 file changed, +8 −8
modified config.mak.uname
@@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)
465 465 GIT_VERSION := $(GIT_VERSION).MSVC
466 466 pathsep = ;
467 467 # Assume that this is built in Git for Windows' SDK
468 - ifeq (MINGW32,$(MSYSTEM))
469 - prefix = /mingw32
470 - else
471 - ifeq (CLANGARM64,$(MSYSTEM))
472 - prefix = /clangarm64
473 - else
474 - prefix = /mingw64
475 - endif
468 + ifneq (,$(MSYSTEM))
469 + prefix = $(MINGW_PREFIX)
476 470 endif
477 471 # Prepend MSVC 64-bit tool-chain to PATH.
478 472 #
@@ -524,6 +518,7 @@ ifeq ($(uname_S),Windows)
524 518 NO_POSIX_GOODIES = UnfortunatelyYes
525 519 NATIVE_CRLF = YesPlease
526 520 DEFAULT_HELP_FORMAT = html
521 + SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
527 522 ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
528 523 # Move system config into top-level /etc/
529 524 ETC_GITCONFIG = ../etc/gitconfig
@@ -716,6 +711,7 @@ ifeq ($(uname_S),MINGW)
716 711 FSMONITOR_DAEMON_BACKEND = win32
717 712 FSMONITOR_OS_SETTINGS = win32
718 713
714 + SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
719 715 RUNTIME_PREFIX = YesPlease
720 716 HAVE_WPGMPTR = YesWeDo
721 717 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
@@ -755,6 +751,10 @@ ifeq ($(uname_S),MINGW)
755 751 BASIC_LDFLAGS += -Wl,--dynamicbase
756 752 endif
757 753 ifneq (,$(MSYSTEM))
754 + ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))
755 + # Override if empty or does not start with a slash
756 + MINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)
757 + endif
758 758 prefix = $(MINGW_PREFIX)
759 759 HOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))
760 760 BASIC_LDFLAGS += -Wl,--pic-executable