diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-05-10 17:19:06 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-11 06:45:18 +0300 |
commit | 47c88d16ba6c5c0237238ac600ee8b74a522e41c (patch) | |
tree | fece7ae67a32ccf52950137bd8b536ce2d0cb1e9 /t/t5520-pull.sh | |
parent | 8cfe386b78c15eff38388479aa2f9fae00a9cf53 (diff) |
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/t5520-pull.sh')
-rwxr-xr-x | t/t5520-pull.sh | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index a09411327f..e2c0c51022 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -746,14 +746,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' ' ' test_expect_success 'setup for detecting upstreamed changes' ' - mkdir src && - ( - cd src && - git init && - printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff && - git add stuff && - git commit -m "Initial revision" - ) && + test_create_repo src && + test_commit -C src --printf one stuff "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" && git clone src dst && ( cd src && |