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

Re: does "git clean" deliberately ignore "core.excludesFile"?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 23, 2019, 18:19 UTC
Message-ID
<nycvar.QRO.7.76.6.1902231912370.45@tvgsbejvaqbjf.bet>
In-Reply-To
<nycvar.QRO.7.76.6.1902231905180.45@tvgsbejvaqbjf.bet>
Hi,
On Sat, 23 Feb 2019, Johannes Schindelin wrote:
Show 14 quoted lines
> On Sat, 23 Feb 2019, Junio C Hamano wrote:
> 
> > "Robert P. J. Day" <rpjday@crashcourse.ca> writes:
> > 
> > >   am i misreading something? and if not, is there a reason git clean
> > > does not consult core.excludesFile?
> > 
> > Can you ask "git log" and "git blame" whch of  core.excludesFile and
> > "clean -x" features came earlier and by how big a difference?
> 
> Or maybe we can have a look why the `core.excludesfile` regression test
> case in t7300 does not catch this?
> 
> https://github.com/git/git/blob/v2.21.0-rc2/t/t7300-clean.sh#L408-L417

I actually doubt that `git clean` ignores `core.excludesFile`: in https://github.com/git/git/blob/v2.21.0-rc2/config.c#L1297-L1298, `git_default_core_config()` (which is called via the `git_clean_config()` -> `git_color_default_config()` -> `git_default_config()` chain from `cmd_clean()`) does interpret `core.excludesFile`:

	if (!strcmp(var, "core.excludesfile"))
		return git_config_pathname(&excludes_file, var, value);

Then, `cmd_clean()` goes on to parse the options, setting the `ignored` variable upon `-x` and then doing [this](https://github.com/git/git/blob/v2.21.0-rc2/builtin/clean.c#L957-L958):

	if (!ignored)
		setup_standard_excludes(&dir);

This function specifically looks at `excludes_file` in https://github.com/git/git/blob/v2.21.0-rc2/dir.c#L2481-L2483:

	if (excludes_file && !access_or_warn(excludes_file, R_OK, 0))
		add_excludes_from_file_1(dir, excludes_file,
					 dir->untracked ? &dir->ss_excludes_file : NULL);

So I am quite puzzled by the claim that `git clean` might not consult `core.excludesFile`.

Robert, care to come up with an example demonstrating where it does not?

Ciao, Johannes

Previous: Johannes SchindelinNext: Robert P. J. Day
Message 4 of 7 in “does "git clean" deliberately ignore "core.excludesFile"?”
  1. Robert P. J. DayFeb 23, 2019
  2. Junio C HamanoFeb 23, 2019
  3. Johannes SchindelinFeb 23, 2019
  4. Johannes SchindelinFeb 23, 2019
  5. Robert P. J. DayFeb 23, 2019
  6. Junio C HamanoFeb 24, 2019
  7. Johannes SchindelinFeb 24, 2019

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.