Re: [PATCHv3 9/9] submodule--helper: use parallel processor correctly.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2016, 16:40 UTC
- Message-ID
- <xmqq37mddhf2.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160809040811.21408-12-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 5 quoted lines
> When implementing the die() in 665b35ecc (2016-06-09, "submodule--helper: > initial clone learns retry logic"), I considered this condition to be > a severe condition, which should lead to an immediate abort as we do not > trust ourselves any more. However the queued messages in `err` are valuable > so let's not toss them out by immediately dieing, but a graceful return.
I think you'll be rerolling this series at least once (if only to correct for 6/9), so perhaps split this fix into a preparatory fix that can go earlier to 'next' and further that the remainder of the series depend on?
Show 22 quoted lines
>
> Another thing to note: The error message itself was missleading. A return
> value of 0 doesn't indicate the passed in `ce` is not a submodule any more,
> but just that we do not consider cloning it any more.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> builtin/submodule--helper.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index fc14843..3e40f99 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -815,8 +815,12 @@ static int update_clone_get_next_task(struct child_process *child,
> if (index < suc->failed_clones_nr) {
> int *p;
> ce = suc->failed_clones[index];
> - if (!prepare_to_clone_next_submodule(ce, child, suc, err))
> - die("BUG: ce was a submodule before?");
> + if (!prepare_to_clone_next_submodule(ce, child, suc, err)) {
> + suc->current ++;s/current /current/;
Show 7 quoted lines
> + strbuf_addf(err, "BUG: submodule considered for cloning," > + "doesn't need cloning any more?\n"); > + return 0; > + } > p = xmalloc(sizeof(*p)); > *p = suc->current; > *idx_task_cb = p;