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

Re: [PATCH] clean: new option --exclude-from

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 6, 2015, 03:51 UTC
Message-ID
<xmqqr3j0nsk8.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20151202175144.GA18550@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> My motivation isn't exactly code sharing. It is that you sometimes want
> to affect sub-commands of a program, and cannot pass command line
> options to them yourself.
>
> For instance, "git-stash --include-untracked" will call "git clean"
> under the hood. There is no way to say "...and treat foo.* as ignored
> for this invocation". It could grow its own "-e" option, but that does
> not help any other third-party scripts which call "git clean".
>
> So IMHO this is not really about command-line options, but about the
> environment in which a command is executed. Environment variables are
> the obvious way to do that; "git --foo" options are just syntactic sugar
> to set the variables. We could just add variables without matching
> options.

I'd be even more wary of that, as different commands use ignore patterns for different purposes. A script may invoke "clean" and "add" and would want to use different sets of ignore patterns to emulate "precious" class (which we do not have), for example, by giving a wider ignore pattern for "add" to prevent a file that must be kept untracked outside the index while telling "clean -X" that that file is not expendable with a narrower ignore pattern. That is just one example that comes to me without thinking about the issues too hard, so I am reasonably sure that it would hurt the ecosystem to promote that the ignore pattern can be used for specifying important per-invocation input to a script.

In any case, what we've been discussing may be an interesting and potentially important tangent, but it still is a tangent while evaluating the patch in question. I do not think I'd be using the new "--exclude-from=<file>" option to "clean" (simply because I do not think I've ever used the existing "-e" option to it unless I am merely testing the command to make sure it works as advertised) myself, but I do not immediately see how it would hurt us in the future to add it now. So...

Previous: Jeff KingNext: Jeff King
Message 10 of 21 in “clean: new option --exclude-from”
  1. clean: new option --exclude-fromJames, Nov 26, 2015
  2. Eric SunshineNov 30, 2015
  3. Jeff KingDec 2, 2015
  4. Junio C HamanoDec 2, 2015
  5. Jeff KingDec 2, 2015
  6. Junio C HamanoDec 2, 2015
  7. Jeff KingDec 2, 2015
  8. Junio C HamanoDec 2, 2015
  9. Jeff KingDec 2, 2015
  10. Junio C HamanoDec 6, 2015
  11. Jeff KingDec 7, 2015
  12. Eric SunshineDec 1, 2015
  13. 1/2 modernize t7300James, Dec 6, 2015
  14. 2/2 clean: new option --exclude-fromJames, Dec 6, 2015
  15. Jeff KingDec 7, 2015
  16. Junio C HamanoDec 7, 2015
  17. Eric SunshineDec 7, 2015
  18. Junio C HamanoDec 7, 2015
  19. Eric SunshineDec 7, 2015
  20. Junio C HamanoDec 7, 2015
  21. Eric SunshineDec 7, 2015

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.