The .dsc and .changes matching code contained roughly
$fieldbody =~ / \Q$item\E\n/m
but this is wrong when the $fieldbody matches $item in its last line,
and there is no trailing newline (as would be usual). This code
is obviouslu confused because m affects only ^ $ which don't appear
in the regexp. Change these to / \Q$item\E$/m which is what ought
to have been, and probably was, intended.
In one case we are trying to delete a line. In that case we need to
remove the leading newline. The field body always starts with a
newline so the use of \n rather than ^ is fine.
Closes:#869146.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit (5.3~) unstable; urgency=medium
Bugfixes:
dgit (5.3~) unstable; urgency=medium
Bugfixes:
+ * dgit: Do not introduce duplicate origs in .changes files,
+ eg if the .changes already has that orig. Closes:#869146.
* Honour GIT_REFLOG_ACTION everywhere. Closes:#901935.
* git-debrebase new-upstream: Provide better reflog entries
by setting GIT_REFLOG_ACTION. Closes:#901925.
* Honour GIT_REFLOG_ACTION everywhere. Closes:#901935.
* git-debrebase new-upstream: Provide better reflog entries
by setting GIT_REFLOG_ACTION. Closes:#901925.
if ($found_same) {
# in archive, delete from .changes if it's there
$changed{$file} = "removed" if
if ($found_same) {
# in archive, delete from .changes if it's there
$changed{$file} = "removed" if
- $changes->{$fname} =~ s/^.* \Q$file\E$(?:)\n//m;
- } elsif ($changes->{$fname} =~ m/^.* \Q$file\E$(?:)\n/m) {
+ $changes->{$fname} =~ s/\n.* \Q$file\E$(?:)$//m;
+ } elsif ($changes->{$fname} =~ m/^.* \Q$file\E$(?:)$/m) {
# not in archive, but it's here in the .changes
} else {
my $dsc_data = getfield $dsc, $fname;
# not in archive, but it's here in the .changes
} else {
my $dsc_data = getfield $dsc, $fname;
- $dsc_data =~ m/^(.* \Q$file\E$)\n/m or die "$dsc_data $file ?";
+ $dsc_data =~ m/^(.* \Q$file\E$)$/m or die "$dsc_data $file ?";
my $extra = $1;
$extra =~ s/ \d+ /$&$placementinfo /
or die "$fname $extra >$dsc_data< ?"
my $extra = $1;
$extra =~ s/ \d+ /$&$placementinfo /
or die "$fname $extra >$dsc_data< ?"