Skip to content

Commit

Permalink
Merge 'git-wrapper' into HEAD
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Aug 30, 2015
2 parents 79fdb75 + 38dc94d commit 4262140
Show file tree
Hide file tree
Showing 3 changed files with 538 additions and 8 deletions.
34 changes: 26 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1687,11 +1687,17 @@ version.sp version.s version.o: EXTRA_CPPFLAGS = \
'-DGIT_VERSION="$(GIT_VERSION)"' \
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'

ifeq (,$(BUILT_IN_WRAPPER))
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
ln $< $@ 2>/dev/null || \
ln -s $< $@ 2>/dev/null || \
cp $< $@
else
$(BUILT_INS): $(BUILT_IN_WRAPPER)
$(QUIET_BUILT_IN)$(RM) $@ && \
cp $< $@
endif

common-cmds.h: generate-cmdlist.perl command-list.txt

Expand Down Expand Up @@ -2256,6 +2262,24 @@ profile-install: profile
profile-fast-install: profile-fast
$(MAKE) install

ifeq (,$(BUILT_IN_WRAPPER))
LN_OR_CP_BUILT_IN_BINDIR = \
test -z "$(NO_INSTALL_HARDLINKS)" && \
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
cp "$$bindir/git$X" "$$bindir/$$p" || exit;
LN_OR_CP_BUILT_IN_EXECDIR = \
test -z "$(NO_INSTALL_HARDLINKS)" && \
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
cp "$$execdir/git$X" "$$execdir/$$p" || exit;
else
LN_OR_CP_BUILT_IN_BINDIR = \
cp "$(BUILT_IN_WRAPPER)" "$$bindir/$$p" || exit;
LN_OR_CP_BUILT_IN_EXECDIR = \
cp "$(BUILT_IN_WRAPPER)" "$$execdir/$$p" || exit;
endif

install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Expand Down Expand Up @@ -2294,17 +2318,11 @@ endif
} && \
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
$(RM) "$$bindir/$$p" && \
test -z "$(NO_INSTALL_HARDLINKS)" && \
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
$(LN_OR_CP_BUILT_IN_BINDIR) \
done && \
for p in $(BUILT_INS); do \
$(RM) "$$execdir/$$p" && \
test -z "$(NO_INSTALL_HARDLINKS)" && \
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
$(LN_OR_CP_BUILT_IN_EXECDIR) \
done && \
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
for p in $$remote_curl_aliases; do \
Expand Down
Loading

0 comments on commit 4262140

Please sign in to comment.