Re: [PATCH 3/3] builtin/commit-graph.c: support '--input=none'

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

 



On 1/30/2020 7:28 PM, Taylor Blau wrote:
> In the previous commit, we introduced '--[no-]merge', and alluded to the
> fact that '--merge' would be useful for callers who wish to always
> trigger a merge of an incremental chain.
> 
> There is a problem with the above approach, which is that there is no
> way to specify to the commit-graph builtin that a caller only wants to
> include commits already in the graph. One can specify '--input=append'
> to include all commits in the existing graphs, but the absence of
> '--input=stdin-{commits,packs}' causes the builtin to call
> 'fill_oids_from_all_packs()'.
> 
> Passing '--input=reachable' (as in 'git commit-graph write
> --split=merge-all --input=reachable --input=append') works around this
> issue by making '--input=reachable' effectively a no-op, but this can be
> prohibitively expensive in large repositories, making it an undesirable
> choice for some users.
> 
> Teach '--input=none' as an option to behave as if '--input=append' were
> given, but to consider no other sources in addition.

The code change looks good.

> +test_expect_success '--split=no-merge, --input=none writes nothing' '
> +	test_when_finished rm -rf a graphs.before graphs.after &&
> +	rm -rf $graphdir &&
> +	git reset --hard commits/2 &&
> +	git rev-list -1 HEAD~1 >a &&
> +	git commit-graph write --split=no-merge --input=stdin-commits <a &&
> +	ls $graphdir/graph-*.graph >graphs.before &&
> +	test_line_count = 1 $graphdir/commit-graph-chain &&
> +	git commit-graph write --split --input=none &&
> +	ls $graphdir/graph-*.graph >graphs.after &&
> +	test_cmp graphs.before graphs.after
> +'
> +
> +test_expect_success '--split=merge-all, --input=none merges the chain' '
> +	test_when_finished rm -rf a b &&
> +	rm -rf $graphdir &&
> +	git reset --hard commits/2 &&
> +	git rev-list -1 HEAD~1 >a &&
> +	git rev-list -1 HEAD >b &&
> +	git commit-graph write --split=no-merge --input=stdin-commits <a &&
> +	git commit-graph write --split=no-merge --input=stdin-commits <b &&
> +	test_line_count = 2 $graphdir/commit-graph-chain &&
> +	git commit-graph write --split=merge-all --input=none &&
> +	test_line_count = 1 $graphdir/commit-graph-chain
> +'

And these tests demonstrate the value quite clearly. Thanks!

-Stolee



[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