Perl code for git-clean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> <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!
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux