Merge branch 'jt/perf-updates'
[gitweb.git] / t / t6300-for-each-ref.sh
index 203cfaa156a409925b450a9be55488e91dbcca80..834a9ed168fad35258955447326e7d3d1f09b7d1 100755 (executable)
@@ -55,14 +55,30 @@ test_atom head refname:lstrip=1 heads/master
 test_atom head refname:lstrip=2 master
 test_atom head refname:lstrip=-1 master
 test_atom head refname:lstrip=-2 heads/master
+test_atom head refname:rstrip=1 refs/heads
+test_atom head refname:rstrip=2 refs
+test_atom head refname:rstrip=-1 refs
+test_atom head refname:rstrip=-2 refs/heads
+test_atom head refname:strip=1 heads/master
+test_atom head refname:strip=2 master
+test_atom head refname:strip=-1 master
+test_atom head refname:strip=-2 heads/master
 test_atom head upstream refs/remotes/origin/master
 test_atom head upstream:short origin/master
 test_atom head upstream:lstrip=2 origin/master
 test_atom head upstream:lstrip=-2 origin/master
+test_atom head upstream:rstrip=2 refs/remotes
+test_atom head upstream:rstrip=-2 refs/remotes
+test_atom head upstream:strip=2 origin/master
+test_atom head upstream:strip=-2 origin/master
 test_atom head push refs/remotes/myfork/master
 test_atom head push:short myfork/master
 test_atom head push:lstrip=1 remotes/myfork/master
 test_atom head push:lstrip=-1 master
+test_atom head push:rstrip=1 refs/remotes/myfork
+test_atom head push:rstrip=-1 refs
+test_atom head push:strip=1 remotes/myfork/master
+test_atom head push:strip=-1 master
 test_atom head objecttype commit
 test_atom head objectsize 171
 test_atom head objectname $(git rev-parse refs/heads/master)
@@ -568,7 +584,7 @@ test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
        test_when_finished "git checkout master" &&
        git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
        sed -e "s/^\* /  /" actual >expect &&
-       git checkout --orphan HEAD &&
+       git checkout --orphan orphaned-branch &&
        git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
        test_cmp expect actual
 '
@@ -628,6 +644,21 @@ EOF
 test_expect_success 'Verify usage of %(symref:lstrip) atom' '
        git for-each-ref --format="%(symref:lstrip=2)" refs/heads/sym > actual &&
        git for-each-ref --format="%(symref:lstrip=-2)" refs/heads/sym >> actual &&
+       test_cmp expected actual &&
+
+       git for-each-ref --format="%(symref:strip=2)" refs/heads/sym > actual &&
+       git for-each-ref --format="%(symref:strip=-2)" refs/heads/sym >> actual &&
+       test_cmp expected actual
+'
+
+cat >expected <<EOF
+refs
+refs/heads
+EOF
+
+test_expect_success 'Verify usage of %(symref:rstrip) atom' '
+       git for-each-ref --format="%(symref:rstrip=2)" refs/heads/sym > actual &&
+       git for-each-ref --format="%(symref:rstrip=-2)" refs/heads/sym >> actual &&
        test_cmp expected actual
 '