chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dgit: unrepres. changes: Tolerate deletion of executable files
[dgit.git]
/
dgit
diff --git
a/dgit
b/dgit
index be277f3e48e6daca67eec32aa30e7317cda8f194..d1bf2136a6d86550f847e5d071322a3227885864 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-3380,6
+3380,7
@@
END
return;
}
my $af = ".git/info/attributes";
return;
}
my $af = ".git/info/attributes";
+ ensuredir '.git/info';
open GAO, "> $af.new" or die $!;
print GAO <<END or die $!;
* dgit-defuse-attrs
open GAO, "> $af.new" or die $!;
print GAO <<END or die $!;
* dgit-defuse-attrs
@@
-3498,6
+3499,7
@@
sub fork_for_multisuite ($) {
$before_fetch_merge->();
foreach my $tsuite (@suites[1..$#suites]) {
$before_fetch_merge->();
foreach my $tsuite (@suites[1..$#suites]) {
+ $tsuite =~ s/^-/$cbasesuite-/;
my $csubsuite = multisuite_suite_child($tsuite, \@mergeinputs,
sub {
@end = ();
my $csubsuite = multisuite_suite_child($tsuite, \@mergeinputs,
sub {
@end = ();
@@
-3612,6
+3614,9
@@
END
}
sub clone ($) {
}
sub clone ($) {
+ # in multisuite, returns twice!
+ # once in parent after first suite fetched,
+ # and then again in child after everything is finished
my ($dstdir) = @_;
badusage "dry run makes no sense with clone" unless act_local();
my ($dstdir) = @_;
badusage "dry run makes no sense with clone" unless act_local();
@@
-3623,7
+3628,7
@@
sub clone ($) {
printdebug "multi clone after fetch merge\n";
clone_set_head();
clone_finish($dstdir);
printdebug "multi clone after fetch merge\n";
clone_set_head();
clone_finish($dstdir);
-
exit 0
;
+
return
;
}
printdebug "clone main body\n";
}
printdebug "clone main body\n";
@@
-4886,7
+4891,7
@@
sub quiltify_trees_differ ($$;$$$) {
# a list of unrepresentable changes (removals of upstream files
# (as messages)
local $/=undef;
# a list of unrepresentable changes (removals of upstream files
# (as messages)
local $/=undef;
- my @cmd = (@git, qw(diff-tree -z));
+ my @cmd = (@git, qw(diff-tree -z
--no-renames
));
push @cmd, qw(--name-only) unless $unrepres;
push @cmd, qw(-r) if $finegrained || $unrepres;
push @cmd, $x, $y;
push @cmd, qw(--name-only) unless $unrepres;
push @cmd, qw(-r) if $finegrained || $unrepres;
push @cmd, $x, $y;
@@
-4905,14
+4910,21
@@
sub quiltify_trees_differ ($$;$$$) {
if ($unrepres) {
eval {
if ($unrepres) {
eval {
- die "not a plain file\n"
- unless $newmode =~ m/^
10
\d{4}$/ ||
- $oldmode =~ m/^
10
\d{4}$/;
+ die "not a plain file
or symlink
\n"
+ unless $newmode =~ m/^
(?:10|12)
\d{4}$/ ||
+ $oldmode =~ m/^
(?:10|12)
\d{4}$/;
if ($oldmode =~ m/[^0]/ &&
$newmode =~ m/[^0]/) {
if ($oldmode =~ m/[^0]/ &&
$newmode =~ m/[^0]/) {
- die "mode changed\n" if $oldmode ne $newmode;
+ # both old and new files exist
+ die "mode or type changed\n" if $oldmode ne $newmode;
+ die "modified symlink\n" unless $newmode =~ m/^10/;
+ } elsif ($oldmode =~ m/[^0]/) {
+ # deletion
+ die "deletion of symlink\n"
+ unless $oldmode =~ m/^10/;
} else {
} else {
- die "non-default mode\n"
+ # creation
+ die "non-default mode or type\n"
unless $newmode =~ m/^100644$/ ||
$oldmode =~ m/^100644$/;
}
unless $newmode =~ m/^100644$/ ||
$oldmode =~ m/^100644$/;
}
@@
-5269,6
+5281,7
@@
sub quiltify ($$$$) {
die "contains unexpected slashes\n" if m{//} || m{/$};
die "contains leading punctuation\n" if m{^\W} || m{/\W};
die "contains bad character(s)\n" if m{[^-a-z0-9_.+=~/]}i;
die "contains unexpected slashes\n" if m{//} || m{/$};
die "contains leading punctuation\n" if m{^\W} || m{/\W};
die "contains bad character(s)\n" if m{[^-a-z0-9_.+=~/]}i;
+ die "is series file\n" if m{$series_filename_re}o;
die "too long" if length > 200;
};
return $_ unless $@;
die "too long" if length > 200;
};
return $_ unless $@;
@@
-5307,6
+5320,7
@@
sub quiltify ($$$$) {
$patchname =~ y/-a-z0-9_.+=~//cd;
$patchname =~ s/^\W/x-$&/;
$patchname = substr($patchname,0,40);
$patchname =~ y/-a-z0-9_.+=~//cd;
$patchname =~ s/^\W/x-$&/;
$patchname = substr($patchname,0,40);
+ $patchname .= ".patch";
}
if (!defined $patchdir) {
$patchdir = '';
}
if (!defined $patchdir) {
$patchdir = '';
@@
-6342,7
+6356,10
@@
END
foreach my $fi (@dfi) {
my $f = $fi->{Filename};
my $here = "../$f";
foreach my $fi (@dfi) {
my $f = $fi->{Filename};
my $here = "../$f";
- next if lstat $here;
+ if (lstat $here) {
+ next if stat $here;
+ fail "lstat $here works but stat gives $! !";
+ }
fail "stat $here: $!" unless $! == ENOENT;
my $there = $dscfn;
if ($dscfn =~ m#^(?:\./+)?\.\./+#) {
fail "stat $here: $!" unless $! == ENOENT;
my $there = $dscfn;
if ($dscfn =~ m#^(?:\./+)?\.\./+#) {
@@
-6353,8
+6370,10
@@
END
fail "cannot import $dscfn which seems to be inside working tree!";
}
$there =~ s#/+[^/]+$## or
fail "cannot import $dscfn which seems to be inside working tree!";
}
$there =~ s#/+[^/]+$## or
- fail "
cannot import $dscfn which seems to not have a basename
";
+ fail "
import $dscfn requires ../$f, but it does not exist
";
$there .= "/$f";
$there .= "/$f";
+ my $test = $there =~ m{^/} ? $there : "../$there";
+ stat $test or fail "import $dscfn requires $test, but: $!";
symlink $there, $here or fail "symlink $there to $here: $!";
progress "made symlink $here -> $there";
# print STDERR Dumper($fi);
symlink $there, $here or fail "symlink $there to $here: $!";
progress "made symlink $here -> $there";
# print STDERR Dumper($fi);