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

Re: [PATCH 2/4] .gitignore: remove dangling file

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 2, 2020, 03:30 UTC
Message-ID
<CAMP44s2kHshVBRaQ=+jMTLvvxo+aQyB_XP8Et=+ZZt8XhpDufQ@mail.gmail.com>
In-Reply-To
<X8b7UMcsfaD0OFv4@coredump.intra.peff.net>
On Tue, Dec 1, 2020 at 8:26 PM Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
> I was curious how hard it would be to find unused ones, and it is not
> too bad:
>
>   find * -type f |
>   git check-ignore --stdin -v |
>   perl -e '
>     my $ignore_file = shift;
>     while (<>) {
>       /^\Q$ignore_file\E:(\d+)/ and $seen{$1} = 1;
>     }
>     open(my $fh, "<", $ignore_file);
>     while (<$fh>) {
>       print "$. $_" unless $seen{$.};
>     }
>   ' .gitignore
Or to use a more modern language:
find * -type f |
  git check-ignore --stdin -v |
  ruby -e '
    $ignore_file = ARGV.first
    $seen = {}
    $stdin.each do |e|
      e =~ /^#{Regexp.quote($ignore_file)}:(\d+)/ and $seen[$1.to_i - 1] = true
    end
    ARGF.each_with_index do |e, i|
      print "#{i} #{e}" unless $seen[i]
    end
  ' .gitignore
-- 
Felipe Contreras
Previous: Jeff KingNext: René Scharfe
Message 14 of 18 in “Random cleanups”
  1. 0/4 Random cleanupsFelipe Contreras, Dec 1, 2020
  2. 4/4 tests: lib-functions: trivial style cleanupsFelipe Contreras, Dec 1, 2020
  3. 1/4 refspec: trivial cleanupFelipe Contreras, Dec 1, 2020
  4. Jeff KingDec 1, 2020
  5. Junio C HamanoDec 1, 2020
  6. Felipe ContrerasDec 1, 2020
  7. Jeff KingDec 2, 2020
  8. Felipe ContrerasDec 2, 2020
  9. 3/4 test: completion: fix typosFelipe Contreras, Dec 1, 2020
  10. 2/4 .gitignore: remove dangling fileFelipe Contreras, Dec 1, 2020
  11. Junio C HamanoDec 1, 2020
  12. Felipe ContrerasDec 1, 2020
  13. Jeff KingDec 2, 2020
  14. Felipe ContrerasDec 2, 2020
  15. gitignore: remove entry for git serveRené Scharfe, Dec 2, 2020
  16. Johannes SchindelinDec 2, 2020
  17. Jeff KingDec 2, 2020
  18. Junio C HamanoDec 2, 2020

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.