Re: [PATCH] Teach git-diff{,-files} the new option `--no-index`

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

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

>> Can't they made to call a new function, which has the option
>> parsing followed by the switch between magic max_count==-2
>> codepath and run_diff_files()?
>
> How about adding "int always_use_index" to the signature of 
> run_diff_files()?

The "magic" part is not about the index at all (it is about
using only that magic part to do diff on filesystem), and the
original code is about "index vs filesystem".  I would rather
keep them in separate function.  That is:

	run_diff_files(); /* compares index vs filesystem */
                
	run_diff_filesystem(); /* runs diff2 */

        run_diff_files_cmd() {
             	/* a new helper */
		parse args;
		if (magic)
                	run_diff_filesystem();
		else
                	run_diff_files();
	}

	builtin_diff() {
        	if (not about two trees nor two blobs ...)
                	run_diff_files_cmd();
		else if (about two trees)
                	run_diff_tree();
		else if (about tree and index)
                	run_diff_index();
	}

        wt_status() {
        	run_diff_files();
                run_diff_index();
	}

For one thing, I want to move read_cache() out of
run_diff_files() and run_diff_index() to their callers, so that
the caller can use a handcrafted active_cache[] that is somewhat
different from what read_cache() originally read.



-
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]