Thread (10 messages) flat view 10 messages, 2 authors, 2016-06-15

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

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:07:08

On Sun, Nov 1, 2015 at 2:34 PM, Lukas Fleischer [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Test whether regular and full hideRefs patterns work as expected when
namespaces are used.

Signed-off-by: Lukas Fleischer <redacted>
---
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.
+       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 ... &&
            ...
        )
    '
+'
+
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help