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

Re: [PATCH 4/4] t5509: add basic tests for hideRefs

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Nov 1, 2015, 21:13 UTC
Message-ID
<CAPig+cR7sCqigz=--_d-bW0X=+vpbV-_N9hxriLH9fMjLJUfsA@mail.gmail.com>
In-Reply-To
<1446406463-22527-5-git-send-email-lfleischer@lfos.de>
On Sun, Nov 1, 2015 at 2:34 PM, Lukas Fleischer <lfleischer@lfos.de> wrote:
Show 11 quoted lines
> Test whether regular and full hideRefs patterns work as expected when
> namespaces are used.
>
> Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
> ---
> diff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh
> @@ -82,4 +82,33 @@ test_expect_success 'mirroring a repository using a ref namespace' '
>         )
>  '
>
> +test_expect_success "Hide namespaced refs with transfer.hideRefs" '

None of the other tests in this file capitalize the test description. These new test descriptions should probably follow suit by beginning with lowercase. It is also typical to use single quotes for the description rather than double.

Show 6 quoted lines
> +       cd pushee &&
> +       test_config transfer.hideRefs refs/tags &&
> +       GIT_NAMESPACE=namespace git ls-remote "ext::git %s ." >actual &&
> +       printf "$commit1\trefs/heads/master\n" >expected &&
> +       test_cmp expected actual &&
> +       cd ..

If any of the commands above "cd .." fail, then "cd .." will never be invoked, thus subsequent tests will fail since they won't be executed in the expected directory. The typical way to handle this is to place the "cd foo" and remaining test body in a subshell, and drop "cd .." altogether. When the subshell exits (via success or failure), the working directory will be restored automatically.

    test_expect_success '...' '
        (
            cd pushee &&
            test_config ... &&
            ...
        )
    '
Show 25 quoted lines
> +'
> +
> +test_expect_success "Check that transfer.hideRefs does not match unstripped refs" '
> +       cd pushee &&
> +       test_config transfer.hideRefs "refs/namespaces/namespace/refs/tags" &&
> +       GIT_NAMESPACE=namespace git ls-remote "ext::git %s ." >actual &&
> +       printf "$commit1\trefs/heads/master\n" >expected &&
> +       printf "$commit0\trefs/tags/0\n" >>expected &&
> +       printf "$commit1\trefs/tags/1\n" >>expected &&
> +       test_cmp expected actual &&
> +       cd ..
> +'
> +
> +test_expect_success "Hide full refs with transfer.hideRefs" '
> +       cd pushee &&
> +       test_config transfer.hideRefs "^refs/namespaces/namespace/refs/tags" &&
> +       GIT_NAMESPACE=namespace git ls-remote "ext::git %s ." >actual &&
> +       printf "$commit1\trefs/heads/master\n" >expected &&
> +       test_cmp expected actual &&
> +       cd ..
> +'
> +
>  test_done
> --
> 2.6.2
Previous: Lukas FleischerNext: Lukas Fleischer
Message 8 of 10 in “Improve hideRefs when used with namespaces”
  1. 0/4 Improve hideRefs when used with namespacesLukas Fleischer, Nov 1, 2015
  2. 1/4 Document the semantics of hideRefs with namespacesLukas Fleischer, Nov 1, 2015
  3. 2/4 upload-pack: strip refs before calling ref_is_hidden()Lukas Fleischer, Nov 1, 2015
  4. 3/4 Add support for matching full refs in hideRefsLukas Fleischer, Nov 1, 2015
  5. Eric SunshineNov 1, 2015
  6. Lukas FleischerNov 2, 2015
  7. 4/4 t5509: add basic tests for hideRefsLukas Fleischer, Nov 1, 2015
  8. Eric SunshineNov 1, 2015
  9. Lukas FleischerNov 2, 2015
  10. Eric SunshineNov 2, 2015

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.