return if $DOCONVERT;
+ my $dir = $DONOR_IMPORT_DIR;
+ runx 'rm', '-rf', $dir;
+ runx 'mkdir', $dir;
+
my @paths = sort keys %DONOR_REV_MAP;
runx 'rsync', '-Rc', (map { "$DONOR_DIR/./$_" } @paths), $DONOR_IMPORT_DIR;
- my $dir = $DONOR_IMPORT_DIR;
## Stage updated files for commit.
- runx "git", "update-index", "--add", "--",
- map { "$dir/$_" } keys %DONOR_REV_MAP;
+ runx "git", "add", "-A", $dir;
## Inspect the changed files. Notice whether we've actually changed or
## added files.
$changed{$path} = 1; $new{$path} = ($old !~ /[^0]/);
}
- ## Files which haven't changed aren't interesting any more.
- for my $path (keys %DONOR_REV_MAP) {
- if (!$changed{$path}) {
- delete $DONOR_REV_MAP{$path};
- }
- }
- if (!%DONOR_REV_MAP) { moan "no changes to import"; return ""; }
+ ## Files which haven't changed aren't interesting
+ if (!%changed) { moan "no changes to import"; return ""; }
## Build the commit preamble.
$msg .= "Update crypto code from Catacomb $DONOR_VERSION.\n\n";
## Now the detailed list of upstream commits.
$msg .= "\nDetailed list of changes:\n";
my @lpaths; my @roots;
- for my $path (sort keys %DONOR_REV_MAP) {
+ for my $path (sort keys %changed) {
+ if (!exists $DONOR_REV_MAP{$path}) { $msg .= " Deleted $path.\n"; next; }
my $rev = $DONOR_REV_MAP{$path};
if (defined $rev) { push @lpaths, $path; push @roots, $rev; }
else { $msg .= " Initial import of $path.\n"; }
## Commit everything.
runx "git", "commit", "--edit", "--message", $msg,
- map { "$dir/$_" } @paths;
+ map { "$dir/$_" } keys %changed;
}
###--------------------------------------------------------------------------