Skip to content

Commit c4249a1

Browse files
committed
Merge 'git-wrapper' into HEAD
Use msysGit's `git-wrapper` instead of the builtins. This works around two issues: - when the file system does not allow hard links, we would waste over 800 megabyte by having 109 copies of a multi-megabyte executable - even when the file system allows hard links, the Windows Explorer counts the disk usage as if it did not. Many users complained about Git for Windows using too much space (when it actually did not). We can easily avoid those user complaints by merging this branch. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents c80e91b + f5b72bd commit c4249a1

File tree

3 files changed

+538
-8
lines changed

3 files changed

+538
-8
lines changed

Makefile

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,11 +1678,17 @@ version.sp version.s version.o: EXTRA_CPPFLAGS = \
16781678
'-DGIT_VERSION="$(GIT_VERSION)"' \
16791679
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
16801680

1681+
ifeq (,$(BUILT_IN_WRAPPER))
16811682
$(BUILT_INS): git$X
16821683
$(QUIET_BUILT_IN)$(RM) $@ && \
16831684
ln $< $@ 2>/dev/null || \
16841685
ln -s $< $@ 2>/dev/null || \
16851686
cp $< $@
1687+
else
1688+
$(BUILT_INS): $(BUILT_IN_WRAPPER)
1689+
$(QUIET_BUILT_IN)$(RM) $@ && \
1690+
cp $< $@
1691+
endif
16861692

16871693
common-cmds.h: ./generate-cmdlist.sh command-list.txt
16881694

@@ -2247,6 +2253,24 @@ profile-install: profile
22472253
profile-fast-install: profile-fast
22482254
$(MAKE) install
22492255

2256+
ifeq (,$(BUILT_IN_WRAPPER))
2257+
LN_OR_CP_BUILT_IN_BINDIR = \
2258+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2259+
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2260+
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2261+
cp "$$bindir/git$X" "$$bindir/$$p" || exit;
2262+
LN_OR_CP_BUILT_IN_EXECDIR = \
2263+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2264+
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2265+
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2266+
cp "$$execdir/git$X" "$$execdir/$$p" || exit;
2267+
else
2268+
LN_OR_CP_BUILT_IN_BINDIR = \
2269+
cp "$(BUILT_IN_WRAPPER)" "$$bindir/$$p" || exit;
2270+
LN_OR_CP_BUILT_IN_EXECDIR = \
2271+
cp "$(BUILT_IN_WRAPPER)" "$$execdir/$$p" || exit;
2272+
endif
2273+
22502274
install: all
22512275
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
22522276
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
@@ -2285,17 +2309,11 @@ endif
22852309
} && \
22862310
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
22872311
$(RM) "$$bindir/$$p" && \
2288-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2289-
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2290-
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2291-
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
2312+
$(LN_OR_CP_BUILT_IN_BINDIR) \
22922313
done && \
22932314
for p in $(BUILT_INS); do \
22942315
$(RM) "$$execdir/$$p" && \
2295-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2296-
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2297-
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2298-
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
2316+
$(LN_OR_CP_BUILT_IN_EXECDIR) \
22992317
done && \
23002318
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
23012319
for p in $$remote_curl_aliases; do \

0 commit comments

Comments
 (0)