1
1

Revise the build-ignore script for git:

1. remove the "die if not dual repo" and automatic "git add" for the .gitignore as we might want to run this script outside of a dual repo.

2. put the results in a single .gitignore file at the top so it mimics the mercurial script and is easier to copy to a git repo

3. don't prefix the entries with "./" as git doesn't recognize the entry if you do

This commit was SVN r28148.
Этот коммит содержится в:
Ralph Castain 2013-03-06 14:53:51 +00:00
родитель 3c5cd95087
Коммит 5b09cccacc

Просмотреть файл

@ -7,13 +7,11 @@
use strict;
# Sanity check
die "Not in Git+SVN repository top dir"
if (! -d ".git" && ! -d ".svn");
# Put in some specials that we ignore everywhere
my @globals = qw/.libs
.deps
.libs
.svn
*.la
*.lo
*.o
@ -29,6 +27,9 @@ my @globals = qw/.libs
*.xcscheme
*.plist
*~
Makefile
Makefile.in
static-components.h
*\\\#/;
unshift(@globals, "# Automatically generated by build-gitignore.pl; edits may be lost!");
@ -36,12 +37,21 @@ my $debug;
$debug = 1
if ($ARGV[0]);
open(OUT, ">.gitignore");
# add the globals */
foreach my $val (@globals) {
print OUT "$val\n";
}
print "Thinking...\n"
if (!$debug);
# Start at the top level
process(".");
close(OUT);
# Done!
exit(0);
@ -50,6 +60,8 @@ exit(0);
# DFS-oriented recursive directory search
sub process {
my $dir = shift;
my $outdir = $dir;
$outdir =~ s/^\.\///;
# Look at the svn:ignore property for this directory
my $svn_ignore = `svn pg svn:ignore $dir 2> /dev/null`;
@ -62,7 +74,7 @@ sub process {
print "Found svn:ignore in $dir\n"
if ($debug);
my @git = @globals;
my @git;
# See if there's an .gitignore_local file. If so, add its
# contents to the end.
@ -103,19 +115,14 @@ sub process {
}
# Write out a new .gitignore file
unlink("$dir/.gitignore");
open(OUT, ">$dir/.gitignore") || die "Can't open .gitignore file";
foreach my $val (@git) {
print OUT "$val\n";
if ($outdir eq ".") {
print OUT "$val\n";
} else {
print OUT "$outdir/$val\n";
}
}
# Ignore the .svn dir if that directory exists
print OUT ".svn\n"
if (-d "$dir/.svn");
close(OUT);
# Git add this .gitignore file
system("git add $dir/.gitignore");
}
# Now find subdirectories in this directory