blame: default to HEAD in a bare repo when no start commit is given
[gitweb.git] / t / t5611-clone-config.sh
index 39329eb7a8a64b177794b83ef8828b866fead547..60c1ba951b7d4178708574d10986659749925059 100755 (executable)
@@ -45,6 +45,53 @@ test_expect_success 'clone -c config is available during clone' '
        test_cmp expect child/file
 '
 
+test_expect_success 'clone -c remote.origin.fetch=<refspec> works' '
+       rm -rf child &&
+       git update-ref refs/grab/it refs/heads/master &&
+       git update-ref refs/leave/out refs/heads/master &&
+       git clone -c "remote.origin.fetch=+refs/grab/*:refs/grab/*" . child &&
+       git -C child for-each-ref --format="%(refname)" >actual &&
+
+       cat >expect <<-\EOF &&
+       refs/grab/it
+       refs/heads/master
+       refs/remotes/origin/HEAD
+       refs/remotes/origin/master
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'git -c remote.origin.fetch=<refspec> clone works' '
+       rm -rf child &&
+       git -c "remote.origin.fetch=+refs/grab/*:refs/grab/*" clone . child &&
+       git -C child for-each-ref --format="%(refname)" >actual &&
+
+       cat >expect <<-\EOF &&
+       refs/grab/it
+       refs/heads/master
+       refs/remotes/origin/HEAD
+       refs/remotes/origin/master
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'clone -c remote.<remote>.fetch=<refspec> --origin=<name>' '
+       rm -rf child &&
+       git clone --origin=upstream \
+                 -c "remote.upstream.fetch=+refs/grab/*:refs/grab/*" \
+                 -c "remote.origin.fetch=+refs/leave/*:refs/leave/*" \
+                 . child &&
+       git -C child for-each-ref --format="%(refname)" >actual &&
+
+       cat >expect <<-\EOF &&
+       refs/grab/it
+       refs/heads/master
+       refs/remotes/upstream/HEAD
+       refs/remotes/upstream/master
+       EOF
+       test_cmp expect actual
+'
+
 # Tests for the hidden file attribute on windows
 is_hidden () {
        # Use the output of `attrib`, ignore the absolute path