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

Re: [PATCH v7 4/4] cache-tree: Write updated cache-tree after commit

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 11, 2014, 23:56 UTC
Message-ID
<CAPig+cQpzomDmwVqgDGrP4qC1OujRXu5e1wc=EwX61k_RpLbKg@mail.gmail.com>
In-Reply-To
<1405120947-3142-4-git-send-email-dturner@twitter.com>
On Fri, Jul 11, 2014 at 7:22 PM, David Turner <dturner@twopensource.com> wrote:
Show 36 quoted lines
> During the commit process, update the cache-tree. Write this updated
> cache-tree so that it's ready for subsequent commands.
>
> Add test code which demonstrates that git commit now writes the cache
> tree.  Make all tests test the entire cache-tree, not just the root
> level.
>
> Signed-off-by: David Turner <dturner@twitter.com>
> diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
> index 3a3342e..57f263f 100755
> --- a/t/t0090-cache-tree.sh
> +++ b/t/t0090-cache-tree.sh
> @@ -90,37 +128,86 @@ test_expect_success 'test-scrap-cache-tree works' '
>
>  test_expect_success 'second commit has cache-tree' '
>         test_commit bar &&
> -       test_shallow_cache_tree
> +       test_cache_tree
> +'
> +
> +test_expect_success 'commit -i gives cache-tree' '
> +       git checkout current &&
> +       cat <<-\EOT >foo.c &&
> +       int foo()
> +       {
> +               return 42;
> +       }
> +       int bar()
> +       {
> +               return 42;
> +       }
> +       EOT
> +       git add foo.c
> +       test_invalid_cache_tree
> +       git commit -m "add a file"
> +       test_cache_tree
Broken &&-chain on all four lines above.
Show 11 quoted lines
> +       cat <<-\EOT >foo.c &&
> +       int foo()
> +       {
> +               return 43;
> +       }
> +       int bar()
> +       {
> +               return 44;
> +       }
> +       EOT
> +       (echo p; echo 1; echo; echo s; echo n; echo y; echo q) | git commit --interactive -m foo
Broken &&-chain.
Would a printf make this more readable?
    printf "p\n1\n\ns\nn\ny\nq\n" | git commt ... &&
Perhaps not.
Show 60 quoted lines
> +       test_cache_tree
> +'
> +
> +test_expect_success 'commit in child dir has cache-tree' '
> +       mkdir dir &&
> +       >dir/child.t &&
> +       git add dir/child.t &&
> +       git commit -m dir/child.t &&
> +       test_cache_tree
>  '
>
>  test_expect_success 'reset --hard gives cache-tree' '
>         test-scrap-cache-tree &&
>         git reset --hard &&
> -       test_shallow_cache_tree
> +       test_cache_tree
>  '
>
>  test_expect_success 'reset --hard without index gives cache-tree' '
>         rm -f .git/index &&
>         git reset --hard &&
> -       test_shallow_cache_tree
> +       test_cache_tree
>  '
>
>  test_expect_success 'checkout gives cache-tree' '
>         git tag current &&
>         git checkout HEAD^ &&
> -       test_shallow_cache_tree
> +       test_cache_tree
>  '
>
>  test_expect_success 'checkout -b gives cache-tree' '
>         git checkout current &&
>         git checkout -b prev HEAD^ &&
> -       test_shallow_cache_tree
> +       test_cache_tree
>  '
>
>  test_expect_success 'checkout -B gives cache-tree' '
>         git checkout current &&
>         git checkout -B prev HEAD^ &&
> -       test_shallow_cache_tree
> +       test_cache_tree
> +'
> +
> +test_expect_success 'partial commit gives cache-tree' '
> +       git checkout -b partial no-children &&
> +       test_commit one &&
> +       test_commit two &&
> +       echo "some change" >one.t &&
> +       git add one.t &&
> +       echo "some other change" >two.t &&
> +       git commit two.t -m partial &&
> +       test_cache_tree
>  '
>
>  test_done
> --
> 2.0.0.390.gcb682f8
Previous: David TurnerNext: Junio C Hamano
Message 5 of 7 in “cache-tree: Create/update cache-tree on checkout”
  1. 1/4 cache-tree: Create/update cache-tree on checkoutDavid Turner, Jul 11, 2014
  2. 2/4 test-dump-cache-tree: invalid trees are not errorsDavid Turner, Jul 11, 2014
  3. 3/4 cache-tree: subdirectory testsDavid Turner, Jul 11, 2014
  4. 4/4 cache-tree: Write updated cache-tree after commitDavid Turner, Jul 11, 2014
  5. Eric SunshineJul 11, 2014
  6. Junio C HamanoJul 13, 2014
  7. Eric SunshineJul 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.