[pacman-dev] [PATCH] makepkg: git-clone with --bare instead of --mirror
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@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
On 04/11, Johannes Löthberg wrote:
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.
For an example of this try to clone https://github.com/Araq/Nimrod.git with --mirror and then --bare and compare the clone time and repository size. ('Too Long; Didn’t Clone': --mirror is 323M and --bare is 32M, with the former taking minutes and the second seconds.)
On 04/11/14 21:55, Johannes Löthberg wrote:
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.
I pulled this to my local makepkg to test it for a while... second build it broke. My pacman-git PKGBUILD has: source=('git+file:///home/arch/code/pacman#branch=patchqueue') I built that, created a new branch in the repo in /home/arch/code/pacman and tried building from it: source=('git+file:///home/arch/code/pacman#branch=new') This fails with a --bare checkout. Allan
On 05/11, Allan McRae wrote:
I pulled this to my local makepkg to test it for a while... second build it broke.
My pacman-git PKGBUILD has:
source=('git+file:///home/arch/code/pacman#branch=patchqueue')
I built that, created a new branch in the repo in /home/arch/code/pacman and tried building from it:
source=('git+file:///home/arch/code/pacman#branch=new')
This fails with a --bare checkout.
Hmm, that's interesting.. I'm guessing that explicitly fetching the given branch will be needed, will look into more. -- Sincerely, Johannes Löthberg PGP Key ID: 0x50FB9B273A9D0BB5 https://theos.kyriasis.com/~kyrias/
participants (2)
-
Allan McRae
-
Johannes Löthberg