[arch-projects] [ABS] [PATCH v3 3/7] git prototype: on initial clones, perform a shallow clone

Linus Arver linusarver at gmail.com
Wed Nov 9 00:56:45 EST 2011


Shallow git clones are just like regular clones, but do not contain any
of the past commit history. It is virtually the same thing as doing a
regular clone, then doing a rebase to squash all commits into a single
commit. Many people who do not understand git dismiss shallow clones
because they wrongly believe that shallow clones are incapable of
pulling in changes going forward from the remote. This is not the case!
You can still do pulls from the master remote repo in the future to
update the shallow clone, just like a regular clone!

On an inital clone, we should *always* encourage PKGBUILD authors to do
a shallow clone. This will save time (less downloading) and disk space
(e.g., yaourt users). The savings can be hundreds of MiB for large git
repos. This will also help AUR packagers out there who do not understand
git at all to make this change themselves.

Git PKGBUILD authors who need to pull in an older version of the remote
repo (an extremely rare case) will already have the knowledge to remove
the "--depth 1" to suit their needs.

Signed-off-by: Linus Arver <linusarver at gmail.com>
---
 prototypes/PKGBUILD-git.proto |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto
index dd3f76e..7d9bb90 100644
--- a/prototypes/PKGBUILD-git.proto
+++ b/prototypes/PKGBUILD-git.proto
@@ -39,7 +39,7 @@ build() {
     msg "The local files are updated."
     cd ..
   else
-    git clone "$_gitroot" "$_gitname"
+    git clone --depth 1 "$_gitroot" "$_gitname"
   fi
 
   msg "GIT checkout done or connection timeout"
-- 
1.7.7.2



More information about the arch-projects mailing list