diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-05-10 16:19:06 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-11 12:45:18 +0900 |
commit | 47c88d16ba6c5c0237238ac600ee8b74a522e41c (patch) | |
tree | fece7ae67a32ccf52950137bd8b536ce2d0cb1e9 /t/t1307-config-blob.sh | |
parent | describe tests: convert setup to use test_commit (diff) | |
download | tgif-47c88d16ba6c5c0237238ac600ee8b74a522e41c.tar.xz |
test-lib functions: add --printf option to test_commit
Add a --printf option to test_commit to allow writing to the file with
"printf" instead of "echo".
This is useful for writing "\n", "\0" etc., in particular in
combination with the --append option added in 3373518cc8 (test-lib
functions: add an --append option to test_commit, 2021-01-12).
I'm converting a few tests to use the new option rather than a manual
printf/add/commit combination to demonstrate its usefulness. While I'm
at it use "test_create_repo" where appropriate, and give the
first/second commit a meaningful/more conventional log message in
cases where no test cared about that message.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1307-config-blob.sh')
-rwxr-xr-x | t/t1307-config-blob.sh | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh index 002e6d3388..930dce06f0 100755 --- a/t/t1307-config-blob.sh +++ b/t/t1307-config-blob.sh @@ -65,9 +65,7 @@ test_expect_success 'parse errors in blobs are properly attributed' ' ' test_expect_success 'can parse blob ending with CR' ' - printf "[some]key = value\\r" >config && - git add config && - git commit -m CR && + test_commit --printf CR config "[some]key = value\\r" && echo value >expect && git config --blob=HEAD:config some.key >actual && test_cmp expect actual |