Skip to content

Commit 50d0d41

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 08d1546 + 5b4d3c0 commit 50d0d41

File tree

3 files changed

+540
-8
lines changed

3 files changed

+540
-8
lines changed

Makefile

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

1734+
ifeq (,$(BUILT_IN_WRAPPER))
17341735
$(BUILT_INS): git$X
17351736
$(QUIET_BUILT_IN)$(RM) $@ && \
17361737
ln $< $@ 2>/dev/null || \
17371738
ln -s $< $@ 2>/dev/null || \
17381739
cp $< $@
1740+
else
1741+
$(BUILT_INS): $(BUILT_IN_WRAPPER)
1742+
$(QUIET_BUILT_IN)$(RM) $@ && \
1743+
cp $< $@
1744+
endif
17391745

17401746
common-cmds.h: generate-cmdlist.sh command-list.txt
17411747

@@ -2304,6 +2310,24 @@ profile-install: profile
23042310
profile-fast-install: profile-fast
23052311
$(MAKE) install
23062312

2313+
ifeq (,$(BUILT_IN_WRAPPER))
2314+
LN_OR_CP_BUILT_IN_BINDIR = \
2315+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2316+
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2317+
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2318+
cp "$$bindir/git$X" "$$bindir/$$p" || exit;
2319+
LN_OR_CP_BUILT_IN_EXECDIR = \
2320+
test -z "$(NO_INSTALL_HARDLINKS)" && \
2321+
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2322+
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2323+
cp "$$execdir/git$X" "$$execdir/$$p" || exit;
2324+
else
2325+
LN_OR_CP_BUILT_IN_BINDIR = \
2326+
cp "$(BUILT_IN_WRAPPER)" "$$bindir/$$p" || exit;
2327+
LN_OR_CP_BUILT_IN_EXECDIR = \
2328+
cp "$(BUILT_IN_WRAPPER)" "$$execdir/$$p" || exit;
2329+
endif
2330+
23072331
install: all
23082332
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
23092333
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
@@ -2342,17 +2366,11 @@ endif
23422366
} && \
23432367
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
23442368
$(RM) "$$bindir/$$p" && \
2345-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2346-
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2347-
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2348-
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
2369+
$(LN_OR_CP_BUILT_IN_BINDIR) \
23492370
done && \
23502371
for p in $(BUILT_INS); do \
23512372
$(RM) "$$execdir/$$p" && \
2352-
test -z "$(NO_INSTALL_HARDLINKS)" && \
2353-
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2354-
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2355-
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
2373+
$(LN_OR_CP_BUILT_IN_EXECDIR) \
23562374
done && \
23572375
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
23582376
for p in $$remote_curl_aliases; do \

0 commit comments

Comments
 (0)