Message ID | 4ba97a4e70aa437f9f710746fa7a8abad0732996.1637590855.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Inspect reflog data programmatically in more tests | expand |
On Mon, Nov 22 2021, Han-Wen Nienhuys via GitGitGadget wrote: > Z=$ZERO_OID > +TAB=' ' > > m=refs/heads/main > n_dir=refs/heads/gu > @@ -318,11 +319,12 @@ test_expect_success 'symref empty directory removal' ' > cat >expect <<EOF > $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 Initial Creation > $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150260 +0000 Switch > -$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 > +$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000$TAB So preceding commits added a trailing tab, or was that always the case with the alternate test utility?
On Mon, Nov 22, 2021 at 4:21 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > > > On Mon, Nov 22 2021, Han-Wen Nienhuys via GitGitGadget wrote: > > > Z=$ZERO_OID > > +TAB=' ' > > > > m=refs/heads/main > > n_dir=refs/heads/gu > > @@ -318,11 +319,12 @@ test_expect_success 'symref empty directory removal' ' > > cat >expect <<EOF > > $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 Initial Creation > > $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150260 +0000 Switch > > -$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 > > +$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000$TAB > > So preceding commits added a trailing tab, or was that always the case > with the alternate test utility? log_ref_write_fd() only writes \t into the log message if there is a non-empty message, and previously this was checking the log file directly. The test helper tweaked in one of the previous commits unconditionally prints a \t, which we now have to deal with.
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes: > From: Han-Wen Nienhuys <hanwen@google.com> > > This avoids inspecting the file system, which only works with the files ref > backend. Nice. Between always leaving HT after the timezone and mimicking the files-backend storage more closely by using HT as a separator only when there is actually a message, I have no strong preference, but as a "test-helper", being uniform would be more useful than being less ugly, so I think I am OK with this change (and the fact that test-helper unconditonally puts HT in hits output). > Z=$ZERO_OID > +TAB=' ' > > m=refs/heads/main > n_dir=refs/heads/gu > @@ -318,11 +319,12 @@ test_expect_success 'symref empty directory removal' ' > cat >expect <<EOF > $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 Initial Creation > $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150260 +0000 Switch > -$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 > +$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000$TAB > EOF > test_expect_success "verifying $m's log (logged by touch)" ' > - test_when_finished "rm -rf .git/$m .git/logs expect" && > - test_cmp expect .git/logs/$m > + test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && > + test-tool ref-store main for-each-reflog-ent $m > actual && > + test_cmp actual expect > ' > > test_expect_success "create $m (logged by config)" ' > @@ -347,11 +349,12 @@ test_expect_success "set $m (logged by config)" ' > cat >expect <<EOF > $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation > $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch > -$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000 > +$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000$TAB > EOF > test_expect_success "verifying $m's log (logged by config)" ' > - test_when_finished "rm -f .git/$m .git/logs/$m expect" && > - test_cmp expect .git/logs/$m > + test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && > + test-tool ref-store main for-each-reflog-ent $m > actual && > + test_cmp actual expect > ' > > test_expect_success 'set up for querying the reflog' ' > @@ -467,7 +470,8 @@ $h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 co > $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit. > EOF > test_expect_success 'git commit logged updates' ' > - test_cmp expect .git/logs/$m > + test-tool ref-store main for-each-reflog-ent $m >actual && > + test_cmp expect actual > ' > unset h_TEST h_OTHER h_FIXED h_MERGED
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 0d4f73acaa8..f91432e7a25 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -10,6 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh Z=$ZERO_OID +TAB=' ' m=refs/heads/main n_dir=refs/heads/gu @@ -318,11 +319,12 @@ test_expect_success 'symref empty directory removal' ' cat >expect <<EOF $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 Initial Creation $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150260 +0000 Switch -$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 +$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000$TAB EOF test_expect_success "verifying $m's log (logged by touch)" ' - test_when_finished "rm -rf .git/$m .git/logs expect" && - test_cmp expect .git/logs/$m + test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && + test-tool ref-store main for-each-reflog-ent $m > actual && + test_cmp actual expect ' test_expect_success "create $m (logged by config)" ' @@ -347,11 +349,12 @@ test_expect_success "set $m (logged by config)" ' cat >expect <<EOF $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch -$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000 +$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000$TAB EOF test_expect_success "verifying $m's log (logged by config)" ' - test_when_finished "rm -f .git/$m .git/logs/$m expect" && - test_cmp expect .git/logs/$m + test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && + test-tool ref-store main for-each-reflog-ent $m > actual && + test_cmp actual expect ' test_expect_success 'set up for querying the reflog' ' @@ -467,7 +470,8 @@ $h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 co $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit. EOF test_expect_success 'git commit logged updates' ' - test_cmp expect .git/logs/$m + test-tool ref-store main for-each-reflog-ent $m >actual && + test_cmp expect actual ' unset h_TEST h_OTHER h_FIXED h_MERGED