Re: [PATCH] Avoid running lstat(2) on the same cache entry.

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

 



Hi,

On Sat, 19 Jan 2008, Linus Torvalds wrote:

> @@ -687,13 +732,20 @@ int run_diff_index(struct rev_info *revs, int cached)
>  	tree = parse_tree_indirect(ent->sha1);
>  	if (!tree)
>  		return error("bad tree object %s", tree_name);
> -	if (read_tree(tree, 1, revs->prune_data))
> -		return error("unable to read tree object %s", tree_name);
> -	ret = diff_cache(revs, active_cache, active_nr, revs->prune_data,
> -			 cached, match_missing);
> +
> +	memset(&opts, 0, sizeof(opts));
> +	opts.head_idx = 1;
> +	opts.index_only = cached;
> +	opts.merge = 1;
> +	opts.fn = oneway_diff;
> +	opts.unpack_data = revs;
> +
> +	init_tree_desc(&t, tree->buffer, tree->size);
> +	unpack_trees(1, &t, &opts);
> +	
>  	diffcore_std(&revs->diffopt);
>  	diff_flush(&revs->diffopt);
> -	return ret;
> +	return 0;
>  }
>

Two problems I see (before I go to bed): match_missing is now ignored, and 
the return value is set to 0, whereas it was the return value of 
diff_cache() before.

The first is easily fixed, by replacing the two "0"s in the calls to 
show_new_file() and show_modified() with "!revs->ignore_merges".  Unless I 
am missing something, of course.

And the second is not _that_ bad, as it seems that diff_cache() has only 
one return statement, and it returns 0, AFAICS.  But it had to be said 
somewhere. 

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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