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

Linus Arver linusarver at gmail.com
Wed Nov 2 20:52:58 EDT 2011

Definition: 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!

Now, when doing 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.

Advanced PKGBUILD authors who need to pull in an older version of the
remote repo will already have the knowledge to remove the "--depth 1" to
suit their needs. This change will also help AUR packagers out there who
do not understand git at all to make this change themselves.

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 75edb8b..22ff371 100644
--- a/prototypes/PKGBUILD-git.proto
+++ b/prototypes/PKGBUILD-git.proto
@@ -40,7 +40,7 @@ build() {
     msg "The local files are updated."
     cd ..
-    git clone "$_gitroot" "$_gitname"
+    git clone --depth 1 "$_gitroot" "$_gitname"
   msg "GIT checkout done or server timeout"

More information about the arch-projects mailing list