real_path: create real_pathdup
[gitweb.git] / t / t5539-fetch-http-shallow.sh
index 37a433504e27f8dffc9bbbb9e94d550de20ff035..5fbf67c4468897184f46ef9ea151f1dd6ad1d8d0 100755 (executable)
@@ -73,5 +73,78 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
        )
 '
 
+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 &&
+       mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-since.git" &&
+       git clone --shallow-since "300000000 +0700" $HTTPD_URL/smart/shallow-since.git ../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 &&
+       mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-exclude.git" &&
+       git clone --shallow-exclude two $HTTPD_URL/smart/shallow-exclude.git ../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 &&
+       mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" &&
+       git clone --depth 1 $HTTPD_URL/smart/shallow-deepen.git deepen &&
+       mv "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" .git &&
+       test_commit four &&
+       git -C deepen log --pretty=tformat:%s master >actual &&
+       echo three >expected &&
+       test_cmp expected actual &&
+       mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-deepen.git" &&
+       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
+       )
+'
+
 stop_httpd
 test_done