]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5500-fetch-pack.sh
fetch, upload-pack: --deepen=N extends shallow boundary by N commits
[thirdparty/git.git] / t / t5500-fetch-pack.sh
index 3a9b77576fb57828cd574017883c7920c2d91aa3..a908036be72808c4bc2f17f1b43dc0b6e96cfc73 100755 (executable)
@@ -14,7 +14,7 @@ test_description='Testing multi_ack pack fetching'
 add () {
        name=$1 &&
        text="$@" &&
-       branch=`echo $name | sed -e 's/^\(.\).*$/\1/'` &&
+       branch=$(echo $name | sed -e 's/^\(.\).*$/\1/') &&
        parents="" &&
 
        shift &&
@@ -50,18 +50,18 @@ pull_to_client () {
                        case "$heads" in *B*)
                            echo $BTIP > .git/refs/heads/B;;
                        esac &&
-                       git symbolic-ref HEAD refs/heads/`echo $heads \
-                               | sed -e "s/^\(.\).*$/\1/"` &&
+                       git symbolic-ref HEAD refs/heads/$(echo $heads \
+                               | sed -e "s/^\(.\).*$/\1/") &&
 
                        git fsck --full &&
 
                        mv .git/objects/pack/pack-* . &&
-                       p=`ls -1 pack-*.pack` &&
+                       p=$(ls -1 pack-*.pack) &&
                        git unpack-objects <$p &&
                        git fsck --full &&
 
-                       idx=`echo pack-*.idx` &&
-                       pack_count=`git show-index <$idx | wc -l` &&
+                       idx=$(echo pack-*.idx) &&
+                       pack_count=$(git show-index <$idx | wc -l) &&
                        test $pack_count = $count &&
                        rm -f pack-*
                )
@@ -132,13 +132,13 @@ test_expect_success 'single given branch clone' '
 
 test_expect_success 'clone shallow depth 1' '
        git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0 &&
-       test "`git --git-dir=shallow0/.git rev-list --count HEAD`" = 1
+       test "$(git --git-dir=shallow0/.git rev-list --count HEAD)" = 1
 '
 
 test_expect_success 'clone shallow depth 1 with fsck' '
        git config --global fetch.fsckobjects true &&
        git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0fsck &&
-       test "`git --git-dir=shallow0fsck/.git rev-list --count HEAD`" = 1 &&
+       test "$(git --git-dir=shallow0fsck/.git rev-list --count HEAD)" = 1 &&
        git config --global --unset fetch.fsckobjects
 '
 
@@ -147,7 +147,7 @@ test_expect_success 'clone shallow' '
 '
 
 test_expect_success 'clone shallow depth count' '
-       test "`git --git-dir=shallow/.git rev-list --count HEAD`" = 2
+       test "$(git --git-dir=shallow/.git rev-list --count HEAD)" = 2
 '
 
 test_expect_success 'clone shallow object count' '
@@ -273,7 +273,7 @@ test_expect_success 'additional simple shallow deepenings' '
 '
 
 test_expect_success 'clone shallow depth count' '
-       test "`git --git-dir=shallow/.git rev-list --count HEAD`" = 11
+       test "$(git --git-dir=shallow/.git rev-list --count HEAD)" = 11
 '
 
 test_expect_success 'clone shallow object count' '
@@ -637,4 +637,72 @@ test_expect_success MINGW 'fetch-pack --diag-url c:repo' '
        check_prot_path c:repo file c:repo
 '
 
+test_expect_success 'clone shallow since ...' '
+       test_create_repo shallow-since &&
+       (
+       cd shallow-since &&
+       GIT_COMMITTER_DATE="100000000 +0700" git commit --allow-empty -m one &&
+       GIT_COMMITTER_DATE="200000000 +0700" git commit --allow-empty -m two &&
+       GIT_COMMITTER_DATE="300000000 +0700" git commit --allow-empty -m three &&
+       git clone --shallow-since "300000000 +0700" "file://$(pwd)/." ../shallow11 &&
+       git -C ../shallow11 log --pretty=tformat:%s HEAD >actual &&
+       echo three >expected &&
+       test_cmp expected actual
+       )
+'
+
+test_expect_success 'fetch shallow since ...' '
+       git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
+       git -C shallow11 log --pretty=tformat:%s origin/master >actual &&
+       cat >expected <<-\EOF &&
+       three
+       two
+       EOF
+       test_cmp expected actual
+'
+
+test_expect_success 'shallow clone exclude tag two' '
+       test_create_repo shallow-exclude &&
+       (
+       cd shallow-exclude &&
+       test_commit one &&
+       test_commit two &&
+       test_commit three &&
+       git clone --shallow-exclude two "file://$(pwd)/." ../shallow12 &&
+       git -C ../shallow12 log --pretty=tformat:%s HEAD >actual &&
+       echo three >expected &&
+       test_cmp expected actual
+       )
+'
+
+test_expect_success 'fetch exclude tag one' '
+       git -C shallow12 fetch --shallow-exclude one origin &&
+       git -C shallow12 log --pretty=tformat:%s origin/master >actual &&
+       test_write_lines three two >expected &&
+       test_cmp expected actual
+'
+
+test_expect_success 'fetching deepen' '
+       test_create_repo shallow-deepen &&
+       (
+       cd shallow-deepen &&
+       test_commit one &&
+       test_commit two &&
+       test_commit three &&
+       git clone --depth 1 "file://$(pwd)/." deepen &&
+       test_commit four &&
+       git -C deepen log --pretty=tformat:%s master >actual &&
+       echo three >expected &&
+       test_cmp expected actual &&
+       git -C deepen fetch --deepen=1 &&
+       git -C deepen log --pretty=tformat:%s origin/master >actual &&
+       cat >expected <<-\EOF &&
+       four
+       three
+       two
+       EOF
+       test_cmp expected actual
+       )
+'
+
 test_done