From: Junio C Hamano <gitster@pobox.com>
To: Abhishek Kumar <abhishekkumar8222@gmail.com>
Cc: Antonio Russo <aerusso@aerusso.net>, git@vger.kernel.org
Subject: Re: [PATCH] t6016: move to lib-log-graph.sh framework
Date: Tue, 05 Jan 2021 21:05:22 -0800 [thread overview]
Message-ID: <xmqq1reywt7x.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: X/K1BgP8tpsgNe2x@Abhishek-Arch
Abhishek Kumar <abhishekkumar8222@gmail.com> writes:
> On Sun, Jan 03, 2021 at 07:30:35PM -0700, Antonio Russo wrote:
>> t6016 manually reconstructs git log --graph output by using the reported
>> commit hashes from `git rev-parse`. Each tag is converted into an
>> environment variable manually, and then `echo`-ed to an expected output
>> file, which is in turn compared to the actual output.
>>
>> The expected output is difficult to read and write, because, e.g.,
>> each line of output must be prefaced with echo, quoted, and properly
>> escaped. Additionally, the test is sensitive to trailing whitespace,
>> which may potentially be removed from graph log output in the future.
>>
>> In order to reduce duplication, ease troubleshooting of failed tests by
>> improving readability, and ease the addition of more tests to this file,
>> port the operations to `lib-log-graph.sh`, which is already used in
>> several other tests, e.g., t4215. Give all merges a simple commit
>> message, and use a common `check_graph` macro taking a heredoc of the
>> expected output which does not required extensive escaping.
>>
>
> Glad to see others using `lib-log-graph.sh` as well!
>
> The changes look alright to me but maybe you could have split the two
> changes into two different commits: Using tags directly instead of
> environment variables and using `check_graph` instead of manually
> `echo`-ing to an expected output and comparing with the actual output.
Perhaps. Also I am wondering if the tests still need to create tags
after this change---isn't the output all matched by the commit title
now?
That is ...
>> . ./test-lib.sh
>> +. "$TEST_DIRECTORY"/lib-log-graph.sh
>> +
>> +check_graph () {
>> + cat >expect &&
>> + lib_test_cmp_graph --format=%s "$@"
>> +}
... this only shows the title, and ...
>> - git merge B C &&
>> + git merge B C -m A4 &&
... that is why we need to have the title here.
>> git tag A4 &&
Now, does this A4 used anywhere?
>> - # Store commit names in variables for later use
>> - A1=$(git rev-parse --verify A1) &&
>> - A2=$(git rev-parse --verify A2) &&
>> - A3=$(git rev-parse --verify A3) &&
>> - A4=$(git rev-parse --verify A4) &&
It certainly used to be needed here, but ...
>> + check_graph --all <<-\EOF
>> + * A7
>> + * A6
>> + |\
>> + | * C4
>> + | * C3
>> + * | A5
>> + | |
>> + | \
>> + *-. | A4
... not anymore in the new version.
>> + |\ \|
>> + | | * C2
>> + | | * C1
>> + | * | B2
>> + | * | B1
>> + * | | A3
>> + | |/
>> + |/|
>> + * | A2
>> + |/
>> + * A1
>> + EOF
>> +'
>>
next prev parent reply other threads:[~2021-01-06 5:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 2:30 [PATCH] t6016: move to lib-log-graph.sh framework Antonio Russo
2021-01-04 6:26 ` Abhishek Kumar
2021-01-05 0:59 ` Antonio Russo
2021-01-06 5:05 ` Junio C Hamano [this message]
2021-01-06 15:21 ` Antonio Russo
2021-01-06 20:55 ` Junio C Hamano
2021-01-10 15:28 ` [PATCH v2] " Antonio Russo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1reywt7x.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=abhishekkumar8222@gmail.com \
--cc=aerusso@aerusso.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.