Tests of fetch and pull, and moved common test methods into common file

This commit is contained in:
Zach Musgrave
2023-09-26 12:00:00 -07:00
parent f83fedf4fb
commit c3c3f41c6d
4 changed files with 42 additions and 19 deletions

View File

@@ -265,11 +265,3 @@ SQL
[ "$head1" == "$head2" ]
}
dolt_log_in_PST() {
TZ=PST+8 dolt log -n1
}
get_head_commit() {
dolt log -n 1 | grep -m 1 commit | awk '{print $2}'
}

View File

@@ -43,6 +43,10 @@ get_head_commit() {
dolt log -n 1 | grep -m 1 commit | cut -c 13-44
}
dolt_log_in_PST() {
TZ=PST+8 dolt log -n1
}
setup_no_dolt_init() {
export PATH=$PATH:~/go/bin
cd $BATS_TMPDIR

View File

@@ -1151,11 +1151,3 @@ SQL
[ "$head1" == "$head2" ]
}
dolt_log_in_PST() {
TZ=PST+8 dolt log -n1
}
get_head_commit() {
dolt log -n 1 | grep -m 1 commit | awk '{print $2}'
}

View File

@@ -75,9 +75,6 @@ teardown() {
dolt commit --allow-empty -m "a commit for main from repo2"
dolt push
dolt branch
run dolt checkout other
[ "$status" -eq 0 ]
[[ "$output" =~ "branch 'other' set up to track 'origin/other'." ]] || false
@@ -2493,3 +2490,41 @@ SQL
[ "$status" -ne 0 ]
[[ "$output" =~ "--prune option cannot be provided with a ref spec" ]] || false
}
@test "remotes: pull with DOLT_AUTHOR_DATE and DOLT_COMMITER_DATE doesn't overwrite commit timestamps" {
mkdir repo1
cd repo1
dolt init
dolt sql -q "create table t1(a int)"
dolt commit -Am "new table"
dolt branch b1
dolt remote add origin file://../remote1
dolt push origin main
dolt push origin b1
cd ..
dolt clone file://./remote1 repo2
cd repo2
TZ=PST+8 DOLT_COMMITTER_DATE='2023-09-26T12:34:56' DOLT_AUTHOR_DATE='2023-09-26T01:23:45' dolt fetch
TZ=PST+8 DOLT_COMMITTER_DATE='2023-09-26T12:34:56' DOLT_AUTHOR_DATE='2023-09-26T01:23:45' dolt pull
run dolt_log_in_PST
[[ ! "$output" =~ 'Tue Sep 26 01:23:45' ]] || false
TZ=PST+8 DOLT_COMMITTER_DATE='2023-09-26T12:34:56' DOLT_AUTHOR_DATE='2023-09-26T01:23:45' dolt checkout b1
run dolt_log_in_PST
[[ ! "$output" =~ 'Tue Sep 26 01:23:45' ]] || false
cd ../repo1
dolt checkout b1
dolt commit --allow-empty -m 'empty commit'
dolt push origin b1
cd ../repo2
TZ=PST+8 DOLT_COMMITTER_DATE='2023-09-26T12:34:56' DOLT_AUTHOR_DATE='2023-09-26T01:23:45' dolt pull
run dolt_log_in_PST
[[ ! "$output" =~ 'Tue Sep 26 01:23:45' ]] || false
}