From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E16F4138FE7 for ; Wed, 26 Feb 2014 12:00:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D6EE7E0B9C; Wed, 26 Feb 2014 11:59:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DF6BCE0B98 for ; Wed, 26 Feb 2014 11:59:30 +0000 (UTC) Received: from pomiot.lan (77-255-12-215.adsl.inetia.pl [77.255.12.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id B4C3E33FBA9; Wed, 26 Feb 2014 11:59:28 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH git-r3 02/10] Replace 'git fetch' checkout with more efficient pseudo-shared fetch. Date: Wed, 26 Feb 2014 12:59:06 +0100 Message-Id: <1393415954-19313-2-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <20140226125520.214d8458@pomiot.lan> References: <20140226125520.214d8458@pomiot.lan> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 56785b1a-7914-4534-b03c-b5a5a8f94af8 X-Archives-Hash: ec99e0bed23c95f50b7b5a33d4addaea 'git fetch' uses git transport to compress and transfer all the commits even though they're on a local machine -- both very slow and space consuming. Setting 'alternates' before fetching solves the issue partially since the commits no longer need to be transferred. The checkout is still slow since git needs to recheck all of them. Instead, just set 'alternates' and copy the refs manually. This is pretty much what 'git clone --shared' does. And we can't use 'git clone' because it refuses non-empty destinations. This also makes it possible to use the same checkout method for shallow clones with &2 - "${@}" || die "git fetch into checkout dir failed" + # setup 'alternates' to avoid copying objects + echo "${orig_repo}/objects" > "${GIT_DIR}"/objects/info/alternates || die + # now copy the refs + # [htn]* safely catches heads, tags, notes without complaining + # on non-existing ones, and omits internal 'git-r3' ref + cp -R "${orig_repo}"/refs/[htn]* "${GIT_DIR}"/refs/ || die + + # (no need to copy HEAD, we will set it via checkout) set -- git checkout --quiet if [[ ${remote_ref} ]]; then -- 1.8.3.2