Re: [PATCH v2 06/10] commit.c: use generation to halt paint walk

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

 



Derrick Stolee <dstolee@xxxxxxxxxxxxx> writes:

> @@ -800,17 +810,26 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n, struc
>  		return result;
>  	}
>  	prio_queue_put(&queue, one);
> +	if (one->generation < min_nonstale_gen)
> +		min_nonstale_gen = one->generation;
>  
>  	for (i = 0; i < n; i++) {
>  		twos[i]->object.flags |= PARENT2;
>  		prio_queue_put(&queue, twos[i]);
> +		if (twos[i]->generation < min_nonstale_gen)
> +			min_nonstale_gen = twos[i]->generation;
>  	}
>  
> -	while (queue_has_nonstale(&queue)) {
> +	while (queue_has_nonstale(&queue, min_nonstale_gen)) {
>  		struct commit *commit = prio_queue_get(&queue);
>  		struct commit_list *parents;
>  		int flags;
>  
> +		if (commit->generation > last_gen)
> +			BUG("bad generation skip");
> +
> +		last_gen = commit->generation;
> +
>  		flags = commit->object.flags & (PARENT1 | PARENT2 | STALE);
>  		if (flags == (PARENT1 | PARENT2)) {
>  			if (!(commit->object.flags & RESULT)) {
> @@ -830,6 +849,10 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n, struc
>  				return NULL;
>  			p->object.flags |= flags;

Hmph.  Can a commit that used to be not stale (and contributed to
the current value of min_nonstale_gen) become stale here by getting
visited twice, invalidating the value in min_nonstale_gen?

>  			prio_queue_put(&queue, p);
> +
> +			if (!(flags & STALE) &&
> +			    p->generation < min_nonstale_gen)
> +				min_nonstale_gen = p->generation;
>  		}
>  	}



[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