* [PATCH 0/2] make git installation footprint smaller
@ 2010-07-23 17:50 Brandon Casey
2010-07-23 17:50 ` [PATCH 1/2] Makefile: link builtins residing in bin directory to main git binary too Brandon Casey
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Brandon Casey @ 2010-07-23 17:50 UTC (permalink / raw)
To: git
Ever wonder where that extra 5MB of disk space went that you thought you
had? Well, it turns out that git isn't being quite as space-efficient as
it could be. Some files that could be installed as links are instead being
installed as full copies of the original.
With these two patches, we shrink the installation footprint of git by
making hard or symbolic links for non-builtin programs and for those binaries
installed in the bin directory. We already do this for binaries installed
in libexec. This can reduce the size of a git installation on the order of
10-30%. Probably about 5-10MB. Whoopee!!!
Enjoy.
Brandon Casey (2):
Makefile: link builtins residing in bin directory to main git binary
too
Makefile: make hard/symbolic links for non-builtins too
Makefile | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
--
1.7.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Makefile: link builtins residing in bin directory to main git binary too
2010-07-23 17:50 [PATCH 0/2] make git installation footprint smaller Brandon Casey
@ 2010-07-23 17:50 ` Brandon Casey
2010-07-23 17:50 ` [PATCH 2/2] Makefile: make hard/symbolic links for non-builtins too Brandon Casey
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Brandon Casey @ 2010-07-23 17:50 UTC (permalink / raw)
To: git; +Cc: Brandon Casey
From: Brandon Casey <drafnel@gmail.com>
To conserve space/improve file caching we try to make hard or symbolic links
from each builtin program to the main git executable rather than having
each be a complete duplicate copy of it. We weren't doing this for the
builtin programs residing in the bin directory though. So, let's do so.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Makefile | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index bc3c570..d725c15 100644
--- a/Makefile
+++ b/Makefile
@@ -2079,6 +2079,12 @@ endif
test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
+ for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
+ $(RM) "$$bindir/$$p" && \
+ 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; \
+ done && \
for p in $(BUILT_INS); do \
$(RM) "$$execdir/$$p" && \
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
--
1.7.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Makefile: make hard/symbolic links for non-builtins too
2010-07-23 17:50 [PATCH 0/2] make git installation footprint smaller Brandon Casey
2010-07-23 17:50 ` [PATCH 1/2] Makefile: link builtins residing in bin directory to main git binary too Brandon Casey
@ 2010-07-23 17:50 ` Brandon Casey
2010-07-23 18:12 ` [PATCH 0/2] make git installation footprint smaller A Large Angry SCM
2010-07-24 2:31 ` Jonathan Nieder
3 siblings, 0 replies; 6+ messages in thread
From: Brandon Casey @ 2010-07-23 17:50 UTC (permalink / raw)
To: git; +Cc: Brandon Casey
From: Brandon Casey <drafnel@gmail.com>
To conserve space/improve file caching we try to make hard or symbolic links
from each builtin program to the main git executable rather than having
each be a complete duplicate copy of it. We weren't doing this for the
non-builtin programs though. So, just because we can, and because it's
easy, and for completeness sake, let's do it.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Makefile | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index d725c15..17c9130 100644
--- a/Makefile
+++ b/Makefile
@@ -2075,10 +2075,13 @@ endif
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
{ test "$$bindir/" = "$$execdir/" || \
- { $(RM) "$$execdir/git$X" && \
+ for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
+ $(RM) "$$execdir/$$p" && \
test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
- ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
- cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
+ ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
+ cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
+ done; \
+ } && \
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
$(RM) "$$bindir/$$p" && \
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
--
1.7.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] make git installation footprint smaller
2010-07-23 17:50 [PATCH 0/2] make git installation footprint smaller Brandon Casey
2010-07-23 17:50 ` [PATCH 1/2] Makefile: link builtins residing in bin directory to main git binary too Brandon Casey
2010-07-23 17:50 ` [PATCH 2/2] Makefile: make hard/symbolic links for non-builtins too Brandon Casey
@ 2010-07-23 18:12 ` A Large Angry SCM
2010-07-23 18:17 ` Brandon Casey
2010-07-24 2:31 ` Jonathan Nieder
3 siblings, 1 reply; 6+ messages in thread
From: A Large Angry SCM @ 2010-07-23 18:12 UTC (permalink / raw)
To: Brandon Casey; +Cc: git
On 07/23/2010 01:50 PM, Brandon Casey wrote:
> Ever wonder where that extra 5MB of disk space went that you thought you
> had? Well, it turns out that git isn't being quite as space-efficient as
> it could be. Some files that could be installed as links are instead being
> installed as full copies of the original.
>
> With these two patches, we shrink the installation footprint of git by
> making hard or symbolic links for non-builtin programs and for those binaries
> installed in the bin directory. We already do this for binaries installed
> in libexec. This can reduce the size of a git installation on the order of
> 10-30%. Probably about 5-10MB. Whoopee!!!
>
> Enjoy.
>
> Brandon Casey (2):
> Makefile: link builtins residing in bin directory to main git binary
> too
> Makefile: make hard/symbolic links for non-builtins too
>
> Makefile | 15 ++++++++++++---
> 1 files changed, 12 insertions(+), 3 deletions(-)
>
What happens when bindir and execdir are the same?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] make git installation footprint smaller
2010-07-23 18:12 ` [PATCH 0/2] make git installation footprint smaller A Large Angry SCM
@ 2010-07-23 18:17 ` Brandon Casey
0 siblings, 0 replies; 6+ messages in thread
From: Brandon Casey @ 2010-07-23 18:17 UTC (permalink / raw)
To: gitzilla; +Cc: git
A Large Angry SCM wrote:
> On 07/23/2010 01:50 PM, Brandon Casey wrote:
>> Brandon Casey (2):
>> Makefile: link builtins residing in bin directory to main git binary
>> too
>> Makefile: make hard/symbolic links for non-builtins too
>>
>> Makefile | 15 ++++++++++++---
>> 1 files changed, 12 insertions(+), 3 deletions(-)
>>
>
> What happens when bindir and execdir are the same?
Nothing. See the second patch "make hard/symbolic links for
non-builtins too". We already handled this case.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] make git installation footprint smaller
2010-07-23 17:50 [PATCH 0/2] make git installation footprint smaller Brandon Casey
` (2 preceding siblings ...)
2010-07-23 18:12 ` [PATCH 0/2] make git installation footprint smaller A Large Angry SCM
@ 2010-07-24 2:31 ` Jonathan Nieder
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2010-07-24 2:31 UTC (permalink / raw)
To: Brandon Casey; +Cc: git
Brandon Casey wrote:
> Brandon Casey (2):
> Makefile: link builtins residing in bin directory to main git binary
> too
> Makefile: make hard/symbolic links for non-builtins too
So in the end, the hardlink-forming step has four steps:
1. (if bindir != libexecdir and NO_CROSS_DIRECTORY_HARDLINKS is unset)
Files in libexecdir with cousins in bindir are replaced by
hardlinks to their cousins. (patch 2)
2. Any builtins in bindir are replaced by
hardlinks, symlinks, or copies of git.
3. Any builtins in libexecdir are replaced by
hardlinks, symlinks, or copies of git.
4. git-remote-{ftp,http, etc} are replaced by
hardlinks, symlinks, or of git-remote-http.
Looks good to me.
Thanks for the pleasant read,
Jonathan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-24 2:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23 17:50 [PATCH 0/2] make git installation footprint smaller Brandon Casey
2010-07-23 17:50 ` [PATCH 1/2] Makefile: link builtins residing in bin directory to main git binary too Brandon Casey
2010-07-23 17:50 ` [PATCH 2/2] Makefile: make hard/symbolic links for non-builtins too Brandon Casey
2010-07-23 18:12 ` [PATCH 0/2] make git installation footprint smaller A Large Angry SCM
2010-07-23 18:17 ` Brandon Casey
2010-07-24 2:31 ` Jonathan Nieder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).