Re: [PATCH 2/5] implement submodule config cache for lookup of submodule names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 5, 2014 at 2:07 AM, Heiko Voigt <hvoigt@xxxxxxxxxx> wrote:
> This submodule configuration cache allows us to lazily read .gitmodules
> configurations by commit into a runtime cache which can then be used to
> easily lookup values from it. Currently only the values for path or name
> are stored but it can be extended for any value needed.
>
> [...]
>
> Signed-off-by: Heiko Voigt <hvoigt@xxxxxxxxxx>
> ---
> diff --git a/t/t7410-submodule-config.sh b/t/t7410-submodule-config.sh
> new file mode 100755
> index 0000000..ea453c5
> --- /dev/null
> +++ b/t/t7410-submodule-config.sh
> @@ -0,0 +1,73 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2014 Heiko Voigt
> +#
> +
> +test_description='Test submodules config cache infrastructure
> +
> +This test verifies that parsing .gitmodules configuration directly
> +from the database works.
> +'
> +
> +TEST_NO_CREATE_REPO=1
> +. ./test-lib.sh
> +
> +test_expect_success 'submodule config cache setup' '
> +       mkdir submodule &&
> +       (cd submodule &&
> +               git init

Broken &&-chain.

> +               echo a >a &&
> +               git add . &&
> +               git commit -ma
> +       ) &&
> +       mkdir super &&
> +       (cd super &&
> +               git init &&
> +               git submodule add ../submodule &&
> +               git submodule add ../submodule a &&
> +               git commit -m "add as submodule and as a" &&
> +               git mv a b &&
> +               git commit -m "move a to b"
> +       )
> +'
> +
> +cat >super/expect <<EOF
> +Submodule name: 'a' for path 'a'
> +Submodule name: 'a' for path 'b'
> +Submodule name: 'submodule' for path 'submodule'
> +Submodule name: 'submodule' for path 'submodule'
> +EOF
> +
> +test_expect_success 'test parsing of submodule config' '
> +       (cd super &&
> +               test-submodule-config \
> +                       HEAD^ a \
> +                       HEAD b \
> +                       HEAD^ submodule \
> +                       HEAD submodule \
> +                               >actual &&
> +               test_cmp expect actual
> +       )
> +'
> +
> +cat >super/expect_error <<EOF
> +Submodule name: 'a' for path 'b'
> +Submodule name: 'submodule' for path 'submodule'
> +EOF
> +
> +test_expect_success 'error in one submodule config lets continue' '
> +       (cd super &&
> +               cp .gitmodules .gitmodules.bak &&
> +               echo "  value = \"" >>.gitmodules &&
> +               git add .gitmodules &&
> +               mv .gitmodules.bak .gitmodules &&
> +               git commit -m "add error" &&
> +               test-submodule-config \
> +                       HEAD b \
> +                       HEAD submodule \
> +                               >actual &&
> +               test_cmp expect_error actual
> +       )
> +'
> +
> +test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]