Skip to content

Commit 1809bb0

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 41faf9b + 849ea40 commit 1809bb0

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
@@ -1694,11 +1694,17 @@ version.sp version.s version.o: EXTRA_CPPFLAGS = \
16941694
'-DGIT_VERSION="$(GIT_VERSION)"' \
16951695
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
16961696

1697+
ifeq (,$(BUILT_IN_WRAPPER))
16971698
$(BUILT_INS): git$X
16981699
$(QUIET_BUILT_IN)$(RM) $@ && \
16991700
ln $< $@ 2>/dev/null || \
17001701
ln -s $< $@ 2>/dev/null || \
17011702
cp $< $@
1703+
else
1704+
$(BUILT_INS): $(BUILT_IN_WRAPPER)
1705+
$(QUIET_BUILT_IN)$(RM) $@ && \
1706+
cp $< $@
1707+
endif
17021708

17031709
common-cmds.h: generate-cmdlist.sh command-list.txt
17041710

@@ -2263,6 +2269,24 @@ profile-install: profile
22632269
profile-fast-install: profile-fast
22642270
$(MAKE) install
22652271

2272+
ifeq (,$(BUILT_IN_WRAPPER))
2273+
LN_OR_CP_BUILT_IN_BINDIR = \
2274+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2275+
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2276+
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2277+
cp "$$bindir/git$X" "$$bindir/$$p" || exit;
2278+
LN_OR_CP_BUILT_IN_EXECDIR = \
2279+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2280+
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2281+
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2282+
cp "$$execdir/git$X" "$$execdir/$$p" || exit;
2283+
else
2284+
LN_OR_CP_BUILT_IN_BINDIR = \
2285+
cp "$(BUILT_IN_WRAPPER)" "$$bindir/$$p" || exit;
2286+
LN_OR_CP_BUILT_IN_EXECDIR = \
2287+
cp "$(BUILT_IN_WRAPPER)" "$$execdir/$$p" || exit;
2288+
endif
2289+
22662290
install: all
22672291
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
22682292
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
@@ -2301,17 +2325,11 @@ endif
23012325
} && \
23022326
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
23032327
$(RM) "$$bindir/$$p" && \
2304-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2305-
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2306-
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2307-
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
2328+
$(LN_OR_CP_BUILT_IN_BINDIR) \
23082329
done && \
23092330
for p in $(BUILT_INS); do \
23102331
$(RM) "$$execdir/$$p" && \
2311-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2312-
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2313-
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2314-
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
2332+
$(LN_OR_CP_BUILT_IN_EXECDIR) \
23152333
done && \
23162334
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
23172335
for p in $$remote_curl_aliases; do \

0 commit comments

Comments
 (0)