[Nix-dev] Use shallow copying in fetchgit

Nicolas Pierron nicolas.b.pierron at gmail.com
Wed Jul 20 23:19:03 CEST 2011


Hi Peter,

I higly recommend you to look at nix-prefect-git to get the solution
to this question.  I already solved this issue for git repositories.

As Lluís said, "git fetch --depth 1" will fetch any commit, and
possibly one which is not inside the branch you are trying to fetch.
You need to the reference as argument of the fetch, otherwise if you
are trying to pick a sha1, you will need to fetch the repository (or
any subset of it until you find the sha1).

nix-prefetch-git optimize the sha1 case by solving the sha1 /
reference mapping when it exists, and it also supports submodules.  So
please use it instead of cloning parts of it.

On Wed, Jul 20, 2011 at 22:46, Peter Simons <simons at cryp.to> wrote:
> Does anyone see a problem with applying this patch?
>
> diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh
> index ed3af4a..2b7e761 100644
> --- a/pkgs/build-support/fetchgit/builder.sh
> +++ b/pkgs/build-support/fetchgit/builder.sh
> @@ -9,7 +9,7 @@ header "exporting $url (rev $rev) into $out"
>  git init $out
>  cd $out
>  git remote add origin "$url"
> -git fetch --progress origin
> +git fetch --depth 1 --progress origin
>  git remote set-head origin -a || (
>     test -n "$rev" && echo "that's ok, we want $rev" || exit 1)
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at cs.uu.nl
> https://mail.cs.uu.nl/mailman/listinfo/nix-dev
>



-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/



More information about the nix-dev mailing list