Re: [PATCH v5 2/6] t/perf: add last-modified perf script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 16, 2025 at 03:35:14PM +0200, Toon Claes wrote:
> diff --git a/t/perf/p8020-last-modified.sh b/t/perf/p8020-last-modified.sh
> new file mode 100755
> index 0000000000..a02ec907d4
> --- /dev/null
> +++ b/t/perf/p8020-last-modified.sh
> @@ -0,0 +1,21 @@
> +#!/bin/sh
> +
> +test_description='last-modified perf tests'
> +. ./perf-lib.sh
> +
> +test_perf_default_repo
> +
> +test_perf 'top-level last-modified' '
> +	git last-modified HEAD
> +'
> +
> +test_perf 'top-level recursive last-modified' '
> +	git last-modified -r HEAD
> +'

The only notable difference from GitHub's version here is that we do not
have a recursive option, so our test is just "git blame-tree
--max-depth=0", which is obviously not applicable here.

What you wrote (testing "last-modified" both with and without the "-r"
option) makes sense to me.

> +test_perf 'subdir last-modified' '
> +	path=$(git ls-tree HEAD | grep ^040000 | head -n 1 | cut -f2)

Hmm. This line comes directly from the patches that I originally shared,
but seeing "git" on the left-hand side of a pipe makes me a little
uneasy.

We could also use the "-d" flag here, which will only show us trees,
thus eliminating the need for the "grep ^040000" portion above.

I'd probably write this as:

    git ls-tree -d HEAD >subtrees &&
    path="$(head -n 1 subtrees | cut -f2)" &&
    git last-modified -- "$path"

Thanks,
Taylor




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux