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

Perl code for git-clean

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
May 8, 2007, 23:51 UTC
Message-ID
<86hcqm98mc.fsf@blue.stonehenge.com>

OK, this is untested, but I usually get this stuff right by eyeballing it. :)

export cleandir;
git-ls-files -z --others --directory $excl ${excl_info:+"$excl_info"} -- "$@" |
perl -ln0e '
  use File::Path qw(rmtree);
  if (-d and not -L) {
    if (not $ENV{cleandir}) {
      print "Not removing $_";
      next;
    }
    print "Removing $_";
    rmtree($_);
  } else {
    print "Removing $_";
    unlink($_);
  }
'
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Message 1 of 1 in “Perl code for git-clean”
  1. Randal L. SchwartzMay 8, 2007

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.