summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-16 02:51:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-16 02:51:54 (GMT)
commita1fdc85f419022df5f2246b0444db4679e528e63 (patch)
tree16bfce120fd09fa2231220ffb0d29d25141bc5f8 /t
parent3900254bf29e00ad72de7a5b8e354369b2b84245 (diff)
parent1524ccdc1873029e4eafa5bffae2aa66d02369d8 (diff)
downloadgit-a1fdc85f419022df5f2246b0444db4679e528e63.zip
git-a1fdc85f419022df5f2246b0444db4679e528e63.tar.gz
git-a1fdc85f419022df5f2246b0444db4679e528e63.tar.bz2
Merge branch 'ab/clone-no-tags'
"git clone" learned the "--no-tags" option not to fetch all tags initially, and also set up the tagopt not to follow any tags in subsequent fetches. * ab/clone-no-tags: tests: rename a test having to do with shallow submodules clone: add a --no-tags option to clone without tags tests: change "cd ... && git fetch" to "cd &&\n\tgit fetch"
Diffstat (limited to 't')
-rwxr-xr-xt/t5612-clone-refspec.sh103
-rwxr-xr-xt/t5614-clone-submodules-shallow.sh (renamed from t/t5614-clone-submodules.sh)0
2 files changed, 92 insertions, 11 deletions
diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh
index 7ace253..fac5a73 100755
--- a/t/t5612-clone-refspec.sh
+++ b/t/t5612-clone-refspec.sh
@@ -17,13 +17,20 @@ test_expect_success 'setup' '
echo four >file &&
git commit -a -m four &&
git checkout master &&
+ git tag five &&
# default clone
git clone . dir_all &&
+ # default clone --no-tags
+ git clone --no-tags . dir_all_no_tags &&
+
# default --single that follows HEAD=master
git clone --single-branch . dir_master &&
+ # default --single that follows HEAD=master with no tags
+ git clone --single-branch --no-tags . dir_master_no_tags &&
+
# default --single that follows HEAD=side
git checkout side &&
git clone --single-branch . dir_side &&
@@ -45,6 +52,9 @@ test_expect_success 'setup' '
# explicit --single with tag
git clone --single-branch --branch two . dir_tag &&
+ # explicit --single with tag and --no-tags
+ git clone --single-branch --no-tags --branch two . dir_tag_no_tags &&
+
# advance both "master" and "side" branches
git checkout side &&
echo five >file &&
@@ -59,7 +69,8 @@ test_expect_success 'setup' '
test_expect_success 'by default all branches will be kept updated' '
(
- cd dir_all && git fetch &&
+ cd dir_all &&
+ git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
@@ -71,28 +82,82 @@ test_expect_success 'by default all branches will be kept updated' '
test_expect_success 'by default no tags will be kept updated' '
(
- cd dir_all && git fetch &&
+ cd dir_all &&
+ git fetch &&
git for-each-ref refs/tags >../actual
) &&
git for-each-ref refs/tags >expect &&
- test_must_fail test_cmp expect actual
+ test_must_fail test_cmp expect actual &&
+ test_line_count = 2 actual
+'
+
+test_expect_success 'clone with --no-tags' '
+ (
+ cd dir_all_no_tags &&
+ git fetch &&
+ git for-each-ref refs/tags >../actual
+ ) &&
+ >expect &&
+ test_cmp expect actual
'
test_expect_success '--single-branch while HEAD pointing at master' '
(
- cd dir_master && git fetch &&
+ cd dir_master &&
+ git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
) &&
# only follow master
git for-each-ref refs/heads/master >expect &&
- test_cmp expect actual
+ # get & check latest tags
+ test_cmp expect actual &&
+ (
+ cd dir_master &&
+ git fetch --tags &&
+ git for-each-ref refs/tags >../actual
+ ) &&
+ git for-each-ref refs/tags >expect &&
+ test_cmp expect actual &&
+ test_line_count = 2 actual
+'
+
+test_expect_success '--single-branch while HEAD pointing at master and --no-tags' '
+ (
+ cd dir_master_no_tags &&
+ git fetch &&
+ git for-each-ref refs/remotes/origin |
+ sed -e "/HEAD$/d" \
+ -e "s|/remotes/origin/|/heads/|" >../actual
+ ) &&
+ # only follow master
+ git for-each-ref refs/heads/master >expect &&
+ test_cmp expect actual &&
+ # get tags (noop)
+ (
+ cd dir_master_no_tags &&
+ git fetch &&
+ git for-each-ref refs/tags >../actual
+ ) &&
+ >expect &&
+ test_cmp expect actual &&
+ test_line_count = 0 actual &&
+ # get tags with --tags overrides tagOpt
+ (
+ cd dir_master_no_tags &&
+ git fetch --tags &&
+ git for-each-ref refs/tags >../actual
+ ) &&
+ git for-each-ref refs/tags >expect &&
+ test_cmp expect actual &&
+ test_line_count = 2 actual
'
test_expect_success '--single-branch while HEAD pointing at side' '
(
- cd dir_side && git fetch &&
+ cd dir_side &&
+ git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
@@ -104,7 +169,8 @@ test_expect_success '--single-branch while HEAD pointing at side' '
test_expect_success '--single-branch with explicit --branch side' '
(
- cd dir_side2 && git fetch &&
+ cd dir_side2 &&
+ git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
@@ -116,16 +182,29 @@ test_expect_success '--single-branch with explicit --branch side' '
test_expect_success '--single-branch with explicit --branch with tag fetches updated tag' '
(
- cd dir_tag && git fetch &&
+ cd dir_tag &&
+ git fetch &&
git for-each-ref refs/tags >../actual
) &&
git for-each-ref refs/tags >expect &&
test_cmp expect actual
'
+test_expect_success '--single-branch with explicit --branch with tag fetches updated tag despite --no-tags' '
+ (
+ cd dir_tag_no_tags &&
+ git fetch &&
+ git for-each-ref refs/tags >../actual
+ ) &&
+ git for-each-ref refs/tags/two >expect &&
+ test_cmp expect actual &&
+ test_line_count = 1 actual
+'
+
test_expect_success '--single-branch with --mirror' '
(
- cd dir_mirror && git fetch &&
+ cd dir_mirror &&
+ git fetch &&
git for-each-ref refs > ../actual
) &&
git for-each-ref refs >expect &&
@@ -134,7 +213,8 @@ test_expect_success '--single-branch with --mirror' '
test_expect_success '--single-branch with explicit --branch and --mirror' '
(
- cd dir_mirror_side && git fetch &&
+ cd dir_mirror_side &&
+ git fetch &&
git for-each-ref refs > ../actual
) &&
git for-each-ref refs >expect &&
@@ -143,7 +223,8 @@ test_expect_success '--single-branch with explicit --branch and --mirror' '
test_expect_success '--single-branch with detached' '
(
- cd dir_detached && git fetch &&
+ cd dir_detached &&
+ git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules-shallow.sh
index a87d329..a87d329 100755
--- a/t/t5614-clone-submodules.sh
+++ b/t/t5614-clone-submodules-shallow.sh