diff --git a/integration-tests/bats/commit.bats b/integration-tests/bats/commit.bats index a87a62f4d1..262fc3dda6 100644 --- a/integration-tests/bats/commit.bats +++ b/integration-tests/bats/commit.bats @@ -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}' -} diff --git a/integration-tests/bats/helper/common.bash b/integration-tests/bats/helper/common.bash index 94dada4cb6..c4a0a03ddb 100644 --- a/integration-tests/bats/helper/common.bash +++ b/integration-tests/bats/helper/common.bash @@ -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 diff --git a/integration-tests/bats/merge.bats b/integration-tests/bats/merge.bats index 1280da3dd8..2fe6b5f6ae 100644 --- a/integration-tests/bats/merge.bats +++ b/integration-tests/bats/merge.bats @@ -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}' -} diff --git a/integration-tests/bats/remotes.bats b/integration-tests/bats/remotes.bats index 98c3021e49..b1e38d0ca0 100644 --- a/integration-tests/bats/remotes.bats +++ b/integration-tests/bats/remotes.bats @@ -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 +}