{"thread":{"id":"24485","subject":"[PATCH 0/2] make git installation footprint smaller","startedAt":"2010-07-23T17:50:43Z","lastAt":"2010-07-24T02:31:45Z","messageCount":6,"participants":["Brandon Casey","A Large Angry SCM","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"146096","messageId":"taBDPvzBKDtgdmYKlcbFJ_fQRnY4jBMR74BF1vetbRU3OZRMPpwtU0wTG1SSa0hFgNsCN5k9Qx8@cipher.nrlssc.navy.mil","threadId":"24485","inReplyTo":null,"subject":"[PATCH 0/2] make git installation footprint smaller","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2010-07-23T17:50:43Z","receivedAt":"2010-07-23T17:50:43Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Ever wonder where that extra 5MB of disk space went that you thought you\nhad?  Well, it turns out that git isn't being quite as space-efficient as\nit could be.  Some files that could be installed as links are instead being\ninstalled as full copies of the original.\n\nWith these two patches, we shrink the installation footprint of git by\nmaking hard or symbolic links for non-builtin programs and for those binaries\ninstalled in the bin directory.  We already do this for binaries installed\nin libexec.  This can reduce the size of a git installation on the order of\n10-30%.  Probably about 5-10MB.  Whoopee!!!\n\nEnjoy.\n\nBrandon Casey (2):\n  Makefile: link builtins residing in bin directory to main git binary\n    too\n  Makefile: make hard/symbolic links for non-builtins too\n\n Makefile |   15 ++++++++++++---\n 1 files changed, 12 insertions(+), 3 deletions(-)\n\n-- \n1.7.2\n"},{"id":"146098","messageId":"taBDPvzBKDsn4R3mVCPIS8b7DATXdlBe-WqMByA8COCjNJVZsuTq4cKE-C0wPs_pTG1B23aAVpU@cipher.nrlssc.navy.mil","threadId":"24485","inReplyTo":"taBDPvzBKDtgdmYKlcbFJ_fQRnY4jBMR74BF1vetbRU3OZRMPpwtU0wTG1SSa0hFgNsCN5k9Qx8@cipher.nrlssc.navy.mil","subject":"[PATCH 1/2] Makefile: link builtins residing in bin directory to main git binary too","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2010-07-23T17:50:44Z","receivedAt":"2010-07-23T17:50:44Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nTo conserve space/improve file caching we try to make hard or symbolic links\nfrom each builtin program to the main git executable rather than having\neach be a complete duplicate copy of it.  We weren't doing this for the\nbuiltin programs residing in the bin directory though.  So, let's do so.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n Makefile |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex bc3c570..d725c15 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2079,6 +2079,12 @@ endif\n \t\ttest -z \"$(NO_CROSS_DIRECTORY_HARDLINKS)\" && \\\n \t\tln \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n \t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; } ; } && \\\n+\tfor p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \\\n+\t\t$(RM) \"$$bindir/$$p\" && \\\n+\t\tln \"$$bindir/git$X\" \"$$bindir/$$p\" 2>/dev/null || \\\n+\t\tln -s \"git$X\" \"$$bindir/$$p\" 2>/dev/null || \\\n+\t\tcp \"$$bindir/git$X\" \"$$bindir/$$p\" || exit; \\\n+\tdone && \\\n \tfor p in $(BUILT_INS); do \\\n \t\t$(RM) \"$$execdir/$$p\" && \\\n \t\tln \"$$execdir/git$X\" \"$$execdir/$$p\" 2>/dev/null || \\\n-- \n1.7.2\n"},{"id":"146097","messageId":"taBDPvzBKDvxYMKKellyXA806jSWITGITetvHyKi-Fz0wgftlDIrmDQ4JZCa6Wy7AEyhL79CNYA@cipher.nrlssc.navy.mil","threadId":"24485","inReplyTo":"taBDPvzBKDtgdmYKlcbFJ_fQRnY4jBMR74BF1vetbRU3OZRMPpwtU0wTG1SSa0hFgNsCN5k9Qx8@cipher.nrlssc.navy.mil","subject":"[PATCH 2/2] Makefile: make hard/symbolic links for non-builtins too","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2010-07-23T17:50:45Z","receivedAt":"2010-07-23T17:50:45Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nTo conserve space/improve file caching we try to make hard or symbolic links\nfrom each builtin program to the main git executable rather than having\neach be a complete duplicate copy of it.  We weren't doing this for the\nnon-builtin programs though.  So, just because we can, and because it's\neasy, and for completeness sake, let's do it.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n Makefile |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d725c15..17c9130 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2075,10 +2075,13 @@ endif\n \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n \t{ test \"$$bindir/\" = \"$$execdir/\" || \\\n-\t\t{ $(RM) \"$$execdir/git$X\" && \\\n+\t  for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \\\n+\t\t$(RM) \"$$execdir/$$p\" && \\\n \t\ttest -z \"$(NO_CROSS_DIRECTORY_HARDLINKS)\" && \\\n-\t\tln \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n-\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; } ; } && \\\n+\t\tln \"$$bindir/$$p\" \"$$execdir/$$p\" 2>/dev/null || \\\n+\t\tcp \"$$bindir/$$p\" \"$$execdir/$$p\" || exit; \\\n+\t  done; \\\n+\t} && \\\n \tfor p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \\\n \t\t$(RM) \"$$bindir/$$p\" && \\\n \t\tln \"$$bindir/git$X\" \"$$bindir/$$p\" 2>/dev/null || \\\n-- \n1.7.2\n"},{"id":"146099","messageId":"4C49DB84.9060001@gmail.com","threadId":"24485","inReplyTo":"taBDPvzBKDtgdmYKlcbFJ_fQRnY4jBMR74BF1vetbRU3OZRMPpwtU0wTG1SSa0hFgNsCN5k9Qx8@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 0/2] make git installation footprint smaller","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2010-07-23T18:12:20Z","receivedAt":"2010-07-23T18:12:20Z","isPatch":true,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"On 07/23/2010 01:50 PM, Brandon Casey wrote:\n> Ever wonder where that extra 5MB of disk space went that you thought you\n> had?  Well, it turns out that git isn't being quite as space-efficient as\n> it could be.  Some files that could be installed as links are instead being\n> installed as full copies of the original.\n>\n> With these two patches, we shrink the installation footprint of git by\n> making hard or symbolic links for non-builtin programs and for those binaries\n> installed in the bin directory.  We already do this for binaries installed\n> in libexec.  This can reduce the size of a git installation on the order of\n> 10-30%.  Probably about 5-10MB.  Whoopee!!!\n>\n> Enjoy.\n>\n> Brandon Casey (2):\n>    Makefile: link builtins residing in bin directory to main git binary\n>      too\n>    Makefile: make hard/symbolic links for non-builtins too\n>\n>   Makefile |   15 ++++++++++++---\n>   1 files changed, 12 insertions(+), 3 deletions(-)\n>\n\nWhat happens when bindir and execdir are the same?\n"},{"id":"146100","messageId":"8ovbiyHgA0TrkzTYhiyARaZKuacjG5kLhVLYZ4WEvkGOP9m8gKlnqw@cipher.nrlssc.navy.mil","threadId":"24485","inReplyTo":"4C49DB84.9060001@gmail.com","subject":"Re: [PATCH 0/2] make git installation footprint smaller","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2010-07-23T18:17:32Z","receivedAt":"2010-07-23T18:17:32Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"A Large Angry SCM wrote:\n> On 07/23/2010 01:50 PM, Brandon Casey wrote:\n>> Brandon Casey (2):\n>>    Makefile: link builtins residing in bin directory to main git binary\n>>      too\n>>    Makefile: make hard/symbolic links for non-builtins too\n>>\n>>   Makefile |   15 ++++++++++++---\n>>   1 files changed, 12 insertions(+), 3 deletions(-)\n>>\n> \n> What happens when bindir and execdir are the same?\n\nNothing.  See the second patch \"make hard/symbolic links for\nnon-builtins too\".  We already handled this case.\n"},{"id":"146137","messageId":"20100724023145.GH13670@burratino","threadId":"24485","inReplyTo":"taBDPvzBKDtgdmYKlcbFJ_fQRnY4jBMR74BF1vetbRU3OZRMPpwtU0wTG1SSa0hFgNsCN5k9Qx8@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 0/2] make git installation footprint smaller","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-24T02:31:45Z","receivedAt":"2010-07-24T02:31:45Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> Brandon Casey (2):\n>   Makefile: link builtins residing in bin directory to main git binary\n>     too\n>   Makefile: make hard/symbolic links for non-builtins too\n\nSo in the end, the hardlink-forming step has four steps:\n\n1. (if bindir != libexecdir and NO_CROSS_DIRECTORY_HARDLINKS is unset)\n   Files in libexecdir with cousins in bindir are replaced by\n   hardlinks to their cousins. (patch 2)\n\n2. Any builtins in bindir are replaced by\n   hardlinks, symlinks, or copies of git.\n\n3. Any builtins in libexecdir are replaced by\n   hardlinks, symlinks, or copies of git.\n\n4. git-remote-{ftp,http, etc} are replaced by\n   hardlinks, symlinks, or of git-remote-http.\n\nLooks good to me.\n\nThanks for the pleasant read,\nJonathan\n"}]}