From: Ian Jackson Date: Tue, 31 Dec 2019 12:55:19 +0000 (+0000) Subject: catacomb-import-update: Improve import change listing algorithm X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=4290dba6dbf522517f8088caf7efebf1f955e6b9;p=secnet.git catacomb-import-update: Improve import change listing algorithm Treat each file separately for the purposes of whether to say "Initial import." That now becomes an entry in the detailed change list. We must change the variable @paths there to @lpaths, since the surrounding code uses @paths for the complete set of paths, not just the ones to pass to git-log. Signed-off-by: Ian Jackson --- diff --git a/catacomb-import-update b/catacomb-import-update index 9deeddf..ad28b3f 100755 --- a/catacomb-import-update +++ b/catacomb-import-update @@ -139,20 +139,21 @@ sub commit_changes () { } ## Now the detailed list of upstream commits. - 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; } - } + $msg .= "\nDetailed list of changes:\n"; + my @lpaths; my @roots; + for my $path (sort keys %DONOR_REV_MAP) { + my $rev = $DONOR_REV_MAP{$path}; + if (defined $rev) { push @lpaths, $path; push @roots, $rev; } + else { $msg .= " Initial import of $path.\n"; } + } + if (@roots) { chomp (my @revs = capturex @with_dir, $DONOR_DIR, "git", "rev-list", "--reverse", - "HEAD", "--not", @roots, "--", @paths); + "HEAD", "--not", @roots, "--", @lpaths); for my $rev (@revs) { my @affected = (); - for my $path (@paths) { + for my $path (@lpaths) { runx [0, 1], @with_dir, $DONOR_DIR, "git", "merge-base", "--is-ancestor", $DONOR_REV_MAP{$path}, $rev; @@ -164,8 +165,6 @@ sub commit_changes () { 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.