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.
Этот коммит содержится в:
родитель
3c5cd95087
Коммит
5b09cccacc
@ -7,13 +7,11 @@
|
|||||||
|
|
||||||
use strict;
|
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
|
# Put in some specials that we ignore everywhere
|
||||||
my @globals = qw/.libs
|
my @globals = qw/.libs
|
||||||
.deps
|
.deps
|
||||||
|
.libs
|
||||||
|
.svn
|
||||||
*.la
|
*.la
|
||||||
*.lo
|
*.lo
|
||||||
*.o
|
*.o
|
||||||
@ -29,6 +27,9 @@ my @globals = qw/.libs
|
|||||||
*.xcscheme
|
*.xcscheme
|
||||||
*.plist
|
*.plist
|
||||||
*~
|
*~
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
static-components.h
|
||||||
*\\\#/;
|
*\\\#/;
|
||||||
unshift(@globals, "# Automatically generated by build-gitignore.pl; edits may be lost!");
|
unshift(@globals, "# Automatically generated by build-gitignore.pl; edits may be lost!");
|
||||||
|
|
||||||
@ -36,12 +37,21 @@ my $debug;
|
|||||||
$debug = 1
|
$debug = 1
|
||||||
if ($ARGV[0]);
|
if ($ARGV[0]);
|
||||||
|
|
||||||
|
open(OUT, ">.gitignore");
|
||||||
|
|
||||||
|
# add the globals */
|
||||||
|
foreach my $val (@globals) {
|
||||||
|
print OUT "$val\n";
|
||||||
|
}
|
||||||
|
|
||||||
print "Thinking...\n"
|
print "Thinking...\n"
|
||||||
if (!$debug);
|
if (!$debug);
|
||||||
|
|
||||||
# Start at the top level
|
# Start at the top level
|
||||||
process(".");
|
process(".");
|
||||||
|
|
||||||
|
close(OUT);
|
||||||
|
|
||||||
# Done!
|
# Done!
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
@ -50,6 +60,8 @@ exit(0);
|
|||||||
# DFS-oriented recursive directory search
|
# DFS-oriented recursive directory search
|
||||||
sub process {
|
sub process {
|
||||||
my $dir = shift;
|
my $dir = shift;
|
||||||
|
my $outdir = $dir;
|
||||||
|
$outdir =~ s/^\.\///;
|
||||||
|
|
||||||
# Look at the svn:ignore property for this directory
|
# Look at the svn:ignore property for this directory
|
||||||
my $svn_ignore = `svn pg svn:ignore $dir 2> /dev/null`;
|
my $svn_ignore = `svn pg svn:ignore $dir 2> /dev/null`;
|
||||||
@ -62,7 +74,7 @@ sub process {
|
|||||||
print "Found svn:ignore in $dir\n"
|
print "Found svn:ignore in $dir\n"
|
||||||
if ($debug);
|
if ($debug);
|
||||||
|
|
||||||
my @git = @globals;
|
my @git;
|
||||||
|
|
||||||
# See if there's an .gitignore_local file. If so, add its
|
# See if there's an .gitignore_local file. If so, add its
|
||||||
# contents to the end.
|
# contents to the end.
|
||||||
@ -103,19 +115,14 @@ sub process {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Write out a new .gitignore file
|
# Write out a new .gitignore file
|
||||||
unlink("$dir/.gitignore");
|
|
||||||
open(OUT, ">$dir/.gitignore") || die "Can't open .gitignore file";
|
|
||||||
foreach my $val (@git) {
|
foreach my $val (@git) {
|
||||||
|
if ($outdir eq ".") {
|
||||||
print OUT "$val\n";
|
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
|
# Now find subdirectories in this directory
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user