Skip to content

Commit 6d43a0c

Browse files
pcloudsgitster
authored andcommitted
t5500, t5539: tests for shallow depth since a specific date
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 994c2aa commit 6d43a0c

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

t/t5500-fetch-pack.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,4 +637,28 @@ test_expect_success MINGW 'fetch-pack --diag-url c:repo' '
637637
check_prot_path c:repo file c:repo
638638
'
639639

640+
test_expect_success 'clone shallow since ...' '
641+
test_create_repo shallow-since &&
642+
(
643+
cd shallow-since &&
644+
GIT_COMMITTER_DATE="100000000 +0700" git commit --allow-empty -m one &&
645+
GIT_COMMITTER_DATE="200000000 +0700" git commit --allow-empty -m two &&
646+
GIT_COMMITTER_DATE="300000000 +0700" git commit --allow-empty -m three &&
647+
git clone --shallow-since "300000000 +0700" "file://$(pwd)/." ../shallow11 &&
648+
git -C ../shallow11 log --pretty=tformat:%s HEAD >actual &&
649+
echo three >expected &&
650+
test_cmp expected actual
651+
)
652+
'
653+
654+
test_expect_success 'fetch shallow since ...' '
655+
git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
656+
git -C shallow11 log --pretty=tformat:%s origin/master >actual &&
657+
cat >expected <<-\EOF &&
658+
three
659+
two
660+
EOF
661+
test_cmp expected actual
662+
'
663+
640664
test_done

t/t5539-fetch-http-shallow.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,30 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
7373
)
7474
'
7575

76+
test_expect_success 'clone shallow since ...' '
77+
test_create_repo shallow-since &&
78+
(
79+
cd shallow-since &&
80+
GIT_COMMITTER_DATE="100000000 +0700" git commit --allow-empty -m one &&
81+
GIT_COMMITTER_DATE="200000000 +0700" git commit --allow-empty -m two &&
82+
GIT_COMMITTER_DATE="300000000 +0700" git commit --allow-empty -m three &&
83+
mv .git "$HTTPD_DOCUMENT_ROOT_PATH/shallow-since.git" &&
84+
git clone --shallow-since "300000000 +0700" $HTTPD_URL/smart/shallow-since.git ../shallow11 &&
85+
git -C ../shallow11 log --pretty=tformat:%s HEAD >actual &&
86+
echo three >expected &&
87+
test_cmp expected actual
88+
)
89+
'
90+
91+
test_expect_success 'fetch shallow since ...' '
92+
git -C shallow11 fetch --shallow-since "200000000 +0700" origin &&
93+
git -C shallow11 log --pretty=tformat:%s origin/master >actual &&
94+
cat >expected <<-\EOF &&
95+
three
96+
two
97+
EOF
98+
test_cmp expected actual
99+
'
100+
76101
stop_httpd
77102
test_done

0 commit comments

Comments
 (0)