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

Unused (assigned but not read) option in diff_no_index

From
Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Date
Oct 28, 2011, 15:08 UTC
Message-ID
<CAA01Csruo+PPbgWMjTdkOeCEVx_Hgr=_tN-pTOiWxRfCd3nbyQ@mail.gmail.com>
Hi,

I noticed that "options" variable in diff-no-index.c:diff_no_index() is modified when "-q" is passed but not used (not read) at all. So either it can be removed or it should be used. "-q" is not described in git-diff man page.

This code was introduced in 0569e9b8 "git diff": do not ignore index without --no-index" - it was moved from builtin-diff.c (where it was used) but the code was refactored so I can't say if it should still be.

$ grep -E -2 '\boptions\b' diff-no-index.c
	int i;
	int no_index = 0;
	unsigned options = 0;
	/* Were we asked to do --no-index explicitly? */
--
			i++;
		else if (!strcmp(argv[i], "-q")) {
			options |= DIFF_SILENT_ON_REMOVED;
			i++;
		}
-- 
Piotr Krukowiecki
Message 1 of 1 in “Unused (assigned but not read) option in diff_no_index”
  1. Piotr KrukowieckiOct 28, 2011

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.