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

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Nov 4, 2015, 19:36 UTC
Message-ID
<CAPig+cQWbisskb4aQ48Oo=8_SYKZWwMK8jn_P_zsivY-xuk43g@mail.gmail.com>
In-Reply-To
<1446537497-13921-5-git-send-email-lfleischer@lfos.de>
On Tuesday, November 3, 2015, Lukas Fleischer <lfleischer@lfos.de> wrote:
Show 37 quoted lines
> Test whether regular and full hideRefs patterns work as expected when
> namespaces are used.
>
> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
> 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,45 @@ test_expect_success 'mirroring a repository using a ref namespace' '
> +test_expect_success 'hide namespaced refs with transfer.hideRefs' '
> +       GIT_NAMESPACE=namespace \
> +               git -C pushee -c transfer.hideRefs=refs/tags \
> +               ls-remote "ext::git %s ." >actual &&
> +       printf "$commit1\trefs/heads/master\n" >expected &&
> +       test_cmp expected actual
> +'
> +
> +test_expect_success 'check that transfer.hideRefs does not match unstripped refs' '
> +       GIT_NAMESPACE=namespace \
> +               git -C pushee -c transfer.hideRefs=refs/namespaces/namespace/refs/tags \
> +               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
> +'
> +
> +test_expect_success 'hide full refs with transfer.hideRefs' '
> +       GIT_NAMESPACE=namespace \
> +               git -C pushee -c transfer.hideRefs="^refs/namespaces/namespace/refs/tags" \
> +               ls-remote "ext::git %s ." >actual &&
> +       printf "$commit1\trefs/heads/master\n" >expected &&
> +       test_cmp expected actual
> +'
> +
> +test_expect_success 'try to update a hidden ref' '
> +       test_config -C pushee transfer.hideRefs refs/heads/master &&
> +       test_must_fail git -C original push pushee-namespaced master

In above tests, you use -c to set the configuration temporarily for the git invocation, but not in this and following tests. Is that because the -c isn't visible to sub-commands which git-push invokes? (Genuine question; I want to make sure I understand the reasoning.)

Show 16 quoted lines
> +'
> +
> +test_expect_success 'try to update a ref that is not hidden' '
> +       test_config -C pushee transfer.hideRefs refs/namespaces/namespace/refs/heads/master &&
> +       git -C original push pushee-namespaced master
> +'
> +
> +test_expect_success 'try to update a hidden full ref' '
> +       test_config -C pushee transfer.hideRefs "^refs/namespaces/namespace/refs/heads/master" &&
> +       test_must_fail git -C original push pushee-namespaced master
> +'
> +
>  test_done
> --
> 2.6.2
>
Previous: Lukas FleischerNext: Jeff King
Message 9 of 10 in “Improve hideRefs when used with namespaces”
  1. 0/4 Improve hideRefs when used with namespacesLukas Fleischer, Nov 3, 2015
  2. 1/4 Document the semantics of hideRefs with namespacesLukas Fleischer, Nov 3, 2015
  3. Junio C HamanoNov 3, 2015
  4. 2/4 upload-pack: strip refs before calling ref_is_hidden()Lukas Fleischer, Nov 3, 2015
  5. 3/4 Add support for matching full refs in hideRefsLukas Fleischer, Nov 3, 2015
  6. Junio C HamanoNov 3, 2015
  7. Junio C HamanoNov 4, 2015
  8. 4/4 t5509: add basic tests for hideRefsLukas Fleischer, Nov 3, 2015
  9. Eric SunshineNov 4, 2015
  10. Jeff KingNov 4, 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.