* Do not specified patch names which look like series filenames
* When we invent a filename based on a commit message, add ".patch".
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git_get_ref git_for_each_ref
git_for_each_tag_referring is_fast_fwd
$package_re $component_re $deliberately_re
git_get_ref git_for_each_ref
git_for_each_tag_referring is_fast_fwd
$package_re $component_re $deliberately_re
- $distro_re $versiontag_re
+ $distro_re $versiontag_re $series_filename_re
$branchprefix
initdebug enabledebug enabledebuglevel
printdebug debugcmd
$branchprefix
initdebug enabledebug enabledebuglevel
printdebug debugcmd
our $distro_re = $component_re;
our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+};
our $branchprefix = 'dgit';
our $distro_re = $component_re;
our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+};
our $branchprefix = 'dgit';
+our $series_filename_re = qr{(?:^|\.)series(?!\n)$}s;
# policy hook exit status bits
# see dgit-repos-server head comment for documentation
# policy hook exit status bits
# see dgit-repos-server head comment for documentation
Important bugfixes to dgit:
* Pass --no-renames to git diff-tree -z, avoiding potential trouble.
Important bugfixes to dgit:
* Pass --no-renames to git diff-tree -z, avoiding potential trouble.
+ * Defend against commit subject lines which would generate patches which
+ look like series files, etc. Involves adding .patch to all generated
+ patch filenames.
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 $@;
$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 = '';
diff <<END - debian/patches/series
ups-topic/ups-yml
diff <<END - debian/patches/series
ups-topic/ups-yml
-spongiform-upstream-new-file-incl-change
-zorkmid-options-=-42
+spongiform-upstream-new-file-incl-change.patch
+zorkmid-options-=-42.patch
END
for f in `cat debian/patches/series`; do
END
for f in `cat debian/patches/series`; do