git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 8, 2014, 09:04 UTC
Message-ID
<CAPig+cTmXu09QLca4W=VpUS82m0uDSQLch7Gb06U_XeUZ83FrQ@mail.gmail.com>
In-Reply-To
<20140605060750.GC23874@sandbox-ub>
On Thu, Jun 5, 2014 at 2:07 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
Show 33 quoted lines
> 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@hvoigt.net>
> ---
> 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.
Show 55 quoted lines
> +               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
Previous: Heiko VoigtNext: Heiko Voigt
Message 13 of 26 in “submodule config lookup API”
  1. 0/5 submodule config lookup APIHeiko Voigt, Jun 5, 2014
  2. 1/5 hashmap: add enum for hashmap free_entries optionHeiko Voigt, Jun 5, 2014
  3. Karsten BleesJun 6, 2014
  4. Heiko VoigtJun 10, 2014
  5. Karsten BleesJun 11, 2014
  6. Junio C HamanoJun 12, 2014
  7. Karsten BleesJun 17, 2014
  8. Heiko VoigtJun 17, 2014
  9. Junio C HamanoJun 17, 2014
  10. 2/5 implement submodule config cache for lookup of submodule namesHeiko Voigt, Jun 5, 2014
  11. W. Trevor KingJun 5, 2014
  12. Heiko VoigtJun 6, 2014
  13. Eric SunshineJun 8, 2014
  14. Heiko VoigtJun 10, 2014
  15. Junio C HamanoJun 12, 2014
  16. Heiko VoigtJun 13, 2014
  17. 3/5 extract functions for submodule config set and lookupHeiko Voigt, Jun 5, 2014
  18. 4/5 use new config API for worktree configurations of submodulesHeiko Voigt, Jun 5, 2014
  19. 5/5 do not die on error of parsing fetchrecursesubmodules optionHeiko Voigt, Jun 5, 2014
  20. Junio C HamanoJun 12, 2014
  21. Heiko VoigtJun 13, 2014
  22. Junio C HamanoJun 16, 2014
  23. Heiko VoigtJun 17, 2014
  24. Junio C HamanoJun 12, 2014
  25. Jens LehmannJun 13, 2014
  26. Junio C HamanoJun 13, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.