Re: [PATCH v4 7/7] t6012: make rev-list tests more interesting

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

 



"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
>
> As we are working to rewrite some of the revision-walk machinery,
> there could easily be some interesting interactions between the
> options that force topological constraints (--topo-order,
> --date-order, and --author-date-order) along with specifying a
> path.
>
> Add extra tests to t6012-rev-list-simplify.sh to add coverage of
> these interactions. To ensure interesting things occur, alter the
> repo data shape to have different orders depending on topo-, date-,
> or author-date-order.

Very nice, though I have noticed (please correct me if I am wrong) that
in all cases path limited query always have the same result for
--topo-order and for --date-order; as opposed to three different results
for three different revision sorting modes for path-less query.

>
> When testing using GIT_TEST_COMMIT_GRAPH, this assists in covering
> the new logic for topo-order walks using generation numbers. The
> extra tests can be added indepently.

Good.  I guess we are mainly interested in tests without limits and
exclusions, i.e. A or A B and not A..B or A...B walks.

>
> Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx>
> ---
>  t/t6012-rev-list-simplify.sh | 45 ++++++++++++++++++++++++++++--------
>  1 file changed, 36 insertions(+), 9 deletions(-)
>
> diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
> index b5a1190ffe..a10f0df02b 100755
> --- a/t/t6012-rev-list-simplify.sh
> +++ b/t/t6012-rev-list-simplify.sh
> @@ -12,6 +12,22 @@ unnote () {
>  	git name-rev --tags --stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g"
>  }
>  
> +#
> +# Create a test repo with interesting commit graph:
> +#
> +# A--B----------G--H--I--K--L
> +#  \  \           /     /
> +#   \  \         /     /
> +#    C------E---F     J
> +#        \_/
> +#
> +# The commits are laid out from left-to-right starting with
> +# the root commit A and terminating at the tip commit L.

Do I understand it correctly that it is a visualization of history
created by existing code (which is a very nice to have)?

> +#
> +# There are a few places where we adjust the commit date or
> +# author date to make the --topo-order, --date-order, and
> +# --author-date-order flags produce different output.

Sidenote: it looks like "a few places" is "one place" for now...

> +
>  test_expect_success setup '
>  	echo "Hi there" >file &&
>  	echo "initial" >lost &&
> @@ -21,10 +37,18 @@ test_expect_success setup '
>  
>  	git branch other-branch &&
>  
> +	git symbolic-ref HEAD refs/heads/unrelated &&
> +	git rm -f "*" &&
> +	echo "Unrelated branch" >side &&
> +	git add side &&
> +	test_tick && git commit -m "Side root" &&
> +	note J &&
> +	git checkout master &&

I see that this fragment is moved earlier, but I don't know what
consequences it does have.

> +
>  	echo "Hello" >file &&
>  	echo "second" >lost &&
>  	git add file lost &&
> -	test_tick && git commit -m "Modified file and lost" &&
> +	test_tick && GIT_AUTHOR_DATE=$(($test_tick + 120)) git commit -m "Modified file and lost" &&
>  	note B &&

Nice trick, though I think it produces slightly unrealistic history (at
least in absence of the clock skew).  Author dates are ordinarily
earlier or equal to commit dates, and commits can be authored in
different order that they were committed.

>  
>  	git checkout other-branch &&
> @@ -63,13 +87,6 @@ test_expect_success setup '
>  	test_tick && git commit -a -m "Final change" &&
>  	note I &&
>  
> -	git symbolic-ref HEAD refs/heads/unrelated &&
> -	git rm -f "*" &&
> -	echo "Unrelated branch" >side &&
> -	git add side &&
> -	test_tick && git commit -m "Side root" &&
> -	note J &&
> -
>  	git checkout master &&
>  	test_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated &&
>  	note K &&
> @@ -103,14 +120,24 @@ check_result () {
>  	check_outcome success "$@"
>  }
>  
> -check_result 'L K J I H G F E D C B A' --full-history
> +check_result 'L K J I H F E D C G B A' --full-history --topo-order
> +check_result 'L K I H G F E D C B J A' --full-history
> +check_result 'L K I H G F E D C B J A' --full-history --date-order
> +check_result 'L K I H G F E D B C J A' --full-history --author-date-order
>  check_result 'K I H E C B A' --full-history -- file
>  check_result 'K I H E C B A' --full-history --topo-order -- file
>  check_result 'K I H E C B A' --full-history --date-order -- file
> +check_result 'K I H E B C A' --full-history --author-date-order -- file
>  check_result 'I E C B A' --simplify-merges -- file
> +check_result 'I E C B A' --simplify-merges --topo-order -- file
> +check_result 'I E C B A' --simplify-merges --date-order -- file
> +check_result 'I E B C A' --simplify-merges --author-date-order -- file
>  check_result 'I B A' -- file
>  check_result 'I B A' --topo-order -- file
> +check_result 'I B A' --date-order -- file
> +check_result 'I B A' --author-date-order -- file
>  check_result 'H' --first-parent -- another-file
> +check_result 'H' --first-parent --topo-order -- another-file
>  
>  check_result 'E C B A' --full-history E -- lost
>  test_expect_success 'full history simplification without parent' '

More tests, looks good.



[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