Skip to content

Commit 2b6e9d1

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 170b3b1 + 52c28b1 commit 2b6e9d1

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
@@ -1702,11 +1702,17 @@ version.sp version.s version.o: EXTRA_CPPFLAGS = \
17021702
'-DGIT_VERSION="$(GIT_VERSION)"' \
17031703
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
17041704

1705+
ifeq (,$(BUILT_IN_WRAPPER))
17051706
$(BUILT_INS): git$X
17061707
$(QUIET_BUILT_IN)$(RM) $@ && \
17071708
ln $< $@ 2>/dev/null || \
17081709
ln -s $< $@ 2>/dev/null || \
17091710
cp $< $@
1711+
else
1712+
$(BUILT_INS): $(BUILT_IN_WRAPPER)
1713+
$(QUIET_BUILT_IN)$(RM) $@ && \
1714+
cp $< $@
1715+
endif
17101716

17111717
common-cmds.h: generate-cmdlist.sh command-list.txt
17121718

@@ -2271,6 +2277,24 @@ profile-install: profile
22712277
profile-fast-install: profile-fast
22722278
$(MAKE) install
22732279

2280+
ifeq (,$(BUILT_IN_WRAPPER))
2281+
LN_OR_CP_BUILT_IN_BINDIR = \
2282+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2283+
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2284+
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2285+
cp "$$bindir/git$X" "$$bindir/$$p" || exit;
2286+
LN_OR_CP_BUILT_IN_EXECDIR = \
2287+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2288+
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2289+
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2290+
cp "$$execdir/git$X" "$$execdir/$$p" || exit;
2291+
else
2292+
LN_OR_CP_BUILT_IN_BINDIR = \
2293+
cp "$(BUILT_IN_WRAPPER)" "$$bindir/$$p" || exit;
2294+
LN_OR_CP_BUILT_IN_EXECDIR = \
2295+
cp "$(BUILT_IN_WRAPPER)" "$$execdir/$$p" || exit;
2296+
endif
2297+
22742298
install: all
22752299
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
22762300
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
@@ -2309,17 +2333,11 @@ endif
23092333
} && \
23102334
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
23112335
$(RM) "$$bindir/$$p" && \
2312-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2313-
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2314-
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2315-
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
2336+
$(LN_OR_CP_BUILT_IN_BINDIR) \
23162337
done && \
23172338
for p in $(BUILT_INS); do \
23182339
$(RM) "$$execdir/$$p" && \
2319-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2320-
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2321-
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2322-
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
2340+
$(LN_OR_CP_BUILT_IN_EXECDIR) \
23232341
done && \
23242342
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
23252343
for p in $$remote_curl_aliases; do \

0 commit comments

Comments
 (0)