git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <junkio@cox.net>
Date
Feb 22, 2007, 19:18 UTC
Message-ID
<7vmz36f1bv.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0702221926390.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
>> 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.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 7 of 13 in “Teach git-diff{,-files} the new option `--no-index`”
  1. Teach git-diff{,-files} the new option `--no-index`Johannes Schindelin, Feb 20, 2007
  2. Junio C HamanoFeb 22, 2007
  3. Johannes SchindelinFeb 22, 2007
  4. Junio C HamanoFeb 22, 2007
  5. Johannes SchindelinFeb 22, 2007
  6. run_diff_files(): add option to prevent --no-indexJohannes Schindelin, Feb 22, 2007
  7. Junio C HamanoFeb 22, 2007
  8. Johannes SchindelinFeb 22, 2007
  9. Junio C HamanoFeb 22, 2007
  10. Johannes SchindelinFeb 22, 2007
  11. Teach git-diff-files the new option `--no-index`Johannes Schindelin, Feb 22, 2007
  12. Junio C HamanoFeb 23, 2007
  13. Johannes SchindelinFeb 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.