[pacman-dev] [PATCH] makepkg: git-clone with --bare instead of --mirror

Johannes Löthberg johannes at kyriasis.com
Tue Nov 4 11:55:02 UTC 2014


The --mirror switch pulls down all refs in a repository, even ones that
aren't regular branches and tags.

Since sites like GitHub stores a ref for every pull request under the
refs/pull/ namespace, --mirror will pull down the history that has been
part of every pull request, even after a someone has for example run
git-filter-branch on it to get some big binaries out of the history,
which sometimes blows the repository size and the time to clone it up by
a very large factor.

Using --bare solves this as it only pulls down branches and tags, and
all makepkg needs is a bare repository.

Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
 scripts/makepkg.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8a67d94..d3854be 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -542,7 +542,7 @@ download_git() {
 
 	if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
 		msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
-		if ! git clone --mirror "$url" "$dir"; then
+		if ! git clone --bare "$url" "$dir"; then
 			error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
 			plain "$(gettext "Aborting...")"
 			exit 1
-- 
2.1.3


More information about the pacman-dev mailing list