From 61e668b0d338c91235644abff31ee1ef90cea9a4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Dec 2019 10:44:58 +0000 Subject: [PATCH] import-catacomb-crypto: Do not go mad on initial import I think the branch I received must have had its initial import done with a different version of this script. When I tried it, I got "argument list too long" because the whole history of every relevant file had been included in the commit message. Signed-off-by: Ian Jackson --- import-catacomb-crypto | 48 +++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/import-catacomb-crypto b/import-catacomb-crypto index c6a89ef..98a0963 100755 --- a/import-catacomb-crypto +++ b/import-catacomb-crypto @@ -148,29 +148,33 @@ sub commit_changes () { } ## Now the detailed list of upstream commits. - $msg .= "\nDetailed list of changes:\n"; - my @paths; my @roots; - for my $path (keys %DONOR_REV_MAP) { - my $rev = $DONOR_REV_MAP{$path}; - if (defined $rev) { push @paths, $path; push @roots, $rev; } - } - chomp (my @revs = capturex @with_dir, $DONOR_DIR, - "git", "rev-list", "--reverse", - "HEAD", "--not", @roots, "--", @paths); - - for my $rev (@revs) { - my @affected = (); - for my $path (@paths) { - runx [0, 1], @with_dir, $DONOR_DIR, - "git", "merge-base", "--is-ancestor", - $DONOR_REV_MAP{$path}, $rev; - push @affected, $path if !$EXITVAL; + if (grep { defined } values %DONOR_REV_MAP) { + $msg .= "\nDetailed list of changes:\n"; + my @paths; my @roots; + for my $path (keys %DONOR_REV_MAP) { + my $rev = $DONOR_REV_MAP{$path}; + if (defined $rev) { push @paths, $path; push @roots, $rev; } + } + chomp (my @revs = capturex @with_dir, $DONOR_DIR, + "git", "rev-list", "--reverse", + "HEAD", "--not", @roots, "--", @paths); + + for my $rev (@revs) { + my @affected = (); + for my $path (@paths) { + runx [0, 1], @with_dir, $DONOR_DIR, + "git", "merge-base", "--is-ancestor", + $DONOR_REV_MAP{$path}, $rev; + push @affected, $path if !$EXITVAL; + } + $msg .= "\n" . join "", + grep { s/\s+$/\n/ } + map { " " . $_ } + capturex @with_dir, $DONOR_DIR, + "git", "show", "--stat", $rev, "--", @affected; } - $msg .= "\n" . join "", - grep { s/\s+$/\n/ } - map { " " . $_ } - capturex @with_dir, $DONOR_DIR, - "git", "show", "--stat", $rev, "--", @affected; + } else { + $msg .= "\nInitial import.\n"; } ## The trailer, so that we can see where we left off. -- 2.30.2