From: Junio C Hamano <gitster@pobox.com>
To: Travor@web.codeaurora.org
Cc: "Liu <travor_lzh"@outlook.com, git@vger.kernel.org,
Travor Liu <travor_lzh@outlook.com>
Subject: Re: [PATCH 2/2] t9502: test gitweb index hash formatting with modes
Date: Thu, 16 Jul 2026 22:50:09 -0700 [thread overview]
Message-ID: <xmqqjyqu6u7i.fsf@gitster.g> (raw)
In-Reply-To: <SA1PR10MB9977159B51766C2D9FFE98FD37F1F82@SA1PR10MB997715.namprd10.prod.outlook.com> (Travor@web.codeaurora.org's message of "Wed, 15 Jul 2026 17:11:30 +0800")
Travor@web.codeaurora.org, "Liu <travor_lzh"@outlook.com writes:
> From: Travor Liu <travor_lzh@outlook.com>
>
> gitweb should shorten and link the object IDs in commitdiff index lines
> even when Git includes the trailing file mode:
>
> index <old>..<new> 100644
>
> Add coverage for that common form by rendering a commitdiff for a
> regular file modification. Check that the visible index line contains
> linked short blob IDs followed by the mode and file-type annotation,
> and that the full unlinked form is not emitted.
>
> Signed-off-by: Travor Liu <travor_lzh@outlook.com>
> ---
> t/t9502-gitweb-standalone-parse-output.sh | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
If the new test added by this patch validates the "fix" in
[PATCH 1/2], reviewing the change might be easier if the two
were squashed into a single patch.
> diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
> index 81d5625..7f37e26 100755
> --- a/t/t9502-gitweb-standalone-parse-output.sh
> +++ b/t/t9502-gitweb-standalone-parse-output.sh
> @@ -115,6 +115,20 @@ test_expect_success 'snapshot: hierarchical branch name (xx/test)' '
> '
> test_debug 'cat gitweb.headers'
>
> +test_expect_success 'commitdiff: index line shortens hashes with mode' '
> + old_blob=$(git rev-parse HEAD:foo) &&
> + old_short=$(git rev-parse --short=7 HEAD:foo) &&
> + echo changed >foo &&
> + git commit -am "change foo" &&
> + new_blob=$(git rev-parse HEAD:foo) &&
> + new_short=$(git rev-parse --short=7 HEAD:foo) &&
> + gitweb_run "p=.git;a=commitdiff;h=HEAD" &&
> + grep ">${old_short}</a>\\.\\.<a [^>]*>${new_short}</a> 100644" \
> + gitweb.body >index_line &&
> + grep "<span class=\"info\"> (file)</span>" index_line &&
> + ! grep "index ${old_blob}\\.\\.${new_blob} 100644" gitweb.body
> +'
Can we use "test_grep" (for positive "this string must be there") and
"test_grep !" (for negative "it is an error if this string appears"
(note that exclamation point comes after test_grep))? It would make
it easier to diagnose a failing test.
Also, there is a topic in flight that enforces the use of test_grep in
these test scripts, and use of raw grep like the above would break
under those stricter rules.
Thanks.
prev parent reply other threads:[~2026-07-17 5:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 9:11 [PATCH 0/2] gitweb: shorten commitdiff index hashes with file modes Travor Liu
2026-07-15 9:11 ` [PATCH 1/2] gitweb: shorten index hashes with trailing " Travor Liu
2026-07-15 9:11 ` [PATCH 2/2] t9502: test gitweb index hash formatting with modes Travor Liu
2026-07-17 5:50 ` Junio C Hamano [this message]
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=xmqqjyqu6u7i.fsf@gitster.g \
--to=gitster@pobox.com \
--cc="Liu <travor_lzh"@outlook.com \
--cc=Travor@web.codeaurora.org \
--cc=git@vger.kernel.org \
--cc=travor_lzh@outlook.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox