Author: adam-guest
Date: 2008-05-01 17:36:12 +0000 (Thu, 01 May 2008)
New Revision: 1416
Modified:
trunk/debian/changelog
trunk/scripts/debcommit.pl
Log:
Don't attempt to commit if an editor was spawned (either via --edit
or automatically) and the user quit without updating and saving the
message
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-05-01 17:27:25 UTC (rev 1415)
+++ trunk/debian/changelog 2008-05-01 17:36:12 UTC (rev 1416)
@@ -39,6 +39,9 @@
+ Fix commit message detection for bzr; thanks Colin Watson
(Closes: #478667)
+ Remove trailing newlines after editing the commit message
+ + Don't attempt to commit if an editor was spawned (either via --edit
+ or automatically) and the user quit without updating and saving the
+ message
* licensecheck: Correctly detect LGPLv3+ (Closes: #477742)
* tagpending: Use option bundling (so that e.g. "tagpending -ni" works)
* transition-check: New script to determine whether a set of source packages
Modified: trunk/scripts/debcommit.pl
===================================================================
--- trunk/scripts/debcommit.pl 2008-05-01 17:27:25 UTC (rev 1415)
+++ trunk/scripts/debcommit.pl 2008-05-01 17:36:12 UTC (rev 1416)
@@ -341,7 +341,9 @@
}
else {
if ($edit) {
- $message = edit($message);
+ my $modified = 0;
+ ($message, $modified) = edit($message);
+ die "$progname: Commit message not modified / saved; aborting\n" unless
$modified;
}
commit($message) if not $confirm or confirm($message);
}
@@ -672,7 +674,8 @@
$message = $confirmmessage;
return 1;
} elsif (/^e/i) {
- $confirmmessage = edit($confirmmessage);
+ my $modified = 0;
+ ($confirmmessage, $modified) = edit($confirmmessage);
print "\n", $confirmmessage, "\n--\n";
}
}
@@ -684,6 +687,8 @@
open(FH, ">$tempfile") || die "debcommit: unable to create a temporary
file.\n";
print FH $message;
close FH;
+ my $mtime = (stat("$tempfile"))[9];
+ defined $mtime || die "$progname: unable to retrieve modification time for
temporary file: $!\n";
system("sensible-editor $tempfile");
open(FH, "<$tempfile") || die "debcommit: unable to open temporary file
for reading\n";
$message = "";
@@ -691,9 +696,11 @@
$message .= $_;
}
close FH;
+ my $newmtime = (stat("$tempfile"))[9];
+ defined $newmtime || die "$progname: unable to retrieve modification time
for updated temporary file: $!\n";
unlink($tempfile);
chomp $message;
- return $message;
+ return ($message, $mtime != $newmtime);
}
=head1 LICENSE
--
To unsubscribe, send mail to [EMAIL PROTECTED]