-if ($incl_generated_files) {
- die "'a' must not exist in the current directory.\n" if -e 'a';
- die "'b' must not exist in the current directory.\n" if -e 'b';
- system "./prepare-source && rsync -a @extra_files a/" and exit 1;
+my @patches = sort keys %patches;
+
+my(%parent, %description);
+foreach my $patch (@patches) {
+ my $branch = ($local_patch{$patch} ? '' : 'origin/') . "patch/$patch";
+ my $desc = '';
+ open(PIPE, '-|', 'git', 'diff', '-U1000', "master...$branch", '--', "PATCH.$patch") or die $!;
+ while (<PIPE>) {
+ last if /^@@ /;
+ }
+ while (<PIPE>) {
+ next unless s/^[ +]//;
+ if (m#patch -p1 <patches/(\S+)\.diff# && $1 ne $patch) {
+ $parent{$patch} = $1;
+ }
+ $desc .= $_;
+ }
+ $description{$patch} = $desc;