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

Re: [PATCH v1 1/1] dir: teach status to show ignored directories

From
JMJameson Miller <jameson.miller81@gmail.com>
Date
Aug 11, 2017, 18:29 UTC
Message-ID
<08b17af5-a8cf-ed15-9972-e7d655272a7e@gmail.com>
In-Reply-To
<20170811173905.GA59325@google.com>
On 08/11/2017 01:39 PM, Brandon Williams wrote:
Show 38 quoted lines
> On 08/10, Jameson Miller wrote:
>> Teach Git to optionally show ignored directories when showing all
>> untracked files. The git status command exposes the options to report
>> ignored and/or untracked files. However, when reporting all untracked
>> files (--untracked-files=all), all individual ignored files are reported
>> as well. It is not currently possible to get the reporting behavior of
>> the --ignored flag, while also reporting all untracked files. This
>> change exposes a flag to report all untracked files while not showing
>> individual files in ignored directories.
>>
>> Motivation:
>> Our application (Visual Studio) needs all untracked files listed
>> individually, but does not need all ignored files listed individually.
>> Reporting all ignored files can affect the time it takes for status
>> to run. For a representative repository, here are some measurements
>> showing a large perf improvement for this scenario:
>>
>> | Command | Reported ignored entries | Time (s) |
>> | ------- | ------------------------ | -------- |
>> | 1       | 0                        | 1.3      |
>> | 2       | 1024                     | 4.2      |
>> | 3       | 174904                   | 7.5      |
>> | 4       | 1046                     | 1.6      |
>>
>> Commands:
>>   1) status
>>   2) status --ignored
>>   3) status --ignored --untracked-files=all
>>   4) status --ignored --untracked-files=all --show-ignored-directory
>>
>> This changes exposes a --show-ignored-directory flag to the git status
>> command. This flag is utilized when running git status with the
>> --ignored and --untracked-files options to not list ignored individual
>> ignored files contained in directories that match an ignore pattern.
> I can't help feeling that there is a better way express this with a
> better UI.  I'm not saying this is wrong, I'm just not sure how
> --show-ignored-directory would work when not paired with --ignored and
> --untracked-files.  Does it require --ignored to also be given?

Yes. This flag only has meaning when --ignored and --untracked=all are specified. I am open to other suggestions on how to express this.

Another option might be to modify the "--ignored" flag to take an argument, which would allow more explicit control over how ignored paths are reported. This way, we could specify (for example) "--ignored=explicit" to control the output of ignored paths.

Show 10 quoted lines
>> Part of the perf improvement comes from the tweak to
>> read_directory_recursive to stop scanning the file system after it
>> encounters the first file. When a directory is ignored, all it needs to
>> determine is if the directory is empty or not. The logic currently keeps
>> scanning the file system until it finds an untracked file. However, as
>> the directory is ignored, all the contained contents are also marked
>> excluded. For ignored directories that contain a large number of files,
>> this can take some time.
>>
>> Signed-off-by: Jameson Miller <jamill@microsoft.com>
Previous: Brandon WilliamsNext: Jameson Miller
Message 7 of 11 in “Teach status to show ignored directories”
  1. 0/1 Teach status to show ignored directoriesJameson Miller, Aug 10, 2017
  2. 1/1 dir: teach status to show ignored directoriesJameson Miller, Aug 10, 2017
  3. Stefan BellerAug 10, 2017
  4. Jameson MillerAug 11, 2017
  5. Stefan BellerAug 14, 2017
  6. Brandon WilliamsAug 11, 2017
  7. Jameson MillerAug 11, 2017
  8. Improve performance of git status --ignoredJameson Miller, Sep 18, 2017
  9. Improve performance of git status --ignoredJameson Miller, Sep 18, 2017
  10. Junio C HamanoSep 19, 2017
  11. Brandon WilliamsSep 19, 2017

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.