diff mbox series

[4/4] t7004: use "test-tool ref-store" for reflog inspection

Message ID 5d693273e5852ae9b302cb79e8dd986b6ffa10da.1640170784.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit ed8d1d42d0ffc221340557614aa33bf8d3aba65f
Headers show
Series Reftable test fixes 20211221 | expand

Commit Message

Han-Wen Nienhuys Dec. 22, 2021, 10:59 a.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

This makes the test work with reftable.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 t/t7004-tag.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Junio C Hamano Dec. 22, 2021, 8:17 p.m. UTC | #1
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> This makes the test work with reftable.
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ...
> -	sed -e "s/^.*	//" .git/logs/refs/tags/tag_with_reflog2 >actual &&
> +	test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog2 | sed -e "s/^.*	//" >actual &&
>  	test_cmp expected actual
>  '

Yup, this makes perfect sense.  Purists may be bothered by having
anything _we_ write, like "test-tool" on the upstream of a pipe to
hide its exit code, though.

After applying these four patches on top of 'master', I still see
some mention of logs/refs in the t/ directory.  Some of them may
be a low-hanging fruit other people can take a look at and convert
to the test-helper calls to help us move the reftable topic forward
without stepping on your toes, hopefully?

Thanks.

t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo     .git/logs/refs/bisect/foo
t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs                bar/logs/refs
t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs/               bar/logs/refs/
t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs/bisec/foo      bar/logs/refs/bisec/foo
t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs/bisec          bar/logs/refs/bisec
t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs/bisectfoo      bar/logs/refs/bisectfoo
t/t0060-path-utils.sh:test_git_path GIT_COMMON_DIR=bar logs/refs/heads/main     bar/logs/refs/heads/main
t/t1301-shared-repo.sh:	actual="$(ls -l .git/logs/refs/heads/main)" &&
t/t1301-shared-repo.sh:		echo Ooops, .git/logs/refs/heads/main is not 066x [$actual]
t/t1400-update-ref.sh:rm -f .git/logs/refs/heads/main
t/t1400-update-ref.sh:	test_path_is_file .git/logs/refs/heads/d1/d2/r1 &&
t/t1400-update-ref.sh:	test_must_fail git show-ref --verify -q logs/refs/heads/d1/d2 &&
t/t1400-update-ref.sh:	test_path_is_file .git/logs/refs/heads/d1/r2
t/t1400-update-ref.sh:	test_path_is_file .git/logs/refs/heads/e1/e2/r1 &&
t/t1400-update-ref.sh:	test_must_fail git show-ref --verify -q logs/refs/heads/e1/e2 &&
t/t1400-update-ref.sh:	test_path_is_file .git/logs/refs/heads/e1/r2 &&
t/t1407-worktree-ref-store.sh:	mkdir -p     .git/logs/refs/bisect &&
t/t1407-worktree-ref-store.sh:	echo $ZERO_OID > .git/logs/refs/bisect/random &&
t/t1407-worktree-ref-store.sh:	mkdir -p     .git/worktrees/wt/logs/refs/bisect &&
t/t1407-worktree-ref-store.sh:	echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
t/t1410-reflog.sh:	# now logs/refs/heads/one is a stale directory, but
t/t1410-reflog.sh:	done >.git/logs/refs/heads/reflogskip &&
t/t3200-branch.sh:	test_path_is_file .git/logs/refs/heads/d/e/f &&
t/t3200-branch.sh:	test_cmp expect .git/logs/refs/heads/d/e/f
t/t3200-branch.sh:	mv .git/logs/refs/heads/u real-u &&
t/t3200-branch.sh:	ln -s real-u .git/logs/refs/heads/u &&
t/t3200-branch.sh:	test_path_is_file .git/logs/refs/heads/g/h/i &&
t/t3200-branch.sh:	test_cmp expect .git/logs/refs/heads/g/h/i
diff mbox series

Patch

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 301d1190482..bc8a221b2c7 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -97,7 +97,7 @@  test_expect_success 'creating a tag with --create-reflog should create reflog' '
 	test_when_finished "git tag -d tag_with_reflog1" &&
 	git tag --create-reflog tag_with_reflog1 &&
 	git reflog exists refs/tags/tag_with_reflog1 &&
-	sed -e "s/^.*	//" .git/logs/refs/tags/tag_with_reflog1 >actual &&
+	test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog1 | sed -e "s/^.*	//" >actual &&
 	test_cmp expected actual
 '
 
@@ -108,7 +108,7 @@  test_expect_success 'annotated tag with --create-reflog has correct message' '
 	test_when_finished "git tag -d tag_with_reflog2" &&
 	git tag -m "annotated tag" --create-reflog tag_with_reflog2 &&
 	git reflog exists refs/tags/tag_with_reflog2 &&
-	sed -e "s/^.*	//" .git/logs/refs/tags/tag_with_reflog2 >actual &&
+	test-tool ref-store main for-each-reflog-ent refs/tags/tag_with_reflog2 | sed -e "s/^.*	//" >actual &&
 	test_cmp expected actual
 '